问题描述
对不起,我的幼稚问题,但我正在尝试保存我的 keras 模型 (),其中我使用 TFBertModel() 函数作为隐藏层.为此,我使用了 tf.keras 包提供的 save() 函数.
Sorry for my naive question but I am trying to save my keras model () in which I use TFBertModel() function as an hidden layer. To do that I use the save() function provided by the tf.keras package.
但是我收到了这个错误:
But I got this error:
---------------------------------------------------------------------------
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
The error can be reproduce from my colab : https://colab.research.google.com/drive/18HYwffkXCylPqeA-8raL82vfwOjb-aLP
另一个问题是我应该如何调用这个模型进行预测?
And another question is how should I call this model for prediction ?
感谢您的帮助!
推荐答案
没有看到代码无法真正回答你,但你应该看看这里:
Can't really answer you without seeing the code, but you should probably look here:
这篇关于保存用 Keras 包裹的模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!