Rikorose / DeepFilterNet

Noise supression using deep filtering
https://huggingface.co/spaces/hshr/DeepFilterNet2
Other
2.17k stars 203 forks source link

Export model through ONNX #456

Closed ooshyun closed 4 months ago

ooshyun commented 8 months ago

Thanks for great work! However, I want to ask about supporting onnx export. When I try to export using script/export.py and python DeepFilterNet/df/scripts/export.py -m DeepFilterNet3 --output-dir ./out --simplify export_dir, it raises the error RuntimeError: Unsupported value kind: Tensor at torch.jit.script in export/export_impl. I am trying to figure out why, but if anyone resolves this, please advise me!

Thanks for reading!

avramandrei commented 7 months ago

@ooshyun I am encountering the same issue as you do. Have you managed to fix it?

ooshyun commented 7 months ago

Hi, I changed torch.jit.script to torch.jit.trace in export_impl function(df/script/sexport.py) as below,

# df/script/sexport.py
# model = torch.jit.script(model, example_inputs=[tuple(a for a in inputs)]) # error part
model = torch.jit.trace(model, tuple(a for a in inputs))

It can resolve the issue, but I'm not sure it is correct way to get a result!

avramandrei commented 7 months ago

Hi, I changed torch.jit.script to torch.jit.trace in export_impl function(df/script/sexport.py) as below,

# df/script/sexport.py
# model = torch.jit.script(model, example_inputs=[tuple(a for a in inputs)]) # error part
model = torch.jit.trace(model, tuple(a for a in inputs))

It can resolve the issue, but I'm not sure it is correct way to get a result!

@ooshyun That worked. Thanks for the reply! Hopefully, someone can tell us if that update is correct or not.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.