Drum isolation specialist from HT-Demucs FT, ~1/4 the size of the full ensemble.
This is sub-model 0 of the 4-bag
htdemucs_ft ensemble by
Défossez et al. (Meta AI), extracted as a standalone
~160 MB model. It produces the
drums stem with the same quality as
the full ensemble (median SDR
10.11 dB on MUSDB18-HQ — 2nd (close behind mdx_extra_q at 11.49) of all
models in our 2026 benchmark) at roughly 1/4 the compute cost.
1import base64, io, soundfile as sf
2from huggingface_hub import InferenceClient
3
4with open("your-song.mp3", "rb") as f:
5 audio_b64 = base64.b64encode(f.read()).decode()
6
7client = InferenceClient(model="StemSplitio/htdemucs-ft-drums-pytorch")
8result = client.post(json={"inputs": audio_b64})
9
10wav, sr = sf.read(io.BytesIO(base64.b64decode(result["drums"])))
11sf.write("out_drums.wav", wav, sr)
1import torch, soundfile as sf
2from demucs.apply import apply_model
3from demucs.audio import convert_audio
4from demucs.pretrained import get_model
5
6bag = get_model("htdemucs_ft")
7model = bag.models[0].eval() # the drums specialist
8wav, sr = sf.read("your-song.mp3", dtype="float32", always_2d=True)
9wav = torch.from_numpy(wav.T).contiguous()
10wav = convert_audio(wav, sr, bag.samplerate, bag.audio_channels).unsqueeze(0)
11
12with torch.no_grad():
13 stems = apply_model(model, wav, device="mps" if torch.backends.mps.is_available() else "cpu")[0]
14
15# bag.sources == ["drums", "bass", "other", "vocals"]; pick the drums row
16sf.write("out_drums.wav", stems[bag.sources.index("drums")].T.numpy(), bag.samplerate)
Click
Deploy → Inference Endpoints above, pick a GPU instance, and HF
will spin up a container running
handler.py.
(Roughly 2.6× faster than the full-bag latency, since we run only this
specialist sub-model. Cloud GPU numbers extrapolated from M4 Pro measurements.)
1curl -X POST https://<your-endpoint>.endpoints.huggingface.cloud \
2 -H "Authorization: Bearer $HF_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d "{\"inputs\": \"$(base64 < your-song.mp3)\"}"
Full benchmark across every popular open-source separator:
StemSplitio/stem-separation-benchmark-2026.
1@inproceedings{rouard2023hybrid,
2 title = {Hybrid Transformers for Music Source Separation},
3 author = {Rouard, Simon and Massa, Francisco and D{\'e}fossez, Alexandre},
4 booktitle = {ICASSP},
5 year = {2023}
6}