czg1225 / SlimSAM

SlimSAM: 0.1% Data Makes Segment Anything Slim
Apache License 2.0
248 stars 14 forks source link

Questions about Conversion of torch model to tensorRT model #17

Open huangshilong911 opened 1 month ago

huangshilong911 commented 1 month ago

Hi,The following error occurs when performing the conversion of a torch model to a tensorRT model:TypeError: forward() missing 1 required positional argument: 'multimask_output'. But I trained the model exactly according to the readme. Could you please help me out with this?

(sam0) jetson@ubuntu:~/Workspace/aicam/ircamera$ python3 convert-sam-trtpth.py Traceback (most recent call last): File "convert-sam-trtpth.py", line 14, in model_trt = torch2trt(model, [x], fp16_mode=True) File "/home/jetson/miniconda3/envs/sam0/lib/python3.8/site-packages/torch2trt-0.5.0-py3.8.egg/torch2trt/torch2trt.py", line 558, in torch2trt outputs = module(inputs) File "/home/jetson/miniconda3/envs/sam0/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1111, in _call_impl return forward_call(input, *kwargs) File "/home/jetson/miniconda3/envs/sam0/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(args, **kwargs) TypeError: forward() missing 1 required positional argument: 'multimask_output'

huangshilong911 commented 1 month ago

I describe the problem in more detail at this link:

https://github.com/NVIDIA-AI-IOT/torch2trt/issues/926#issue-2290789749