eba*_*aik 5 python tensorflow tensorflow-estimator
我在以下TF Hub上按照BERT预测电影评论的步骤进行了操作:https : //colab.research.google.com/github/google-research/bert/blob/master/predicting_movie_reviews_with_bert_on_tf_hub.ipynb#scrollTo=PPVEXhNjYXC-。
最后,如何导出模型以供以后用作分类器?
我找到了一个链接(https://guillaumegenthial.github.io/serving-tensorflow-estimator.html),该链接表明我可以将估算器导出为tf.saved_model。但是,我在创建“ serving_input_receiver_fn()”时遇到了麻烦。
小智 0
使用pickle保存模型
import pickle
# save the model to disk
filename = 'finalized_model.sav'
pickle.dump(model, open(filename, 'wb'))
#Load the model
loaded_model = pickle.load(open(filename, 'rb'))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
255 次 |
最近记录: |