Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行run_classifier_predict_online.py出错 #25

Open
Vincent131499 opened this issue Oct 28, 2019 · 1 comment
Open

运行run_classifier_predict_online.py出错 #25

Vincent131499 opened this issue Oct 28, 2019 · 1 comment

Comments

@Vincent131499
Copy link

我依次根据readme执行了python train_bert_lm.py和python train_bert_fine_tuning.py,而后运行run_classifier_predict_online.py出错(此时我将开源的chinese-bert-base中的bert_config.json和vocab.txt复制到了微调后保存的模型目录下)。
望大佬悉知,并耐心回复下解决方案,已经尝试了多种方式验证,都报同一个错。
报错信息如下:
INFO:tensorflow:Restoring parameters from ./checkpoint_finetuing_law200_bert/model.ckpt-1
2019-10-28 19:41:26.392664: W tensorflow/core/framework/op_kernel.cc:1502] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key bert/embeddings/LayerNorm/beta not found in checkpoint
Traceback (most recent call last):
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found.
(0) Not found: Key bert/embeddings/LayerNorm/beta not found in checkpoint
[[{{node save/RestoreV2}}]]
[[save/RestoreV2/_383]]
(1) Not found: Key bert/embeddings/LayerNorm/beta not found in checkpoint
[[{{node save/RestoreV2}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\training\saver.py", line 1286, in restore
{self.saver_def.filename_tensor_name: save_path})
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
run_metadata_ptr)
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
run_metadata)
File "E:\ProgramFiles\Anaconda3\envs\tf14_gpu\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: 2 root error(s) found.
(0) Not found: Key bert/embeddings/LayerNorm/beta not found in checkpoint
[[node save/RestoreV2 (defined at /stephen的个人文件夹/my_code/预训练语言模型(包括词向量)/代码/bert_language_understanding-master/run_classifier_predict_online.py:352) ]]
[[save/RestoreV2/_383]]
(1) Not found: Key bert/embeddings/LayerNorm/beta not found in checkpoint
[[node save/RestoreV2 (defined at /stephen的个人文件夹/my_code/预训练语言模型(包括词向量)/代码/bert_language_understanding-master/run_classifier_predict_online.py:352) ]]
0 successful operations.
0 derived errors ignored.

@brightmart
Copy link
Owner

可能这个不能用预训练的模型的。
你可以尝试新的模型https://github.com/brightmart/albert_zh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants