Inference-only fork of Demucs v4 that provides audio source separation with TorchCodec replacing torchaudio I/O.
Project description
cjm-demucs-v4
Inference-only fork of Demucs v4 (Hybrid Transformer) for Python 3.12+ with TorchCodec replacing torchaudio I/O.
What Changed
- TorchCodec migration: Replaced
torchaudio.save()andtorchaudio.load()with TorchCodec'sAudioEncoderandAudioDecoder - Removed
audio_legacy.py: torchaudio 2.1 compatibility shim no longer needed - Stripped training code: Removed training, evaluation, augmentation, distributed training, and experiment grid files
- Updated dependencies:
torchcodecreplacestorchaudio; requirestorch>=2.0,python>=3.12
Installation
pip install cjm-demucs-v4
Or from source:
pip install git+https://github.com/cj-mills/cjm-demucs-v4.git
Requirements
- Python >= 3.12
- PyTorch >= 2.0
- FFmpeg (for audio reading)
- CUDA GPU recommended (CPU inference works but is ~10-20x slower)
Usage
Python API
from demucs.api import Separator, save_audio
separator = Separator(model="htdemucs", device="cuda")
origin, separated = separator.separate_audio_file("input.mp3")
# Save just the vocals
save_audio(separated["vocals"], "vocals.wav", samplerate=separator.samplerate)
CLI
demucs input.mp3 -o output_dir
demucs input.mp3 --two-stems vocals # vocals + accompaniment only
Available Models
| Model | Description |
|---|---|
htdemucs |
Hybrid Transformer Demucs v4 (default) |
htdemucs_ft |
Fine-tuned version (better quality, 4x slower) |
htdemucs_6s |
6-source variant (adds piano, guitar) |
hdemucs_mmi |
Hybrid Demucs v3 retrained |
mdx_extra |
MDX architecture with extra training data |
mdx_extra_q |
Quantized MDX (fastest) |
All 4-stem models separate into: drums, bass, vocals, other.
License
MIT License (same as upstream Demucs).
Credits
Based on Demucs by Alexandre Defossez / Meta Platforms, Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cjm_demucs_v4-0.0.1-py3-none-any.whl.
File metadata
- Download URL: cjm_demucs_v4-0.0.1-py3-none-any.whl
- Upload date:
- Size: 56.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86fa86eb8141871d8f115de54bfe0998b61c891e05fb1b2d3b6f1966e3a44c73
|
|
| MD5 |
7fa63cce0b6b2ee965edae5790b4ca8f
|
|
| BLAKE2b-256 |
c84d8b9157b8aad715228e72140712ac47dc96ce56ce4fbb23ffcfea3ba84cf5
|