-
Notifications
You must be signed in to change notification settings - Fork 681
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
add_constant incompatible function arguments #313
Comments
Did you ever figure out a fix for this? |
I encountered the same problem! |
I first converted my model into .onnx format and then simplified it using this repo https://github.com/daquexian/onnx-simplifier and then to .trt using this repo. I did not find a way or help from this repo to resolve the issue. |
|
Hi, I recently upgraded from PyTorch 1.3 and TRT 6 to PyTorch 1.6 and TRT 7 and this problem has also come up (what versions are you guys using?). @yuzhiyiliu's fix worked for me, but I'm also seeing the same issue on line 159 of torch2trt.py:
I'm going to guess there are probably other areas of the code that are also broken. Is this a PyTorch version compatibility issue and can we see this fixed soon? |
Tell you secretly, the YOLO layer has no weight and does not to be converted. |
@Jaftem Could you solve the issue on line 159? I applied @yuzhiyiliu's solution for the weight but for the scalar, I could not find the way. |
Hi, I'm getting a similar error at this line:
I can't export to onnx because apparently adaptive pooling is not supported there.
|
To @ghazalehtrb and other guys, did you solve this issue? |
@herry123435 Unfortunately no! I still have this issue, I ended up changing the whole network for now. |
Omg, I still have this issue in swinv2_tiny_window8_256 model. |
Hi,
I am trying to convert my YOLO model trained on Pytorch into tensorRT compatible model. On following the steps I get the following error message. I saw other people getting the same error but in a different scenario. I hope somebody can put light on the reason for this error as the stack trace doesn't give much information. It would be great if anyone can provide a solution to this.
I tried this NVIDIA/TensorRT#213 to fix my problem but it doesn't work.
Warning: Encountered known unsupported method torch.arange
Warning: Encountered known unsupported method torch.Tensor.repeat
Traceback (most recent call last):
File "convert.py", line 12, in
model_trt = torch2trt(model, [data])
File "/usr/local/lib/python2.7/dist-packages/torch2trt/torch2trt.py", line 377, in torch2trt
outputs = module(*inputs)
File "/home/nvidia/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/nvidia/pipeline/src/as1819/perception/cone_detection_camera/lib/utils/models.py", line 254, in forward
x = module[0](x, img_size)
File "/home/nvidia/.local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/nvidia/pipeline/src/as1819/perception/cone_detection_camera/lib/utils/models.py", line 129, in forward
create_grids(self, img_size, nG)
File "/home/nvidia/pipeline/src/as1819/perception/cone_detection_camera/lib/utils/models.py", line 277, in create_grids
grid_x = torch.arange(nG).repeat((nG, 1)).view((1, 1, nG, nG)).float()
File "/usr/local/lib/python2.7/dist-packages/torch2trt/torch2trt.py", line 202, in wrapper
converter'converter'
File "/usr/local/lib/python2.7/dist-packages/torch2trt/converters/view.py", line 10, in convert_view
input_trt = trt_(ctx.network, input)
File "/usr/local/lib/python2.7/dist-packages/torch2trt/torch2trt.py", line 135, in trt_
t._trt = network.add_constant(shape, weight).get_output(0)
TypeError: add_constant(): incompatible function arguments. The following argument types are supported:
1. (self: tensorrt.tensorrt.INetworkDefinition, shape: tensorrt.tensorrt.Dims, weights: tensorrt.tensorrt.Weights) -> tensorrt.tensorrt.IConstantLayer
Invoked with: <tensorrt.tensorrt.INetworkDefinition object at 0x7ee1ad3b70>, (13, 13), array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]])
The text was updated successfully, but these errors were encountered: