sonnet icon indicating copy to clipboard operation
sonnet copied to clipboard

How to re-create module from loaded model?

Open vishnukmd7 opened this issue 4 years ago • 1 comments

Hi, I'm extremely new to both TF and Sonnet.

I was trying to figure out how to save and load a trained network. I was following what was written in https://github.com/deepmind/sonnet#tensorflow-saved-model , but cant figure out how to regenerate a my_module object, with the weights from the loaded model.

Thanks!

vishnukmd7 avatar Jul 25 '20 04:07 vishnukmd7

Hi, You can save the model by this: tf.saved_model.save(my_model, "the_saved_model") And for loading your model back use this: new_model = tf.saved_model.load("the_saved_model")

siAyush avatar Oct 24 '20 18:10 siAyush