How to continue training model using ModelCheckpoint of Keras
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
To continue training from a Keras checkpoint, you need to know what was saved. If the checkpoint stores only weights, rebuild the model and load the weights; if it stores the full model, load the model object and continue calling fit.
Save Weights Only and Resume Later
This is a common pattern when you want control over model construction in code.
Later, to continue training:
The important requirement is that build_model() must recreate the same architecture. If the layer shapes or names do not match, weight loading will fail.
Save the Full Model If You Want More State Back
If you save the full model instead of weights only, Keras can restore the architecture and optimizer state too.
Resume like this:
This is often the simplest way to continue training because you do not need to rebuild the model manually.
Understand initial_epoch
initial_epoch does not load anything by itself. It only tells fit which epoch number to treat as the starting point for logs and callbacks.
If you previously trained through epoch 3, then a continuation call such as this is appropriate:
That means Keras continues from epoch index 3 up to 9. Without initial_epoch, the training still runs, but the epoch numbering and some callback behaviors may be misleading.
Best Checkpoint Versus Last Checkpoint
Be careful with save_best_only=True. That setting saves the best checkpoint according to the monitored metric, not necessarily the most recent training state.
If you resume from this file, you are continuing from the best saved model so far, not automatically from the interrupted last epoch. That is fine when you want the best weights, but it is different from exact crash recovery.
For exact training recovery in long jobs, many teams also use callbacks designed for fault tolerance, not just model selection.
A Practical Rule
Choose one of these patterns:
- weights only if you prefer explicit model construction in code
- full model if you want the easiest continuation path
In either case, keep the architecture, preprocessing, and label encoding consistent between the original run and the resumed run. A checkpoint cannot fix a changed input pipeline.
Common Pitfalls
- Calling
load_weightson a model whose architecture no longer matches the saved weights. - Expecting
initial_epochto restore training state. It only affects fit bookkeeping. - Using
save_best_only=Trueand assuming the file is the latest epoch rather than the best monitored checkpoint. - Forgetting to compile the rebuilt model before further training when using weights-only restoration.
- Changing preprocessing or class order between runs and blaming the checkpoint when resumed metrics look wrong.
Summary
- To continue training, first identify whether the checkpoint saved weights only or the full model.
- With weights-only checkpoints, rebuild the same model and call
load_weights. - With full-model checkpoints, use
keras.models.load_modeland continuefit. - '
initial_epochis for correct epoch numbering, not for loading the checkpoint itself.' - '
save_best_only=Trueresumes from the best saved checkpoint, not necessarily the most recent one.'

