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
Hello. I run the sample under the python2.7 but it doesn't run. I follow the readme and write the following test.
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