首页 PaddleOCR 帖子详情
训练模型转inference模型时报错
收藏
快速回复
PaddleOCR 问答识别 625 1
训练模型转inference模型时报错
收藏
快速回复
PaddleOCR 问答识别 625 1

环境配置完成:cuda11.2,cudnn8.1,训练也跑起来了。

在做infer时,按inference.md文档中运行如下语句:

python3 tools/export_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o Global.pretrained_model=./ch_lite/ch_ppocr_mobile_v2.0_det_train/best_accuracy Global.save_inference_dir=./inference/det_db/

报错如下:
W0728 15:41:11.315989 123 device_context.cc:404] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.2, Runtime API Version: 1$
.2
W0728 15:41:12.576156 123 device_context.cc:422] device: 0, cuDNN Version: 8.1.
[2021/07/28 15:41:18] root INFO: load pretrained model from ['./ch_lite/ch_ppocr_mobile_v2.0_det_train/best_accuracy']
Traceback (most recent call last):
File "tools/export_model.py", line 95, in
main()
File "tools/export_model.py", line 90, in main
paddle.jit.save(model, save_path)
File "", line 2, in save
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/base.py", line 40, in __impl__
return func(*args, **kwargs)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/jit.py", line 719, in save
inner_input_spec)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 488,
in concrete_program_specify_input_spec
*desired_input_spec)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 402,
in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[cache_key]
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 711,
in __getitem__
self._caches[item] = self._build_once(item)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 702,
in _build_once

class_instance=cache_key.class_instance)
File "", line 2, in from_func_spec
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args, **kwargs)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/base.py", line 40, in __impl__
return func(*args, **kwargs)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 620,
in from_func_spec
static_func = convert_to_static(dygraph_function)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 141,
in convert_to_static
static_func = _FUNCTION_CACHE.convert_with_cache(function)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 78, i
n convert_with_cache
static_func = self._convert(func)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 122,
in _convert
create_and_update_origin_info_map(root_wrapper.node, static_func)
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/origin_info.py", line 163, in crea
te_and_update_origin_info_map
for t_node, s_node in ast_walk(transformed_node, static_node):
File "/home/shenchenfei/anaconda3/envs/paddle_env/lib/python3.6/site-packages/paddle/fluid/dygraph/dygraph_to_static/origin_info.py", line 241, in ast_
walk
t_node_child = getattr(t_node, field)
AttributeError: 'Assign' object has no attribute 'type_comment'

0
收藏
回复
全部评论(1)
时间顺序
划飞桨的Daniel
#2 回复于2021-07

https://github.com/PaddlePaddle/PaddleOCR/issues/3457

github上新建了一个issue,可以在下面re一下,可以看一下进一步回复

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户