Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving Model Checkpoint vs Saving Entire model in Keras

Which method is best, whether saving model checkpoints or saving entire model to disk for each epochs. Why nobody saves the entire model?

like image 368
R Nanthak Avatar asked Oct 16 '25 04:10

R Nanthak


2 Answers

A keras model has two things, an architecture and weights. If you save the whole model in each checkpoint, you’re saving the architecture every time. For this reason the best on training is to save only weight and use the wireframe in memory.

On tensorflow.keras documentation have more about other methods.

like image 143
Felipe Borges Avatar answered Oct 17 '25 18:10

Felipe Borges


Checkpoints are used to save your model if in case your system crashes or code interrupted while training so when you start training your model again after crashes you don't have to start from scratch.Checkpoints capture the exact value of all parameters (tf.Variable objects) used by a model. Checkpoints do not contain any description of the computation defined by the model.

The SavedModel format on the other hand includes a serialized description of the computation defined by the model in addition to the parameter values (checkpoint). Models in this format are independent of the source code that created the model. you can see the above info in the official doc of tensorflow. @R Nanthak

like image 34
astroboy Avatar answered Oct 17 '25 18:10

astroboy