-
Notifications
You must be signed in to change notification settings - Fork 65
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
Cannot export MiVOLO model into onnx
format using torch.onnx.export
#14
Comments
torch.onnx.export
onnx
format using torch.onnx.export
Hello!
To address this issue, you need to make a modification to the Torch sources. Open the file if (operator_export_type is _C_onnx.OperatorExportTypes.ONNX) and (
not val_use_external_data_format
):
try:
- _C._check_onnx_proto(proto)
+ pass #_C._check_onnx_proto(proto)
except RuntimeError as e:
raise errors.CheckerError(e) from e
Now, save this model. It will work. And all of this is simply not worth it: the ONNX model performs poorly with batch processing, and TensorRT is currently not an option due to its lack of support for col2im. Good luck and thank you for your star. |
Thank you for your detailed reply. Through documentation and GitHub issues, I completed the first 3 steps and was ready to convert the model into and, yeah, as you said
this was really not easy. I've spent 3 days and still see no chance of reaching the finish line today. |
@MasterHM-ml @WildChlamydia Did you find the definitive way to convert the model to onnx? |
Hi @WildChlamydia |
thanks @WildChlamydia ,change to onnx success
|
Hi @WildChlamydia , what exactly do you mean by "ONNX model performs poorly with batch processing"? By "batch processing" Do you refer to the batch size (when it's more than 1?) or the BatchNorm layers? Thanks! |
I am adding a line here to convert
self.model
intoonnx
format. Here is my code snippetbut I am getting the following error:
I tried debugging the error, but couldn't understand it due to less familiarity with the conversion process. The actual line that is causing an error is
num_dimensional_axis = symbolic_helper._get_tensor_sizes(output_size)[0]
; I tried inspecting theoutput_size
variable and it is1072 defined in (%1072 : int[] = prim::ListConstruct(%958, %963), scope: mivolo.model.mivolo_model.MiVOLOModel::/torch.nn.modules.container.Sequential::network.0/timm.models.volo.Outlooker::network.0.0/timm.models.volo.OutlookAttention::attn)
MiVOLO - Latest Pull
Pytorch version - 2.0.1
onnx version - 1.14.1
OS - Ubuntu 22.04.3LTS
Any help/direction/discussion will be highly appreciated, thank you.
The text was updated successfully, but these errors were encountered: