You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use torch_tensorrt to convert a multi-head classification model. I find a similar issue here https://github.com/pytorch/TensorRT/issues/899, but can't find a clear solution or workaround. Any suggestions or conclusions?
Traceback (most recent call last):
File "pt2torch_tensorrt.py", line 45, in <module>
trt_model_fp32 = torch_tensorrt.compile(model, inputs=[torch_tensorrt.Input((2, 3, 512, 512), dtype=torch.float32)],enabled_precisions = torch.float32)
File "/opt/conda/lib/python3.8/site-packages/torch_tensorrt/_compile.py", line 115, in compile
return torch_tensorrt.ts.compile(ts_mod, inputs=inputs, enabled_precisions=enabled_precisions, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/torch_tensorrt/ts/_compiler.py", line 116, in compile
compiled_cpp_mod = _C.compile_graph(module._c, _parse_compile_spec(spec))
RuntimeError: [Error thrown at core/conversion/conversion.cpp:220] List type. Only a single tensor or a TensorList type is supported
To Reproduce
Code snippets are as followed
def forward(self, x):
x = self.features(x)
x = self.avgpool(x)
x = torch.flatten(x, 1)
x = [classifier(x) for classifier in self.classifiers]
return x
Expected behavior
Environment
Build information about Torch-TensorRT can be found by turning on debug messages
I try return the first element of list output and gets a trt model successfully.
def forward(self, x):
x = self.features(x)
x = self.avgpool(x)
x = torch.flatten(x, 1)
x = [classifier(x) for classifier in self.classifiers]
return x[0]
I can't verify this exact use case myself because the full module was not shared but this should be solved in the upcoming release, you can try now on master (#1201), reopen if there are still issues.
RuntimeError: [Error thrown at external/torch-tensorrt/core/conversion/conversion.cpp:254] Tuple type. Only a single tensor or a TensorList type is supported.
Bug Description
I use torch_tensorrt to convert a multi-head classification model. I find a similar issue here https://github.com/pytorch/TensorRT/issues/899, but can't find a clear solution or workaround. Any suggestions or conclusions?
To Reproduce
Code snippets are as followed
Expected behavior
Environment
use prebuild container, v22.03
Additional context
I try return the first element of list output and gets a trt model successfully.
The text was updated successfully, but these errors were encountered: