Convert our checkpoint colabs into runnable scripts
See original GitHub issueThe colabs we currently have in tools/checkpoint_conversion
are useful in that we don’t loose the code for converting checkpoints. But they are fairly unwieldy. They must be pointed to a specific branch used for the model development, they are a ton of lines of code, and we need one for each model variant.
Instead we could try to write one script per model that handles checkpoint conversion (perhaps with a flag to control the model variant?). Potential file structure.
tools
└── checkpoint_conversion
├── README.md
├── convert_bert_weights.py
├── convert_gpt2_weights.py
└── requirements.txt
This will make it much easier to re-run and test checkpoint conversion code in the future.
Issue Analytics
- State:
- Created 10 months ago
- Comments:5
Top Results From Across the Web
How to Convert Diffusers Dreambooth Models to CKPT Format!
Well - now you can with this quick and easy to run script ! Put yourself into any film your like, and make...
Read more >Share a model - Hugging Face
In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the Model Hub: Programmatically push your files...
Read more >Migrate checkpoint saving | TensorFlow Core
In TensorFlow 1, to configure checkpoint saving during training/validation with the tf.estimator.Estimator APIs, you specify a schedule in tf.estimator.
Read more >Checkpoint file not being created with ... - GitHub
Hi, I'm trying to run this script: tf1_checkpoint_converter_lib.py to convert the BERT checkpoints generated with tensorflow 1.15 to ...
Read more >How to Use Google Colab for Deep Learning
You can use the code cell in Colab not only to run Python code but also to run shell commands. Just add a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vulkomilev, please go ahead with writing the conversion script for BERT! You can follow the same template as RoBERTa’s script: https://github.com/keras-team/keras-nlp/blob/master/tools/checkpoint_conversion/convert_roberta_checkpoints.py.
@vulkomilev, KerasNLP does not have a separate class for
BertBase
. There is a model class forBertBackbone
: https://github.com/keras-team/keras-nlp/blob/master/keras_nlp/models/bert/bert_backbone.py#L35. If you want the base variant of BERT, you can do this:These “presets” are drawn from here: https://github.com/keras-team/keras-nlp/blob/master/keras_nlp/models/bert/bert_presets.py.
Regarding checkpoint conversion for BERT, follow the same format as RoBERTa. Use the conversion notebooks mentioned in this directory as reference: https://github.com/keras-team/keras-nlp/tree/master/tools/checkpoint_conversion.
So, for example, contents of this cell
can go in the
download_model()
function.Contents of this cell:
can go in
convert_checkpoints()
.etc., etc.
The conversion script should work for all BERT presets (passed as an arg to the script).