NVIDIA-AI-IOT / torch2trt

An easy to use PyTorch to TensorRT converter
MIT License
4.59k stars 675 forks source link

Process finished with exit code -1073741819 (0xC0000005) #731

Open pridexin opened 2 years ago

pridexin commented 2 years ago

After the environment configuration is complete, I try to run the Usage and get the following error:

CODE: import torch from torch2trt import torch2trt from torchvision.models.alexnet import alexnet

model = alexnet(pretrained=True).eval().cuda()

create example data

x = torch.ones((1, 3, 224, 224)).cuda()

convert to TensorRT feeding sample data as input

model_trt = torch2trt(model, [x])

CONSULE: Process finished with exit code -1073741819 (0xC0000005)

What is the reason for this?

sunshinesjw1 commented 2 years ago

Hello, I also have the same question. I solve it through replacing "shape = tuple(self.context.get_binding_shape(idx))" to "shape= tuple(binding_shape[i] for i in range(len(binding_shape)))" in torch2trt.py in forward function. The reason is tuple transform not success. Maybe is connected by version.

jseobyun commented 9 months ago

In my case, the solution was updating pytorch version corresponding to CUDA used in TensorRT installation.

After the installation with CUDA 12.1, I forgot to change pytorch correctly. torch2.0.1+cu11.8 caused same issue in my CUDA 12.1 environment.

I hope it will be of help!