Skip to content

v0.1.0 — first release

Choose a tag to compare

@ParkNorth ParkNorth released this 22 May 02:06
· 11 commits to main since this 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.

  1. torch.stft returns complex tensors → replaced with Conv1d of precomputed sin/cos DFT bases (export/stft.py).
  2. model.segment = Fraction(39, 5) breaks dynamo / lowering → coerced to float (export/segment.py).
  3. random.randrange in the transformer pos-embedding → patched to deterministic shift=0 (export/pos_embed.py).
  4. aten::_native_multi_head_attention has 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 (requires pip install "demucs-onnx[export]").

Links

MIT licensed, matching the original facebookresearch/demucs.