Why Save Models?
Training can take minutes or even days. You do not want to repeat it each time you need a prediction. Saving lets you store the trained model and use it later, share it or deploy it.
The .keras Format
The recommended way in Keras 3 is a single file with the extension .keras. It stores the architecture, the weights, the optimizer state and the compile settings.
.h5 or the TensorFlow SavedModel folder with model.save(). In Keras 3, use .keras for saving and loading models. You can still use model.export() for the SavedModel format used in serving.
Continue Training
Because the optimizer state is saved, you can load the model and keep training from where you stopped.
Saving Only the Weights
Weights files must end with .weights.h5 in Keras 3.
Export for Serving
An exported model is made for inference only (predictions), and is used with TensorFlow Serving or converted to TensorFlow Lite.
Custom Layers and Saving
If your model contains custom classes, tell Keras about them when loading:
| Goal | Command |
|---|---|
| Save everything | model.save("m.keras") |
| Load everything | keras.models.load_model("m.keras") |
| Save weights only | model.save_weights("m.weights.h5") |
| Export for serving | model.export("folder") |
Conclusion
Saving and loading models is easy and essential. Use .keras for most of your work and export when you deploy.

