Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.pt to tensorRT(.engine) conversion #860

Open
MeghanaTatavolu25 opened this issue May 8, 2023 · 1 comment
Open

.pt to tensorRT(.engine) conversion #860

MeghanaTatavolu25 opened this issue May 8, 2023 · 1 comment

Comments

@MeghanaTatavolu25
Copy link

I have my own pretrained pytorch model that I want to convert to a TensorRT model (.engine), I run this python script:

import torch
from torch2trt import torch2trt
model = torch.load(‘/home/tto/himangy_mt_server/OpenNMT-py/models/1.pt’, map_location=torch.device(‘cpu’))
x = torch.ones((1, 3, 224, 224)).to(torch.device(‘cpu’))
m = torch2trt(model, )

got this error
Traceback (most recent call last):
File “/home/tto/himangy_mt_server/OpenNMT-py/convert.py”, line 11, in
m = torch2trt(model, )
File “/home/tto/himangy_mt_server/himangy-env/lib/python3.9/site-packages/torch2trt-0.4.0-py3.9.egg/torch2trt/torch2trt.py”, line 694, in torch2trt
outputs = module(*inputs)
TypeError: ‘dict’ object is not callable

when i print the keys of the model i am getting 5 keys
dict[‘model’,‘generator’,‘vocab’,‘opt’,‘optim’]

i tired of taking the model key in the dictionary like this
“”““model = model_dict[‘model’]””“”"

import torch
from torch2trt import torch2trt
model = torch.load(‘/home/tto/himangy_mt_server/OpenNMT-py/models/1.pt’, map_location=torch.device(‘cpu’))
model = model_dict[‘model’]
x = torch.ones((1, 3, 224, 224)).to(torch.device(‘cpu’))
m = torch2trt(model, )

still getting same error, what causes this error??

@eegmnn
Copy link

eegmnn commented Apr 24, 2024

Have you found a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants