keras
keras copied to clipboard
loss/losses are omitted from get_config/serialization
opening a new issue since https://github.com/keras-team/keras/issues/19820 is closed.
Based on this - https://keras.io/api/models/model_saving_apis/ I assume I should be able to save a partially trained model using model.save(), then load it using load_model(), and resume training. If my assumption is true, then there are more issues like https://github.com/keras-team/keras/issues/19820
For e.g., for a trained model with a (non-custom) Loss, model.get_config().get("losses") and model.get_config.get("loss") both return None. Whereas model.losses and model.loss work as expected. Consequently, those properties don't roundtrip via save() and load_model().
Is there any reason that you're not using ModelCheckpoint callback for saving and loading later to continue training?
I believe our Saving API is mainly designed for saving a finalized model and doesn't have to keep training information.
cc @nkovela1
I'm closing this issue for now but feel free to let us know if https://github.com/keras-team/keras/issues/19884#issuecomment-2197699458 is not clear or doesn't address your concern.