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.68k stars 1.25k forks source link

terminal_predict.py在线预测出错 #339

Open currenttime opened 4 years ago

currenttime commented 4 years ago

修改了crf_only = False,再调用terminal_predict.py出错,好像是模型结构匹配不上

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. INFO:tensorflow:Restoring parameters from /home/brx/Documents/Projects/公告提取/Gonggao/output/model.ckpt-6018 Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [769,4] rhs shape= [896,512] [[{{node save/Assign_205}}]] [[save/RestoreV2/_406]] (1) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [769,4] rhs shape= [896,512] [[{{node save/Assign_205}}]] 0 successful operations. 0 derived errors ignored.

qwer10 commented 4 years ago

我也是这个问题,您解决了没啊?

macanv commented 4 years ago

seq_length 或者是label 的个数传错了吧。

qwer10 commented 4 years ago

seq_length 或者是label 的个数传错了吧。

您好macanv,请问一下server的predict相对于terminal_predict的改进有哪些?

manliu1225 commented 4 years ago

同样的问题,也是匹配不上

chmaojian commented 3 years ago

可以参考#101