Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Exporting the operator grid_sampler to ONNX opset version 11 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub. #1

Open
sahamitul opened this issue Aug 15, 2022 · 4 comments

Comments

@sahamitul
Copy link

sahamitul commented Aug 15, 2022

Hi,

When running python torch2onnx.py <config_file> --load_from <pth_file>
I get this crash:-

RuntimeError: Exporting the operator grid_sampler to ONNX opset version 11 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.

@xuanandsix, How did you resolve this at your end? Thanks!

@xuanandsix
Copy link
Owner

In this code, import grid_sample op ( in clr_head.py line 21 and 126) to replace F.grid_sample (in clr_head.py line 123)
Specifically,please refer to the part of conver and test onnx,
3、cp clr_head.py (in this code) to your_path/CLRNet/clrnet/models/heads/
4、mkdir your_path/CLRNet/modules/ and cp grid_sample.py (in this code) to your_path/CLRNet/modules/

@sahamitul
Copy link
Author

Thanks @xuanandsix!

So, after this change I get this crash:-
#3

Do I need to retrain model with this new clr_head.py?

@xuanandsix
Copy link
Owner

No, this code is to help deploy the trained model from official code.

@CrazyMustard-404
Copy link

Hi,"Have you solved the problem? After training using the original clr_head.py, I found that the size of the weights is different from the official weights. However, the trained weights can be used for inference normally, but when converting to onnx, I encountered the same error as you did. However, when I retrained using the new clr_head.py, I encountered the following error: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! Do you have any good suggestions? Thank you!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants