Antony Joy
Antony Joy

Reputation: 301

Query regarding saving keras model. How does saving a model work?

After saving a Keras model, where is it saved? Is it saved locally? The below code is saving a model.

from keras.models import load_model

model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5
model = load_model('my_model.h5')

After saving the model can I use the load model again in another jupyter ipynb file?

Upvotes: 0

Views: 46

Answers (1)

Innat
Innat

Reputation: 17239

When we do model.save, it will save model architecture and weight at the same time. It will save as .h5 locally and we can load it in another environment (local notebook, kaggle notebook, colab, GCP, etc). Using load_model will load fully model (arch + weight).

Please, read the official blog, you will find plenty of examples. https://www.tensorflow.org/guide/keras/save_and_serialize

Upvotes: 1

Related Questions