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

x2paddle转换onnx模型到paddle模型报错 #1081

Open
leashi opened this issue Oct 22, 2024 · 0 comments
Open

x2paddle转换onnx模型到paddle模型报错 #1081

leashi opened this issue Oct 22, 2024 · 0 comments

Comments

@leashi
Copy link

leashi commented Oct 22, 2024

我先用命令:
paddle2onnx --model_dir ./ --model_filename model.pdmodel --params_filename model.pdiparams --save_file ./model.onnx --enable_onnx_checker True
转换paddle模型:https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip 到onnx,转换成功。
然后用命令:
x2paddle --framework=onnx --model=model.onnx --save_dir=pd_model
转换onnx模型到paddle模型,转换失败。

paddle2onnx的输出:
paddle2onnx --model_dir ./
--model_filename model.pdmodel
--params_filename model.pdiparams
--save_file ./model.onnx
--enable_onnx_checker True
[Paddle2ONNX] Start to parse PaddlePaddle model...
[Paddle2ONNX] Model file path: ./model.pdmodel
[Paddle2ONNX] Parameters file path: ./model.pdiparams
[Paddle2ONNX] Start to parsing Paddle model...
[Paddle2ONNX] [reduce_mean: mean_0.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [reduce_mean: mean_1.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [reduce_mean: mean_2.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [reduce_mean: mean_3.tmp_0] Requires the minimal opset version of 11.
[Paddle2ONNX] [multiclass_nms3: multiclass_nms3_0.tmp_1] Requires the minimal opset version of 10.
[Paddle2ONNX] Due to the operator: reduce_mean, requires opset_version >= 11.
[Paddle2ONNX] Opset version will change to 11 from 9
[Paddle2ONNX] Use opset_version = 11 for ONNX export.
[Paddle2ONNX] PaddlePaddle model is exported as ONNX format now.

x2paddle的输出:
x2paddle --framework=onnx --model=model.onnx --save_dir=pd_model
model ir_version: 6, op version: 11
Shape inferencing ...
[WARNING] Incomplete symbolic shape inference
Shape inferenced.
Traceback (most recent call last):
File "/opt/anaconda3/envs/paddle/bin/x2paddle", line 8, in
sys.exit(main())
File "/opt/anaconda3/envs/paddle/lib/python3.10/site-packages/x2paddle/convert.py", line 501, in main
onnx2paddle(args.model,
File "/opt/anaconda3/envs/paddle/lib/python3.10/site-packages/x2paddle/convert.py", line 315, in onnx2paddle
model = ONNXDecoder(model_path, enable_onnx_checker, input_shape_dict)
File "/opt/anaconda3/envs/paddle/lib/python3.10/site-packages/x2paddle/decoder/onnx_decoder.py", line 415, in init
self.graph = ONNXGraph(onnx_model, input_shape_dict)
File "/opt/anaconda3/envs/paddle/lib/python3.10/site-packages/x2paddle/decoder/onnx_decoder.py", line 201, in init
self.collect_value_infos()
File "/opt/anaconda3/envs/paddle/lib/python3.10/site-packages/x2paddle/decoder/onnx_decoder.py", line 374, in collect_value_infos
TENSOR_TYPE_TO_NP_TYPE[item.type.tensor_type.elem_type],
File "/opt/anaconda3/envs/paddle/lib/python3.10/site-packages/onnx/mapping.py", line 132, in getitem
return super().getitem(key)
KeyError: 0

python包版本信息:
Package Version


anyio 4.6.2.post1
astor 0.8.1
certifi 2024.8.30
charset-normalizer 3.4.0
decorator 5.1.1
exceptiongroup 1.2.2
h11 0.14.0
httpcore 1.0.6
httpx 0.27.2
idna 3.10
mpmath 1.3.0
numpy 2.1.2
onnx 1.17.0
opt-einsum 3.3.0
packaging 24.1
paddle2onnx 1.2.11
paddlepaddle 2.6.2
pillow 11.0.0
pip 24.2
protobuf 5.28.2
requests 2.32.3
setuptools 75.2.0
six 1.16.0
sniffio 1.3.1
sympy 1.13.3
typing_extensions 4.12.2
urllib3 2.2.3
wheel 0.44.0
x2paddle 1.5.0

系统版本:
os ubuntu 22.04 Linux version 6.8.0-47-generic

email: [email protected]

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

1 participant