Retrieving code of a saved model

This question is being formulated at Week 3 of Course 4, but could equally apply to Week 2 assignments.
I saved a trained model with tf.keras.models.save_model(MyM), it produced a folder with the contents expected. When I retrieve it, using tf.keras.models.load_model(MyM), everything works, except I can’t see the source code. (I am using Jupyter.notebooks). What to do if I want to continue working with the code of a “save_model” model?

If you want to save your notebook, use the “File → Download As” tool from the menu bar.

And you shouldn’t expect to have the notebook code saved as part of the model, since per the doc

The SavedModel and HDF5 file contains:

- the model’s configuration (topology)
- the model’s weights
- the model’s optimizer’s state (if any)

Thus models can be reinstantiated in the exact same state, without any of the code used for model definition or training.

Thanks ai_curious. Yes, I learnt the hard way that saving the model with save_model does not retain the code.

There is nothing that says you can’t write your own Python Class that incorporates Keras Model functionality, either by composition (has-a) or inheritance (is-a), and implementing a custom save model to capture meta information about how the model was configured and trained.

Thanks Curious. But your answer is way above my “pay level”…:frowning: