Tim*_*mon 6 conv-neural-network lstm keras tensorflow google-colaboratory
我正在尝试为时间序列预测创建几个 LSTM 模型(例如 Vanilla、Stacked、Bidirectional)。创建模型后,我想使用tf.keras.models.save_model保存它
这适用于我上面描述的 LSTM 架构,但是在尝试保存ConvLSTM 模型时,我收到以下错误:ValueError: Object dictionary contains a non-trackable object: (None, None) (for key states)
我在 Colab 笔记本上使用带有后端 TensorFlow (2.X) 的 Keras。我创建了一个可以重现问题的笔记本。
任何帮助,将不胜感激!
编辑:模型应保存为 Tensorflow SavedModel 格式 (save_format='tf')
有两种方法可以保存模型。
model.save('model.h5')
您的方法,但缺少型号名称和扩展名。
使用 cd 转到 gdrive 目录。
% cd /content/gdrive
Run Code Online (Sandbox Code Playgroud)
使用文件名和扩展名保存。
# save model to drive
tf.keras.models.save_model(
model = model,
filepath = 'model2.h5',
overwrite=True,
include_optimizer=True,
save_format=None,
signatures=None
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
433 次 |
| 最近记录: |