Open Mona77 opened 11 months ago
I have been able to successfully convert the DETR model into torchscript. But when I'm trying to convert my trained segmentation model
DETRsegm
I got the following error:File "/opt/conda/envs/torch_apps/lib/python3.8/site-packages/torch/jit/_recursive.py", line 393, in create_methods_and_properties_from_stubs concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults) RuntimeError: forward(__torch__.models.transformer.___torch_mangle_644.Transformer self, Tensor src, Tensor mask, Tensor query_embed, Tensor pos_embed) -> ((Tensor, Tensor)): Expected a value of type 'Tensor (inferred)' for argument 'mask' but instead found type 'Optional[Tensor]'. Inferred 'mask' to be of type 'Tensor' because it was not annotated with an explicit type. : File "/home/mona/platform/markerless-tracking/SemiSupervised_Seg/detr/models/segmentation.py", line 69 src_proj = self.detr.input_proj(src) hs, memory = self.detr.transformer( ~~~~~~~~~~~~~~~~~~~~~ <--- HERE src_proj, mask, self.detr.query_embed.weight, pos[-1] )
hi you said you export detr into torchscript successfully, i'd like to know your export code. do you use the detectron2's official export_model.py(https://github.com/facebookresearch/detectron2/blob/main/tools/deploy/export_model.py) to export the model?
I have been able to successfully convert the DETR model into torchscript. But when I'm trying to convert my trained segmentation model
DETRsegm
I got the following error: