PaddlePaddle / X2Paddle

Deep learning model converter for PaddlePaddle. (『飞桨』深度学习模型转换工具)

Home Page:http://www.paddlepaddle.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

superpoint_v1 的onnx模型报错

xman1991 opened this issue · comments

感谢您参与 X2Paddle 社区! 问题模版为了 X2Paddle 能更好的迭代,例如新功能发布、 RoadMaps 和错误跟踪. 😸

问题描述

  • 错误信息
  • x2paddle --framework=onnx --model=superpoint_v1_sim_int32.onnx --save_dir=superpoint_v1_sim_int32
    /home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/pkg_resources/init.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
    /home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits').
    Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)
    /home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google').
    Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)
    /home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/pkg_resources/init.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('zope').
    Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)
    INFO:root:paddle.version = 0.0.0
    INFO:root:[WARNING] You are use develop version of paddlepaddle
    INFO:root:Now translating model from onnx to paddle.
    model ir_version: 8, op version: 12
    Shape inferencing ...
    /home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/x2paddle/decoder/onnx_shape_inference.py:510: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead
    new_v = int(np.asscalar(v))
    Shape inferenced.
    Now, onnx2paddle support convert onnx model opset_verison [7, 8, 9, 10, 11, 12, 13, 14, 15], opset_verison of your onnx model is 12.
    Total nodes: 87
    Nodes converting ...
    Converting node 125 ...
    Nodes converted.
    INFO:root:Model optimizing ...
    INFO:root:Model optimized.
    Exporting inference model from python code ('/home/kylin/paddle/2230/superpoint_v1_sim_int32/x2paddle_code.py')...

W0508 10:45:36.800081 5514 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.2, Runtime API Version: 10.2
W0508 10:45:36.803066 5514 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
Fail to generate inference model! Problem happend while export inference model from python code '/home/kylin/paddle/2230/superpoint_v1_sim_int32/x2paddle_code.py';

===================Error Information===============
Traceback (most recent call last):
File "/home/kylin/.conda/envs/paddle_py37/bin/x2paddle", line 33, in
sys.exit(load_entry_point('x2paddle==1.2.3', 'console_scripts', 'x2paddle')())
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/x2paddle/convert.py", line 497, in main
enable_onnx_checker=args.enable_onnx_checker)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/x2paddle/convert.py", line 311, in onnx2paddle
mapper.paddle_graph.gen_model(save_dir)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/x2paddle/core/program.py", line 303, in gen_model
raise e
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/x2paddle/core/program.py", line 297, in gen_model
self.dygraph2static(save_dir, input_shapes, input_types)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/x2paddle/core/program.py", line 583, in dygraph2static
osp.join(save_dir, "inference_model/model"))
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl
return wrapped_func(*args, **kwargs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/jit.py", line 649, in wrapper
func(layer, path, input_spec, **configs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl
return wrapped_func(*args, **kwargs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 67, in impl
return func(*args, **kwargs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/jit.py", line 928, in save
inner_input_spec, with_hook=with_hook)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 580, in concrete_program_specify_input_spec
is_train=self._is_train_mode())
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 485, in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[cache_key]
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 955, in getitem
self._caches[item_id] = self._build_once(item)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 944, in build_once
**cache_key.kwargs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl
return wrapped_func(*args, **kwargs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/base.py", line 67, in impl
return func(*args, **kwargs)
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 895, in from_func_spec
error_data.raise_new_exception()
File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 350, in raise_new_exception
six.exec
("raise new_exception from None")
File "", line 1, in
TypeError: In transformed code:

File "superpoint_v1_sim_int32/x2paddle_code.py", line 99, in forward
    x2paddle_79 = paddle.reshape(x=x2paddle_57, shape=[1])
    x2paddle_68 = paddle.reshape(x=x2paddle_60, shape=[1])
    x2paddle_76 = paddle.multiply(x=x2paddle_60, y=x2paddle_75)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    x2paddle_69 = paddle.reshape(x=x2paddle_63, shape=[1])
    x2paddle_78 = paddle.multiply(x=x2paddle_63, y=x2paddle_77)

File "/home/kylin/.conda/envs/paddle_py37/lib/python3.7/site-packages/paddle/tensor/math.py", line 882, in multiply
% (x.dtype, y.dtype))

TypeError: Input tensors must be same type, but received type of x: paddle.int64, type of y: paddle.int32 
  • 错误截图

具体信息

  • 转换模型后用处

    • 使用 Paddle 框架/ PaddleInference 推理预测
  • 模型来源
    YOLOX:https://github.com/Megvii-BaseDetection/YOLOX

  • 应用场景

  • 版本信息
    PaddlePaddle => :2.4
    X2Paddle => 1.4.1
    来源框架版本(PyTorch/TF/ONNX/Caffe) => :onnx

  • 您的联系方式(邮箱/微信/电话)
    338.cool@163.com