keras icon indicating copy to clipboard operation
keras copied to clipboard

loss/losses are omitted from get_config/serialization

Open sikchi opened this issue 1 year ago • 1 comments
trafficstars

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().

sikchi avatar Jun 19 '24 19:06 sikchi

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

SamanehSaadat avatar Jun 28 '24 21:06 SamanehSaadat

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.

SamanehSaadat avatar Jul 19 '24 18:07 SamanehSaadat

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Jul 19 '24 18:07 google-ml-butler[bot]