pytorch / TensorRT

PyTorch/TorchScript/FX compiler for NVIDIA GPUs using TensorRT
https://pytorch.org/TensorRT
BSD 3-Clause "New" or "Revised" License
2.6k stars 350 forks source link

🐛 [Bug] Could not implicitly convert NumPy data type: i64 to TensorRT #3295

Open dudeperf3ct opened 1 day ago

dudeperf3ct commented 1 day ago

Bug Description

TensorRT engine produces error when ran on Jetson for fcn_resnet model. However, it does not produce error when ran on desktop.

Dynamo frontend is used for creating a TensorRT engine.

Error : [TRT] [E] Could not implicitly convert NumPy data type: i64 to TensorRT.

To Reproduce

Steps to reproduce the behavior:

The following are relevant code for loading and converting to a TensorRT model.

input_data = torch.randn(args.input_shape, device=DEVICE)
model = torch.hub.load("pytorch/vision", 'fcn_resnet50', pretrained=True)
model.eval().to(DEVICE)

input_data = input_data.to(torch.float16)
model = model.to(torch.float16)

exp_program = torch.export.export(model, tuple([input_data]))
model = torch_tensorrt.dynamo.compile(
    exported_program=exp_program,
    inputs=[input_data],
    min_block_size=args.min_block_size,
    optimization_level=args.optimization_level,
    enabled_precisions={dtype},
    # Set to True for verbose output
    # NOTE: Performance Regression when rich library is available
    # https://github.com/pytorch/TensorRT/issues/3215
    debug=True,
    # Setting it to True returns PythonTorchTensorRTModule which has different profiling approach
    use_python_runtime=True,
)

for _ in range(100):
    _ = model(input)

Expected behavior

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

Jetson Orion Developer Kit

Additional context

Here's a screenshot for relevant comparison

Desktop: Screenshot from 2024-11-15 12-45-05

Jetson: Screenshot from 2024-11-15 12-45-29

narendasan commented 1 day ago

What version of TensorRT are you using on jetson vs x86?

dudeperf3ct commented 18 hours ago

What version of TensorRT are you using on jetson vs x86?

On jetson I am using 24.06 PyTorch igpu image that comes with TensorRT 10.1.0.27

On dekstop, the TensorRT version 10.1.0 is used.