Model Checkpoint

327 views
Skip to first unread message

ryan.w....@gmail.com

unread,
Jul 28, 2016, 11:41:43 AM7/28/16
to Keras-users
I am using the master branch of keras version 1.0.6 and just recently I noticed that when using

model_checkpoint = ModelCheckpoint('test.hdf5', monitor='loss', save_best_only=True,save_weights_only=False)

and using model_checkpoint as a callback, it is not writing the layers in output file ever.

My hdf5 file only contains -- [u'keras_version', u'model_config', u'training_config']

This use to work until I updated in the last few days.

Any thoughts?

ryan.w....@gmail.com

unread,
Jul 28, 2016, 11:47:51 AM7/28/16
to Keras-users, ryan.w....@gmail.com
The reason I ask is because I try to load the model later to restart from I get 

KeyError: "Can't open attribute (Can't locate attribute: 'layer_names')"

Jack Hessel

unread,
Jul 28, 2016, 12:03:43 PM7/28/16
to Keras-users, ryan.w....@gmail.com
If I recall correctly, I think that this happens when you save a model from one version of Keras and try to load it in another. I guess the model serialization changed?

François Chollet

unread,
Jul 28, 2016, 12:23:41 PM7/28/16
to Jack Hessel, ryan.w....@gmail.com, Keras-users

To revert to the old behavior, use save_weights_only=True when creating the callback.

Otherwise, you can load your new save files with keras.models.load_model(fpath).


--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/ffcac371-5fb5-4e50-ab5b-fb3b2d5059e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ryan.w....@gmail.com

unread,
Jul 28, 2016, 12:27:32 PM7/28/16
to Keras-users, jmhe...@gmail.com, ryan.w....@gmail.com
Thanks for the quick reply this works.
Reply all
Reply to author
Forward
0 new messages