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.54k stars 2.1k forks source link

two inputs (data and weights) are allowed only in explicit-quantization mode. #1675

Closed lsdNorman closed 2 years ago

lsdNorman commented 2 years ago

root@90e0df0b7943:/home/TensorRT/parsers/onnx/build# ./onnx2trt /home/my.onnx -o my.trt Input filename: /home/my.onnx ONNX IR version: 0.0.6 Opset version: 12 Producer name: pytorch Producer version: 1.8 Domain: Model version: 0 Doc string: Parsing model [2021-12-20 08:58:04 WARNING] onnx2trt_utils.cpp:367: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [2021-12-20 08:58:04 ERROR] Conv_90: two inputs (data and weights) are allowed only in explicit-quantization mode. While parsing node number 90 [Conv -> "883"]: ERROR: ModelImporter.cpp:177 In function parseGraph: [6] Invalid Node - Conv_90 Conv_90: two inputs (data and weights) are allowed only in explicit-quantization mode.

ttyio commented 2 years ago

Hello @lsdNorman , Is your model generated from QAT toolkit? https://github.com/NVIDIA/TensorRT/tree/main/tools/pytorch-quantization

If yes, could you try latest 8.2 release, using trtexec to inference your onnx like this:

  trtexec --onnx=/home/my.onnx --int8 --saveEngine=my.trt

If not, trt currently only support conv weights as initializer, we do not support conv weights from activation.

Thanks!

lsdNorman commented 2 years ago

@ttyio Hello, can I use precision fp32? Thanks!

ttyio commented 2 years ago

@lsdNorman , for QAT onnx, it is quantized, you have to enable --int8.

DeriZSY commented 2 years ago

Hello @lsdNorman , Is your model generated from QAT toolkit? https://github.com/NVIDIA/TensorRT/tree/main/tools/pytorch-quantization

If yes, could you try latest 8.2 release, using trtexec to inference your onnx like this:

  trtexec --onnx=/home/my.onnx --int8 --saveEngine=my.trt

If not, trt currently only support conv weights as initializer, we do not support conv weights from activation.

Thanks!

Hi, I met the same problem with trt 8.2.1.8. I was trying to apply 2D convolution with a temporal tensor instead of initialized weights. Do you mean that such operation cannot be supported anyway? Or can I solved the problem by upgrade to some version newer than 8.2.1.8?

Here is my script (it's an onnx model with dynamic shape):

trtexec \
--onnx=$onnx_model_path \
--workspace=1024 \
--profilingVerbosity=detailed \
--saveEngine=$save_engine_path \
--verbose=true \
--minShapes=auds_ds:1x5x16x5304,head_rot=:1x3x3,head_trans:1x3x1,batch_inv_PMat:1x3x3,eye_feature:1x16 \
--optShapes=auds_ds:2x5x16x5304,head_rot=:2x3x3,head_trans:2x3x1,batch_inv_PMat:2x3x3,eye_feature:2x16 \
--maxShapes=auds_ds:4x8x16x5304,head_rot=:4x3x3,head_trans:4x3x1,batch_inv_PMat:4x3x3,eye_feature:4x16 \
--fp16 \
--explicitBatch
ttyio commented 2 years ago

a temporal tensor instead of initialized weights. Do you mean that such operation cannot be supported anyway? Or can I solved the problem by upgrade t

Sorry we do not support conv weights from activation. could you modify your ONNX model to use initialized weights? thanks

jcyhcs commented 2 years ago

@lsdNorman
hi,professor: do you have any solution to reolve this problem? i also have a siamese tracking network, i want to convert onnx to tensorrt, i come with the same error,

joonjeon commented 1 year ago

Hi!

Same issue here and the problem seems to persist even on TensorRT 8.4.1.

ttyio commented 1 year ago

@joonjeon , could you try 8.5? thanks

LightSun commented 1 month ago

same to me