I am trying to create several LSTM models for time series prediction (e.g. Vanilla, Stacked, Bidirectional). After creating a model I want to save it using tf.keras.models.save_model
This works fine for the LSTM architectures I describe above, but when trying to save a ConvLSTM model I get the following error: ValueError: Object dictionary contained a non-trackable object: (None, None) (for key states)
I am using Keras with backend TensorFlow (2.X) on a Colab notebook. I've created a notebook where the problem can be reproduced.
Any help would be appreciated!
Edit: the model should be saved in the Tensorflow SavedModel format (save_format='tf')
There are two ways you can save your model.
model.save('model.h5')
Your method but you're missing model name and extension.
Go to gdrive directory using cd.
% cd /content/gdrive
Save with the file name and extension.
# save model to drive
tf.keras.models.save_model(
model = model,
filepath = 'model2.h5',
overwrite=True,
include_optimizer=True,
save_format=None,
signatures=None
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With