NVIDIA / NVIDIA/TensorRT

fp16 engine works fine with trtexec but encountering nan with python API

Open
#3,662 7 comments 0 reactions 1 assignee View on GitHub

@zerollzeng is already working on this.

Since Feb 13, 2024.

triaged
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Description

I try to create a tensorrt engine from an onnx model

trtexec --onnx=model.onnx --saveEngine=engine.trt --fp16

When i use trtexec for inference it works fine

trtexec --loadEngine=engine.trt  --fp16  --exportOutput=f
p16e.json

I can see that the output is just fine
fp16e.json.

But when I try to run this engine file with python API the output is nan.

Environment

TensorRT Version: 8.6

NVIDIA GPU: RTX 3070

NVIDIA Driver Version: 535.154.05

CUDA Version: 12.2

CUDNN Version: 8.9

Operating System:

Python Version (if applicable): 3.10

Tensorflow Version (if applicable):

PyTorch Version (if applicable):

Baremetal or Container (if so, version):

Relevant Files

Model link:

Steps To Reproduce

Commands or scripts:

Here is the python script I am using tensorrt_test_fps.py.txt

Have you tried the latest release?: yes

Can this model run on other frameworks? For example run ONNX model with ONNXRuntime (polygraphy run <model.onnx> --onnxrt):
Yes it runs fine when using CUDAExecutionProvider with ONNXRuntime but with TensorrtExecutionProvider I get the same issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.