Saving a model after pretraining on custom data.
Currently, after running the run_pretraining.py the model checkpoints get saved. But is there any way I can save the entire model as a model.pb file so that in future it could be loaded directly as a KerasLayer with tf_hub?
Or is there a way of loading model.ckpt as a KerasLayer?
Please let me know if there is a way to do either. It'd be very helpful.
Thanks.
Currently, after running the
run_pretraining.pythe model checkpoints get saved. But is there any way I can save the entire model as amodel.pbfile so that in future it could be loaded directly as aKerasLayerwithtf_hub?Or is there a way of loading
model.ckptas aKerasLayer?Please let me know if there is a way to do either. It'd be very helpful.
Thanks.
I don't know the way for converting it to a model.pb, but for the people that find this issue. You can use https://huggingface.co/docs/transformers/converting_tensorflow_models to convert tensorflow checkpoints into pytorch_model.bin
@theProcrastinatr I think you can do like this
Save the entire model as a SavedModel.
!mkdir -p saved_model model.save('saved_model/my_model')
my_model directory
ls saved_model
Contains an assets folder, saved_model.pb, and variables folder.
ls saved_model/my_model
Currently, after running the
run_pretraining.pythe model checkpoints get saved. But is there any way I can save the entire model as amodel.pbfile so that in future it could be loaded directly as aKerasLayerwithtf_hub?Or is there a way of loading
model.ckptas aKerasLayer?Please let me know if there is a way to do either. It'd be very helpful.
Thanks.