Keras 3 .keras save format: preserving optimizer state during zero‑downtime migration
0 reputation · 06 Oct 2020, 02:00 UTC
Keras 3 .keras save format: preserving optimizer state during zero‑downtime migration
Goal: migrate a small inference service from Keras 2 HDF5 checkpoints to the Keras 3 .keras zip format without taking the service offline.
Constraints: the migration must keep the optimizer state and training history intact so that fine‑tuning can resume immediately after the switch, and the new format must remain loadable under the same backend (TensorFlow) used originally.
Uncertainty: it is unclear whether the .keras format automatically serializes optimizer variables and whether any additional registration of custom objects is required when reloading the model in the same process version.
Questions:
- Does saving a model with
model.save('model.keras')in Keras 3 retain the optimizer’s variables and training history? - If custom layers or metrics were defined in Keras 2, must they be re‑registered via
keras.saving.register_keras_serializableor supplied toload_modelwhen loading the .keras file in Keras 3? - Is there a documented way to verify that the optimizer state is preserved without retraining the model?