1、问题描述
使用load_inference_model 加载两个不同的模型进行推理会crash,分别进行推理运行正常。错误log观察好像加载两个模型会混淆
版本:paddlepaddle 2.1.1
CPU:Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
说明:
两个模型都是用x2paddle 转到paddle的。
错误日志:
[Detect] input: (1, 3, 320, 320)
Traceback (most recent call last):
File "handx_main.py", line 93, in <module>
main()
File "handx_main.py", line 83, in main
pred_uvd = h_3d.predict(image, [x1, y1, x2, y2])
File "/mnt/disk_2t/shaoxiong/handpp_work/3dpose_work/slimhand3d_work/x2paddle_work/v1_8_hand3d/handx_hand3d/hand3d.py", line 38, in predict
output = self.exe.run(self.inference_program,
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1110, in run
six.reraise(*sys.exc_info())
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/six.py", line 703, in reraise
raise value
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1098, in run
return self._run_impl(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1231, in _run_impl
return self._run_program(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1328, in _run_program
self._default_executor.run(program.desc, scope, 0, True, True,
ValueError: In user code:
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/bin/x2paddle", line 33, in <module>
sys.exit(load_entry_point('x2paddle==1.2.3', 'console_scripts', 'x2paddle')())
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/convert.py", line 259, in main
onnx2paddle(args.model, args.save_dir)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/convert.py", line 165, in onnx2paddle
mapper.paddle_graph.gen_model(save_dir)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/core/program.py", line 274, in gen_model
self.dygraph2static(save_dir, input_shapes, input_types)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/core/program.py", line 553, in dygraph2static
paddle.jit.save(static_model,
File "<decorator-gen-67>", line 2, in save
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args,**kwargs)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 40, in __impl__
return func(*args,**kwargs)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/jit.py", line 718, in save
concrete_program = static_func.concrete_program_specify_input_spec(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 487, in concrete_program_specify_input_spec
concrete_program, _ = self.get_concrete_program(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/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/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 711, in __getitem__
self._caches[item] = self._build_once(item)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 698, in _build_once
concrete_program = ConcreteProgram.from_func_spec(
File "<decorator-gen-65>", line 2, in from_func_spec
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
return wrapped_func(*args,**kwargs)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 40, in __impl__
return func(*args,**kwargs)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 652, in from_func_spec
outputs = static_func(*inputs)
File "v1_8_ckp_hand3d_443.pd/x2paddle_code.py", line 165, in forward
x2paddle_340 = self.batchnorm0(x2paddle_339)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 902, in __call__
outputs = self.forward(*inputs,**kwargs)
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/nn.py", line 1388, in forward
self._helper.append_op(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/layer_object_helper.py", line 47, in append_op
return self.main_program.current_block().append_op(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2899, in append_op
op = Operator(
File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/framework.py", line 1977, in __init__
for frame in traceback.extract_stack():
InvalidArgumentError: ShapeError: the shape of scale must equal to [16]But received: the shape of scale is [48]
[Hint: Expected scale_dim[0] == C, but received scale_dim[0]:48 != C:16.] (at /paddle/paddle/fluid/operators/batch_norm_op.cc:118)
[operator < batch_norm > error]
4条答案
按热度按时间3qpi33ja1#
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档 、 常见问题 、 历史Issue 、 AI社区 来寻求解答。祝您生活愉快~
Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API , FAQ , Github Issue and AI community to get the answer.Have a nice day!
eeq64g8w2#
方便提供一下load部分,和run部分的代码吗
dfuffjeb3#
weylhg0b4#
同问题,官方有没有解决啊?