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
When fallback is encountered, the torchscript may contain . in the name of parameters, e.g., x.1 and input.1. Such torchscript models, after saved to disk, cannot be loaded successfully because paramter names containing . is invalid.
Traceback (most recent call last):
File "main.py", line 56, in<module>main()
File "main.py", line 39, in main
model = torch.jit.load('resnet_withfallback.trt.ts')
File "/opt/conda/lib/python3.8/site-packages/torch/jit/_serialization.py", line 162, in load
cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files)
RuntimeError: expected ) but found 'number' here:
Serialized File "code/__torch__/torchvision/models/resnet.py", line 7
__torch___torchvision_models_resnet_ResNet_trt_engine_0x5595a2dc5070 : __torch__.torch.classes.tensorrt.Engine
def forward(self_1: __torch__.torchvision.models.resnet.ResNet_trt,
x.1: Tensor) -> Tensor:
~~ <--- HERE
__torch___torchvision_models_resnet_ResNet_trt_engine_0x5595a2dc4ed0 = self_1.__torch___torchvision_models_resnet_ResNet_trt_engine_0x5595a2dc4ed0
_0 = ops.tensorrt.execute_engine([x.1], __torch___torchvision_models_resnet_ResNet_trt_engine_0x5595a2dc4ed0)
Bug Description
When fallback is encountered, the torchscript may contain
.
in the name of parameters, e.g.,x.1
andinput.1
. Such torchscript models, after saved to disk, cannot be loaded successfully because paramter names containing.
is invalid.To Reproduce
Run the following python file:
Expected behavior
The compilation should end without failure.
Environment
conda
,pip
,libtorch
, source): pipThe text was updated successfully, but these errors were encountered: