FENRlR / MB-iSTFT-VITS2

Application of MB-iSTFT-VITS components to vits2_pytorch
MIT License
107 stars 27 forks source link

ONNX format #3

Closed AigizK closed 11 months ago

AigizK commented 1 year ago

You could use this PR: https://github.com/p0p4k/vits2_pytorch/pull/43

w11wo commented 1 year ago

I've attempted to apply the same exporting script to MB-iSTFT-VITS2, but I'm running into some trouble during the export. I think it's related to complex numbers being only partially supported by torch.onnx, or something along those lines.

Here's the error log in case anyone's interested:

Traceback (most recent call last):
  File "/content/MB-iSTFT-VITS2/export_onnx.py", line 110, in <module>
    main()
  File "/content/MB-iSTFT-VITS2/export_onnx.py", line 91, in main
    torch.onnx.export(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 506, in export
    _export(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 1548, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 1117, in _model_to_graph
    graph = _optimize_graph(
  File "/usr/local/lib/python3.10/dist-packages/torch/onnx/utils.py", line 658, in _optimize_graph
    _C._jit_pass_erase_number_types(graph)
RuntimeError: Unknown number type: complex

To reproduce, I've prepared a Colab notebook here. It uses the models from here.

FENRlR commented 1 year ago

https://github.com/pytorch/pytorch/issues/81075 It looks like we need more time for this.

nshmyrev commented 11 months ago

It is actually easy to export, see the patch here:

https://github.com/alphacep/MB-iSTFT-VITS2/commit/29c91d478bc16e653cd5de7c9163e2ba45ed7c6c