How to convert to ONNX?
Ming-FitLab opened this issue · 2 comments
Sorry to bother, I wanted to convert your model to ONNX version, however the onnx.export function intrigued several errors. I thought the reason might be your model was not inherited from nn.Module
and the usage of numpy ndarray
in your model. I tried to fix it by inheriting nn.Module
and convert the ndarray
to tensor
where the errors were occurred. Finally I fixed all the errors but then dozens of warnings occurred. What's worse, the final .onnx
file couldn't work at all.
So I am wondering whether you can help me to convert the model to ONNX version.
Hi!
My class SimpleHRNet
is a (big) wrapper around the PyTorch model HRNet
(my re-implemented version is in models/hrnet.py
) with several handy features.
From the errors you received, I think you may have tried to convert the class SimpleHRNet instead of converting the class HRNet (which is the class that inherits from nn.Module
).
I think you should convert the HRNet model with the onnx exporter first, then change the model definition and loading in SimpleHRNet to load the onnx version instead of the pytorch one.
Let me know if you can complete the conversion!
In that case, I'd be glad to include the onnx-based code to the repository 🙂
you have done the convertion?