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

Can not run under python 2.7 environement #19

Closed
dummyedu opened this issue Jul 19, 2019 · 1 comment
Closed

Can not run under python 2.7 environement #19

dummyedu opened this issue Jul 19, 2019 · 1 comment

Comments

@dummyedu
Copy link

dummyedu commented Jul 19, 2019

Hello. I run the sample under the python2.7 but it doesn't run.
I follow the readme and write the following test.

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

# create some regular pytorch model...
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])



y = model(x)
y_trt = model_trt(x)

# check the output against PyTorch
print(torch.max(torch.abs(y - y_trt)))

After I run it. I get the following error:
Traceback (most recent call last):
File "test1.py", line 12, in
model_trt = torch2trt(model, [x])
File "/media/nvidia/Data/ningl/build/torch2trt/torch2trt/torch2trt.py", line 244, in torch2trt
builder.create_network() as network, ConversionContext(network) as ctx:
File "/media/nvidia/Data/ningl/build/torch2trt/torch2trt/torch2trt.py", line 138, in init
for method, converter in converters.items()
File "/media/nvidia/Data/ningl/build/torch2trt/torch2trt/torch2trt.py", line 116, in init
self.method_impl = copy(eval(method))
File "/usr/lib/python2.7/copy.py", line 96, in copy
return _reconstruct(x, rv, 0)
File "/usr/lib/python2.7/copy.py", line 329, in _reconstruct
y = callable(*args)
File "/usr/lib/python2.7/copy_reg.py", line 93, in newobj
return cls.new(cls, *args)
TypeError: instancemethod expected at least 2 arguments, got 0

@melezz
Copy link

melezz commented Jul 24, 2019

Take a look here, I had the same trouble

#18

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