[英]Save model wrapped in Keras
Sorry for my naive question but I am trying to save my keras model () in which I use TFBertModel() function as an hidden layer.抱歉我的幼稚问题,但我正在尝试保存我的 keras 模型 (),其中我使用 TFBertModel() 函数作为隐藏层。 To do that I use the save() function provided by the tf.keras package.为此,我使用了 tf.keras 包提供的 save() 函数。
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:
The error can be reproduce from my colab : https://colab.research.google.com/drive/18HYwffkXCylPqeA-8raL82vfwOjb-aLP该错误可以从我的 colab 中重现: https ://colab.research.google.com/drive/18HYwffkXCylPqeA-8raL82vfwOjb-aLP
And another question is how should I call this model for prediction ?另一个问题是我应该如何调用这个模型进行预测?
Thx for your help!谢谢你的帮助!
Can't really answer you without seeing the code, but you should probably look here:没有看到代码就无法真正回答你,但你应该看看这里:
https://towardsdatascience.com/text-classification-with-hugging-face-transformers-in-tensorflow-2-without-tears-ee50e4f3e7ed https://towardsdatascience.com/text-classification-with-hugging-face-transformers-in-tensorflow-2-without-tears-ee50e4f3e7ed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.