v0.1.0 — first release
First release of demucs-onnx: working ONNX export + inference for HT-Demucs FT.
Install
pip install demucs-onnx
demucs-onnx separate song.mp3 stems/Models auto-download from Hugging Face on first run.
The 4 export blockers this package solves
Vanilla torch.onnx.export fails on htdemucs_ft for four reasons. This package fixes all of them and parity-checks the result vs PyTorch fp32 (< 1e-3 max abs diff) before writing the .onnx file.
torch.stftreturns complex tensors → replaced withConv1dof precomputed sin/cos DFT bases (export/stft.py).model.segment = Fraction(39, 5)breaks dynamo / lowering → coerced tofloat(export/segment.py).random.randrangein the transformer pos-embedding → patched to deterministicshift=0(export/pos_embed.py).aten::_native_multi_head_attentionhas no ONNX symbolic → manual scaled-dot-product attention (export/mha.py).
What you get
- Inference:
from demucs_onnx import separate, separate_stem— pure numpy + onnxruntime, no PyTorch needed. CPU / CoreML / CUDA / DirectML EPs. - CLI:
demucs-onnx separate ...,demucs-onnx export ...,demucs-onnx list-models. - Export:
from demucs_onnx.export import export_to_onnx(requirespip install "demucs-onnx[export]").
Links
- PyPI: https://pypi.org/project/demucs-onnx/
- Pre-exported ONNX models on Hugging Face:
- https://huggingface.co/StemSplitio/htdemucs-ft-onnx (full 4-stem bag)
- https://huggingface.co/StemSplitio/htdemucs-ft-drums-onnx
- https://huggingface.co/StemSplitio/htdemucs-ft-bass-onnx
- https://huggingface.co/StemSplitio/htdemucs-ft-other-onnx
- https://huggingface.co/StemSplitio/htdemucs-ft-vocals-onnx
MIT licensed, matching the original facebookresearch/demucs.