ONNX模型校验出现问题

用户您好,请详细描述您所遇到的问题:

  1. 在docker容器中转换自己的深度学习模型时,出现检验不通过的情况

  2. 以openexplorer/ai_toolchain_ubuntu_20_xj3_gpu TAG:v2.6.6-py38 镜像所启动的容器

  3. 备注:在自己的服务器上使用onnxruntime可以对onnx模型进行正常推理。

  4. 提供必要的问题日志:

  5. 2024-10-23 00:18:47,646 INFO The quantized model output:

  6. ============

  7. Output

  8. ------------

  9. 2024-10-23 00:18:47,686 INFO End to Horizon NN Model Convert.

  10. 2024-10-23 00:18:47,688 INFO ONNX model output num : 2

  11. 2024-10-23 00:18:47,744 ERROR The node name is Pad_722 and the node type is Pad. Constraints exist

  12. 2024-10-23 00:18:47,744 ERROR error info: Pad currently only support 4-D and 5-D tensoractually given 3

  13. 2024-10-23 00:18:47,744 ERROR The node name is Pad_1069 and the node type is Pad. Constraints exist

  14. 2024-10-23 00:18:47,744 ERROR error info: Pad currently only support 4-D and 5-D tensoractually given 3

  15. 2024-10-23 00:18:47,744 ERROR The node name is Pad_1416 and the node type is Pad. Constraints exist

  16. 2024-10-23 00:18:47,744 ERROR error info: Pad currently only support 4-D and 5-D tensoractually given 3

  17. 2024-10-23 00:18:47,744 ERROR The node name is Pad_1960 and the node type is Pad. Constraints exist

  18. 2024-10-23 00:18:47,745 ERROR error info: Pad currently only support 4-D and 5-D tensoractually given 2

  19. 2024-10-23 00:18:47,747 ERROR *** ERROR-OCCUR-DURING {runtime.runtime_model_generation} ***, error message: The CPU operator constraint is abnormal

### 更新

目前通过对代码中pad输入张量的修改,在pad处理前全部升维到4D的张量,先已经解决ONNX模型校验的问题,能够校验成功,并且能够在docker容器中导出

quantized_model.onnx以及.bin文件,且在docker上验证了quantized_model.onnx可以正常推理。但是在上板测试时,使用.bin文件推理出现如下问题:

[BPU_PLAT]BPU Platform Version(1.3.3)!

[HBRT] set log level as 0. version = 3.15.25.0

[DNN] Runtime version = 1.18.6_(3.15.25 HBRT)

[A][DNN][packed_model.cpp:234][Model](2024-10-23,10:50:41.455.401) [HorizonRT] The model builder version = 1.24.1

[E][DNN][pad.cpp:159][Layer](2024-10-23,10:50:41.855.100) Pad operator only support dimension 2/3 padding

[E][DNN][hbm_exec_plan.cpp:858][Plan](2024-10-23,10:50:41.855.198) Pad forward failed.

[E][DNN][multi_model_task.cpp:1406][Task](2024-10-23,10:50:41.855.224) RiContinue failed

hbDNNWaitTaskDone failed

arg_height=1 arg_width=228, arg_channels=304

Traceback (most recent call last):

File “/home/sunrise/DANet/infer.py”, line 54, in

_ , outputs = models[0].forward(datain)

TypeError: cannot unpack non-iterable NoneType object

该问题疑似和上面的解决方案有所冲突,使用.bin文件推理时,输出错误提示:需要确保输入符合 2D 或 3D 张量的要求。

其他补充信息:导出onnx模型时所用的opset_version=11,pytorch版本为:1.10.0+cu111。

1 个赞