macanv / BERT-BiLSTM-CRF-NER

Tensorflow solution of NER task Using BiLSTM-CRF model with Google BERT Fine-tuning And private Server services
https://github.com/macanv/BERT-BiLSMT-CRF-NER
4.71k stars 1.26k forks source link

bert ner model直接用来predict会报错 #264

Closed yowrhihoil closed 4 years ago

yowrhihoil commented 5 years ago

2019-11-04 18:21:00.134535: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/ner_model.pb: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2019-11-04 18:21:00.135800: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open model/ner_model.pb: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2019-11-04 18:21:00.135856: W tensorflow/core/framework/op_kernel.cc:1502] OP_REQUIRES failed at save_restore_tensor.cc:175 : Data loss: Unable to open table file model/ner_model.pb: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?

macanv commented 5 years ago

老哥,你的预测代码贴一些。错误貌似是因为你加载模型出错了,这是pb文件的模型,参考一下service/graph.py里面的加载方式。