models/fluid/chinese_ner/infer.py 用测程序不能正确运行
Created by: wanbiguizhao
报错模块:models/fluid/chinese_ner/infer.py 代码变更:train.py程序训练使用的是显卡,修改为使用CPU训练。 程序运行环境:docker paddle 执行步骤: 执行python train.py 后 output产生模型文件。 报错步骤:执行python inferr.py 文件报错。 报错信息:
File "infer.py", line 64, in <module>
target_file="data/label_dict")
File "infer.py", line 39, in infer
return_numpy=False)
File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/executor.py", line 463, in run
fetch_var_name=fetch_var_name)
File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/executor.py", line 310, in _add_feed_fetch_ops
if not has_feed_operators(global_block, feed, feed_var_name):
File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/executor.py", line 129, in has_feed_operators
"Feed operators in program desc do not match 'feed_targets'")
Exception: Feed operators in program desc do not match 'feed_targets'
报错位置:
crf_decode = exe.run(inference_program,
feed=feeder.feed(data),
fetch_list=fetch_targets,
return_numpy=False)