Keras Model.save() Raise Notimplementederror
Solution 1:
I had a similar problem with the current tf version (1.11). I used the tf.keras API to define my model and trained it without problems. When I wanted to save my model using tensorflow.keras.models.save_model
or model.save()
(which just calls save_model) I got the following exception:
NotImplementedError: __deepcopy__() is only available when eager execution is enabled.
So I called tf.enable_eager_execution()
, but because of the usage of a Lambda Layer in my architecture, I ended up with another NotImplementedError of "compute_output_shape".. If your architecture does not contain a Lambda Layer the enabling of eager_execution could fix your problem in tf 1.11.
My final "way to go" was to use model.save_weights('model_weights.h5')
because I did not need to save the model architecture just the trained weights.
Btw.: in my case it was also possible to switch from tensorflow.keras.* imports to keras.* and use just "plain" keras with tf backend (model.save()
works here - of course).
Solution 2:
Consider using tf.keras.models.save_model() and load_model(), it may work.
Solution 3:
model.save('model.h5py')
may solve the problem. The key is to save as h5py file.
Post a Comment for "Keras Model.save() Raise Notimplementederror"