HTDemucs — MLX

Hybrid Transformer Demucs (Rouard et al. 2023, 4-stem music source separation: drums / bass / other / vocals) converted to MLX for Apple Silicon. Source: facebookresearch/demucs (htdemucs checkpoint).

Runs with the open schism-mlx package:

from schism_mlx.separate.htdemucs import HTDemucs

model = HTDemucs.from_pretrained("schism-audio/htdemucs-mlx")
stems = model.separate("song.wav")   # {"drums": (2, L), "bass": ..., ...}

Full tracks are processed in overlapping 7.8 s segments blended with a triangular window, mirroring the reference apply_model exactly (deterministic, equivalent to shifts=0, split=True, overlap=0.25). ~0.4 s for 15 s of stereo on an M5 Max (RTF 0.03).

Note: the demucs CLI defaults to --shifts 1 (a randomized time-equivariance trick worth ~0.2 dB SDR), so stock CLI output will differ slightly from these deterministic stems; compare against demucs --shifts 0.

Conversion & verification

  • Weights are the original float32 checkpoint (all 533 tensors), tensor-renamed with convs permuted to MLX's channels-last layout and torch's packed attention projections split. No quantization, no finetuning.
  • Verified against the live demucs reference implementation: max waveform sample difference 1.0e-6 on a single-segment forward, 1.5e-7 on segmented full tracks.
  • Semantic check: a drums-only recording from schism-audio/e-gmd lands 100.0% of output energy in the drums stem.
  • STFT/iSTFT (torch.stft-compatible, normalized) are reimplemented in numpy and verified against torch to 1e-5 in isolation. No torch needed at inference time.

Precision note: on M5-class GPUs, MLX silently runs float32 matmuls at TF32-class precision (ml-explore/mlx#3860). schism_mlx disables this on import; if you load these weights with your own MLX code, set MLX_ENABLE_TF32=0 to match the reference implementation.

License

MIT, inherited from facebookresearch/demucs. Model by Simon Rouard, Francisco Massa, and Alexandre Défossez (Meta AI); MLX conversion by schism-audio.

Downloads last month
29
Safetensors
Model size
42M params
Tensor type
F32
·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for schism-audio/htdemucs-mlx