You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was doing some thinking about the possibility of AnimeJaNaiConverterGUI being able to do PTH to ONNX conversion itself.
A problem is that pytorch is a huge dependency, and would be kind of weird to require it just for converting models.
However, the CPU-only version of pytorch is significantly smaller than the CUDA version, and should be able to to the onnx conversion just fine.
As a test, I ran the conversion in chaiNNer with it set to CPU mode. A conversion in fp32 mode happened at essentially the same speed as it would on the gpu. However, chainner would not allow an fp16 conversion while in cpu mode. I'm not sure if this is a limitation of chaiNNer, or a limitation of pytorch.
Pytorch2 also has a new onnx exporter, so even if the old one doesnt allow for an fp16 conversion, I wonder if this new one might? https://pytorch.org/docs/stable/onnx.html
The text was updated successfully, but these errors were encountered:
Good idea, this is worth exploring. If we can convert pth to fp32 ONNX on the fly with PyTorch CPU, and vs-mlrt can further convert fp32 to fp16 on the fly, that would be ideal - end users wouldn't need to be concerned about fp32 or fp16 for ONNX, and pth support would make support for OpenModelDB models much simpler.
For DirectML and NCNN vs-mlrt is already doing this on the fly fp16 conversion for us. It seems vs-mlrt should be able to do the same for TensorRT, and I believe mpv_lazy already configures vs-mlrt to do it. I tried borrowing some of their engine generation code but ran into errors, though I didn't spend too much time on it yet.
A couple more quick thoughts on this.
I believe spandrel can allow for easily loading Pytorch models and getting various parameters from them. https://github.com/chaiNNer-org/spandrel
I was doing some thinking about the possibility of AnimeJaNaiConverterGUI being able to do PTH to ONNX conversion itself.
A problem is that pytorch is a huge dependency, and would be kind of weird to require it just for converting models.
However, the CPU-only version of pytorch is significantly smaller than the CUDA version, and should be able to to the onnx conversion just fine.
As a test, I ran the conversion in chaiNNer with it set to CPU mode. A conversion in fp32 mode happened at essentially the same speed as it would on the gpu. However, chainner would not allow an fp16 conversion while in cpu mode. I'm not sure if this is a limitation of chaiNNer, or a limitation of pytorch.
Pytorch2 also has a new onnx exporter, so even if the old one doesnt allow for an fp16 conversion, I wonder if this new one might?
https://pytorch.org/docs/stable/onnx.html
The text was updated successfully, but these errors were encountered: