【发布时间】: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
另一个问题是我应该如何调用这个模型进行预测?
感谢您的帮助!
【问题讨论】:
-
你解决了这个问题吗?
-
嗨!是的,最新版本的拥抱脸转换器包括一个保存模型功能。 github.com/huggingface/transformers/issues/2733
标签: python-3.x tensorflow2.0 huggingface-transformers