NVIDIA / TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
https://developer.nvidia.com/tensorrt
Apache License 2.0
10.81k stars 2.13k forks source link

tensort7 load onnx resize ops error #386

Closed syshensyshen closed 3 years ago

syshensyshen commented 4 years ago

Description

when i load onnx model, fpn F.interpolate ops error


While parsing node number 209 [Resize]: ERROR: builtin_op_importers.cpp:2412 In function importResize: [8] Assertion failed: scales.is_weights() && "Resize scales must be an initializer!"


this error in onnx-tensorrt

Environment

TensorRT Version: 7.0 GPU Type: 1060 Nvidia Driver Version: 441.22 CUDA Version: 10.2 CUDNN Version: 7.6.5.32 Operating System + Version: win10

livneros commented 2 years ago

Hi @anhtu812 ,

Thanks for sharing. I repro'd your error with the opset11 model above with TRT7.

However, I was able to parse your model using TRT7 + OSS components:

# Start TensorRT 7 container
nvidia-docker run -it -v $PWD:/mnt nvcr.io/nvidia/tensorrt:20.02-py3

# Build OSS Components from https://github.com/NVIDIA/TensorRT
wget https://raw.githubusercontent.com/rmccorm4/tensorrt-utils/master/OSS/build_OSS.sh
source build_OSS.sh

# Parse model
trtexec --explicitBatch --onnx=/mnt/386-resize/tf_model_opset11.onnx
...
&&&& PASSED TensorRT.trtexec # trtexec --explicitBatch --onnx=/mnt/386-resize/tf_model_opset11.onnx

So the issue was likely fixed in upstream onnx parser. Hope this helps.

Every nvcr.io/nvidia/tensorrt:X.Y-py3 image, contains the file /opt/tensorrt/install_opensource.sh - as mentioned here under "Installing Open Source Components". There's no need to

wget https://raw.githubusercontent.com/rmccorm4/tensorrt-utils/master/OSS/build_OSS.sh
source build_OSS.sh

Furthermore, build_OSS.sh clones the most updated version of TensorRT and it won't suit your image name.

spacewalk01 commented 1 year ago

Had the exact same error: [8] Assertion failed: scales.is_weights() && "Resize scales must be an initializer!" It occurred when used with scaling factor in resize operation. Solved the problem using ONNX Simplifier