【问题标题】:Save model wrapped in Keras保存包裹在 Keras 中的模型
【发布时间】:2020-05-20 14:09:50
【问题描述】:

对不起我的幼稚问题,但我正在尝试保存我的 keras 模型 (),其中我使用 TFBertModel() 函数作为隐藏层。为此,我使用了 tf.keras 包提供的 save() 函数。

但是我收到了这个错误:

---------------------------------------------------------------------------

NotImplementedError                       Traceback (most recent call last)

<ipython-input-13-3b315f7219da> in <module>()
----> 1 model.save('model_weights.h5')

8 frames

/tensorflow-2.1.0/python3.6/tensorflow_core/python/keras/engine/network.py in get_config(self)
    915   def get_config(self):
    916     if not self._is_graph_network:
--> 917       raise NotImplementedError
    918     return copy.deepcopy(get_network_config(self))
    919 

NotImplementedError: 

该错误可以从我的 colab 重现:https://colab.research.google.com/drive/18HYwffkXCylPqeA-8raL82vfwOjb-aLP

另一个问题是我应该如何调用这个模型进行预测?

感谢您的帮助!

【问题讨论】:

标签: python-3.x tensorflow2.0 huggingface-transformers


【解决方案1】:

【讨论】:

    猜你喜欢
    • 2018-06-25
    • 2020-11-15
    • 1970-01-01
    • 2018-05-02
    • 2022-07-25
    • 2019-01-26
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多