Pytorch has moved to onnx IR version from 1.0.0, but tensorrt still support ONNX IR 0.0.3, so many onnx files exported from PYTORCH cannot be parsed.
By the way, anyone know which pytorch version can export ONNX IR 0.0.3 ?
By the way, anyone know which pytorch vresion can export ONNX IR 0.0.3 ?
Same question
By the way, anyone know which pytorch version can export ONNX IR 0.0.3 ?
1.0.0
TensorRT 7 supports onnx==1.6.0 which I believe is IR version 0.0.6 (https://github.com/onnx/onnx/blob/master/docs/Versioning.md), so I would think it supports up to IR 0.0.6.
I have parsed several models successfully that had IR versions >= 0.0.3
$ trtexec --onnx=detection_model.onnx --explicitBatch
...
Input filename: detection_model.onnx
ONNX IR version: 0.0.6
Opset version: 7
Producer name: tf2onnx
Producer version: 1.5.3
...
&&&& PASSED TensorRT.trtexec # trtexec --onnx=detection_model.onnx --explicitBatch
$ trtexec --onnx=conv1d.onnx --explicitBatch
...
Input filename: conv1d.onnx
ONNX IR version: 0.0.4
Opset version: 9
Producer name: pytorch
Producer version: 1.3
...
&&&& PASSED TensorRT.trtexec # trtexec --onnx=conv1d.onnx --explicitBatch
$ trtexec --onnx=lstm.onnx --explicitBatch --workspace=1024
...
Input filename: lstm.onnx
ONNX IR version: 0.0.4
Opset version: 11
Producer name: pytorch
Producer version: 1.3
...
&&&& PASSED TensorRT.trtexec # trtexec --onnx=lstm.onnx --explicitBatch --workspace=1024
I must claim that better way of conversion to TensorRT is using its API through torch2trt project
For anyone coming across this now, I think I discovered a pretty solid solution that doesn't require installing any "older versions" of packages or using any new tools.
Works for me on:
python==3.6
torch==1.4.0
My ONNX model needs to be runnable in TesnorRT 4.0.1 (devices in the field with old software and no upgrade path, thanks Nvidia!) as well as up-to-date versions >= 6.01 on developer machines.
The only thing I had to do was add opset_version=8to my torch.onnx.export call (default is 9, link). The model works now on the various versions of TensorRT that I need.
For anyone coming across this now, I think I discovered a pretty solid solution that doesn't require installing any "older versions" of packages or using any new tools.
Works for me on:
python==3.6 torch==1.4.0My ONNX model needs to be runnable in TesnorRT 4.0.1 (devices in the field with old software and no upgrade path, thanks Nvidia!) as well as up-to-date versions >= 6.01 on developer machines.
The only thing I had to do was add
opset_version=8to mytorch.onnx.exportcall (default is 9, link). The model works now on the various versions of TensorRT that I need.
optset_version=8 dose not support upsample operation.....newest version of TensorRT seems fix all common model converting issue, but the sad thing is newer TensorRT cant run engines generated by older version!
TensorRT upgrade would be very painful and not practical if there are dozens of engines runing in the production enviroments
Most helpful comment
For anyone coming across this now, I think I discovered a pretty solid solution that doesn't require installing any "older versions" of packages or using any new tools.
Works for me on:
My ONNX model needs to be runnable in TesnorRT 4.0.1 (devices in the field with old software and no upgrade path, thanks Nvidia!) as well as up-to-date versions >= 6.01 on developer machines.
The only thing I had to do was add
opset_version=8to mytorch.onnx.exportcall (default is 9, link). The model works now on the various versions of TensorRT that I need.