Open hannes09 opened 3 years ago
I tried to create a .engine file form my mmsegemetation pytorch model with the following script:
import sys sys.path.insert(0,'/workspace/torch2trt') sys.path.insert(1,'/workspace/mmsegmentation') import torch from torch2trt import torch2trt from mmseg.apis import init_segmentor import os.path config_file = 'models/hrnet.py' checkpoint_file = 'models/hrnet.pth' # build the model from a config file and a checkpoint file model = init_segmentor(config_file, checkpoint_file, device='cuda:0') model = model.eval().cuda() x = torch.ones((1, 3, 960, 1280)).cuda() model_trt = torch2trt(model,inputs=x, fp16_mode=False, int8_mode=False, max_workspace_size=1 << 28, max_batch_size=1) engine_path = 'test.engine' with open(engine_path, "wb") as f: f.write(model_trt.engine.serialize())
I see the following error:
Use load_from_local loader Traceback (most recent call last): File "torch2trt.py", line 22, in <module> max_batch_size=1) File "/workspace/torch2trt/torch2trt/torch2trt.py", line 517, in torch2trt outputs = module(*inputs) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 577, in __call__ result = self.forward(*input, **kwargs) File "/opt/conda/lib/python3.6/site-packages/mmcv/runner/fp16_utils.py", line 84, in new_func return old_func(*args, **kwargs) TypeError: forward() missing 1 required positional argument: 'img_metas'
I'm facing the same problem. Have you solved this problem?
Same issue, did you find any solution ?
If any of you solved this issue then please reply and help us out.
1
I tried to create a .engine file form my mmsegemetation pytorch model with the following script:
I see the following error: