xi11xi19 / CenterNet2TorchScript

centernet pytorch model to torch script model
BSD 3-Clause "New" or "Revised" License
30 stars 7 forks source link

Abnormal debug message when covert model to pt file. #1

Open foreversky0611 opened 5 years ago

foreversky0611 commented 5 years ago

Hi, xi11xi19: I used your sample code and tried to convert dla34 model to pt file, but it will output below abnormal message: D:\ML\C\CenterNet2TorchScript-master\DCNv2\dcn_v2.py:93: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! self.deformable_groups) Could you help to support this problem? Thanks a lot.

xi11xi19 commented 4 years ago

ignore it ,it is just a warning.... as the abnormal message say, this value will be treated as a constant in the future.the parameter is the deform_conv's kernelsize.It's constance value. Now I fix it,use self.kernel_size[0], self.kernel_size[1] replace self.weight.shape[2], self.weight.shape[3] self.weight.shape[2] is a Tensor,but self.kernel_size[0] is const value

yzpfyang commented 4 years ago

hi xi11xi19, i use your code and had convert .pth to .pt then i want to test the .pt file, use : module = torch::jit::load() to load this model, i met this error:

terminate called after throwing an instance of 'torch::jit::script::ErrorReport' what():
Unknown builtin op: my_ops::dcn_v2_cuda_forward_v2. Could not find any similar ops to my_ops::dcn_v2_cuda_forward_v2. This op may not exist or may not be currently supported in TorchScript.

can i get some help, thanks

zhangyingbit commented 4 years ago

@yzpfyang https://tutorials.pytorch.kr/advanced/torch_script_custom_ops.html maybe this can help you: ) you can search the key word "torch::jit::script::ErrorReport" in above website, there is a solution ~