Skip to main content

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() and torchaudio.load() with TorchCodec's AudioEncoder and AudioDecoder
  • 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: torchcodec replaces torchaudio; requires torch>=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.

Metadata

Release files for cjm-demucs-v4 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for cjm-demucs-v4 0.0.1
File Interpreter ABI Platform
cjm_demucs_v4-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / cjm_demucs_v4-0.0.1-py3-none-any.whl

Download URL cjm_demucs_v4-0.0.1-py3-none-any.whl
Size 56.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86fa86eb8141871d8f115de54bfe0998b61c891e05fb1b2d3b6f1966e3a44c73
BLAKE2b-256 checksum
How to use checksums
c84d8b9157b8aad715228e72140712ac47dc96ce56ce4fbb23ffcfea3ba84cf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for cjm-demucs-v4 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page