new python file to upload mosaic-bert to hf #1109
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added
convert_mosaicbert_to_hf.py
insideinference
folder.inference/convert_composer_to_hf.py
was only able to convert MPT and other CausalLMs to HF. Adapted that code to work on mosaic_bertThe python script takes in an optional
bert_config_path
JSON, if not provided, it uses the config from mosaicml/mosaic-bert-base-Huggingface. It also downloads (via therequests
package) some required scripts such asbert_layers.py
from there.Wasn't sure whether to PR on this repository or
mosaicml/examples
. Decided to do it here since my script needs thellmfoundry
package anyway.Solves MosaicBERT: Convert composer weights to HF examples#445 and Accessing model after pre-training examples#401 (comment)