Issue with TensorRT model export: ONNX model from PyTorch 1.14 showing PyTorch 2.0.0 in TensorRT logs

Hi,

I’m encountering an issue when exporting a YOLOv8 model to ONNX using PyTorch 1.14, but when I run the model through TensorRT, the logs indicate that it’s using PyTorch 2.0.0 as the producer version. Here are the details:

  1. Export Process:

    • I used PyTorch version 1.14 for exporting the model to ONNX:
      torch.onnx.export(model, dummy_input, "yolov8s.onnx", opset_version=11)
      
    • The ONNX export completed without errors, and the model file yolov8s.onnx was generated successfully.
  2. TensorRT Conversion:

    • When I use TensorRT’s trtexec to convert the ONNX model, I notice that the logs show that the model’s producer is listed as PyTorch 2.0.0:
      [12/06/2024-12:32:39] [I] [TRT] Producer name:    pytorch
      [12/06/2024-12:32:39] [I] [TRT] Producer version: 2.0.0
      
    • The export was done with PyTorch 1.14, not 2.0.0.
  3. Expected Behavior:

    • I expected the producer version to show 1.14, consistent with the PyTorch version used during export.
  4. What I’ve Tried:

    • I’ve double-checked my PyTorch version with torch.__version__ and confirmed it’s 1.14.
    • I’ve tried re-exporting the model and rebuilding the environment but still get the same result.
  5. Environment:

    • PyTorch version: 1.14
    • TensorRT version: 8.5.2
    • CUDA version: 11.4
      Has anyone encountered this issue before? Any suggestions on how to resolve this discrepancy?

Thanks!

Hi,

Could you share the exported file so we can check it?
Thanks.

Thanks for your reply, here’s the file onnx and the engine.

yolov8s_.zip (56.5 MB)

Hi,

This is what we get from your ONNX model:

$ head -5 yolov8s_opset\ 11.onnx.txt 
pytorch2.0.0:���
�
input
0.model.0.conv.weight
0.model.0.conv.bias/0/model.0/conv/Conv_output_0/0/model.0/conv/Conv"Conv*
...

The version is really written as 2.0.0.
Maybe you can check this issue with the PyTorch team.

Thanks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.