onnx / onnx-tensorrt

ONNX-TensorRT: TensorRT backend for ONNX
Apache License 2.0
2.95k stars 545 forks source link

resnest50 onnx #637

Open alicera opened 3 years ago

alicera commented 3 years ago

Description

I convert the resnest50 model to onnx https://cv.gluon.ai/model_zoo/classification.html?from=groupmessage https://github.com/apache/incubator-mxnet/issues/19808

COMMAND: onnx2trt tp.onnx -o tmp.trt

Input filename: tp.onnx ONNX IR version: 0.0.7 Opset version: 12 Producer name:
Producer version: Domain:
Model version: 0 Doc string:

WARNING: ONNX model has a newer ir_version (0.0.7) than this parser was built against (0.0.6). Parsing model [2021-02-01 08:38:02 WARNING] /opt/mxnet/3rdparty/onnx-tensorrt/onnx2trt_utils.cpp:218: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [2021-02-01 08:38:02 ERROR] INVALID_ARGUMENT: getPluginCreator could not find plugin ScatterND version 1 While parsing node number 28 [ScatterND -> "resnest_layers1_splitattentionconv0_swapaxes0_perm_new"]: ERROR: /opt/mxnet/3rdparty/onnx-tensorrt/builtin_op_importers.cpp:3718 In function importFallbackPluginImporter: [8] Assertion failed: creator && "Plugin not found, are the plugin name, version, and namespace correct?"

Environment

TensorRT Version: 7.2.2 GPU Type: GTX1080 Nvidia Driver Version: 455.38 CUDA Version: ### 11.1 NGC Version: nvcr.io/nvidia/mxnet:20.12-py3

alicera commented 3 years ago

I try to simplifer it with onnxsim


Input filename: del.onnx ONNX IR version: 0.0.7 Opset version: 12 Producer name:
Producer version: Domain:
Model version: 0 Doc string:

WARNING: ONNX model has a newer ir_version (0.0.7) than this parser was built against (0.0.6). Parsing model [2021-02-01 09:14:15 WARNING] /tmp/onnx-tensorrt/onnx2trt_utils.cpp:218: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. [2021-02-01 09:14:15 ERROR] (Unnamed Layer 19) [Shuffle]: second transpose is not valid. While parsing node number 22 [Div -> "resnest_layers1_splitattentionconv0_softmax0_data"]: ERROR: /tmp/onnx-tensorrt/onnx2trt_utils.cpp:679 In function elementwiseHelper: [8] Assertion failed: tensor_ptr->getDimensions().nbDims == maxNbDims && "Failed to broadcast tensors elementwise!"

kevinch-nv commented 3 years ago

Can you provide your ONNX model?

alicera commented 3 years ago

The steps will get the onnx model I based on NGC "nvcr.io/nvidia/mxnet:20.12-py3" to do

docker pull nvcr.io/nvidia/mxnet:20.12-py3 git clone --recursive https://github.com/apache/incubator-mxnet mxnet cd mxnet git checkout v1.x cp -r ./python/mxnet/contrib/onnx/mx2onnx/ /opt/mxnet/python/mxnet/contrib/onnx/ pip install onnx==1.7.0

then I run the project to deal with onnx. https://chai-bapat.medium.com/5min-gluon-model-to-onnx-e8ed0eea754e

But I try to use onnx2trt. resnest14 and resnest26 fail. resnest50 worked fine.

Command: onnx2trt resnest26.onnx -o 26.trt Error: [2021-02-02 03:37:30 ERROR] INVALID_ARGUMENT: getPluginCreator could not find plugin ScatterND version 1 While parsing node number 28 [ScatterND -> "resnest_layers1_splitattentionconv0_swapaxes0_perm_new"]: ERROR: /opt/mxnet/3rdparty/onnx-tensorrt/builtin_op_importers.cpp:3718 In function importFallbackPluginImporter: [8] Assertion failed: creator && "Plugin not found, are the plugin name, version, and namespace correct?"

kevinch-nv commented 2 years ago

ScatterND has been supported since TensorRT 8.2, can you try and use the latest version of TRT and run your model again?