Skip to content
pymss-projectPublic

About

Inference package for music source separation models

Resources

Stars

80 stars

Watchers

3 watching

Forks

Repository files navigation

pymss

High-performance, hardware-agnostic music source separation in pure PyTorch.

PyPI Python PyTorch Accelerators License

English · 简体中文

Hardware Support · Install · Quick Start · Workflows and Server · Plugins · Benchmarks · Documentation


Highlights

  • Runs on virtually every GPU & AI accelerator: Pure PyTorch with zero custom CUDA extensions — unified support for NVIDIA CUDA, AMD ROCm, Intel Arc XPU, Apple Silicon MLX/MPS, Google TPU, Huawei Ascend NPU, and 7 domestic Chinese GPU families (Moore Threads, Biren, Iluvatar, MetaX, Enflame, Hygon, Cambricon).
  • 326 ready-to-use catalog models: Auto-downloads weights and configs across BS/Mel-Band RoFormer & Conformer, PolarFormer, HyperACE, HTDemucs, MDX23C, SCNet, Bandit v1/v2, Apollo, UVR VR, and Legacy Demucs/TasNet.
  • Production speed: Up to 356.9x RTFx on RTX 5090 (1 hour of audio separated in 10–35 seconds), with cuDNN / AOTriton SDPA and native Apple MLX acceleration.
  • Flexible interfaces: CLI, Python API, multi-step YAML workflows, native comfy-mss ComfyUI JSON graph runner (no ComfyUI needed), audio ensembling, and an optional HTTP Server + WebUI.
  • Extensible plugin system: Shared capability pool (23 built-in DSP/codec capabilities) with official GitHub & GitCode marketplace support.

Hardware Support

pymss abstracts backend differences through pymss_core.device capability profiles instead of hardcoding cuda checks:

Vendor / Ecosystem Backend Stack --device Required PyTorch Notes & Guide
NVIDIA CUDA cuda ≥ 2.4 cuDNN / Flash / Efficient SDPA (Guide)
AMD ROCm (Linux / Win 7.2.1+ / WSL2) rocm ≥ 2.4 AOTriton efficient SDPA (Guide)
Intel Arc XPU xpu ≥ 2.4 Official XPU wheel, FP32 (Guide)
Apple Silicon MLX / MPS mlx / mps ≥ 2.4 Auto-installs mlx>=0.31.0 (Guide)
Google Cloud TPU (torch_tpu) tpu 2.11 – 2.15 Python 3.13+, high-precision numerics (Guide)
Huawei Ascend NPU (torch_npu) npu ≥ 2.7.1 torch.fft STFT + RNN CPU fallback (Guide)
Moore Threads MUSA (torch_musa) musa / moore 2.7.1 Spring/S70/S80 verified (Guide)
Biren BIRENSUPA (torch_br) biren / supa 2.4 – 2.8 BF16 autocast + operator fallbacks (Guide)
Iluvatar CoreX SDK iluvatar 2.4.1 / 2.7.1 CUDA-compatible stack (Guide)
MetaX MACA metax 2.6 – 2.8 CUDA-compatible stack (Guide)
Enflame TopsRider (torch_gcu) enflame / gcu 2.6 – 2.10 Private gcu device (Guide)
Hygon DCU (DTK / DAS) hygon 2.4.1 HIP / CUDA-compatible stack (Guide)
Cambricon MLU (torch_mlu) mlu 2.4 Private mlu device (Guide)
CPU PyTorch CPU cpu ≥ 2.4 Universal fallback

--device auto probing order: CUDA / ROCm → Intel XPU → Ascend NPU → GCU / MLU / SUPA / MUSA → Google TPU → Apple Silicon (MLX/MPS) → CPU.


Install

Requires Python 3.11+ (Google TPU requires Python 3.13+).

# CLI & Python API
pip install pymss

# With HTTP Server & WebUI
pip install "pymss[server]"

On Apple Silicon, mlx>=0.31.0 is installed automatically. On NVIDIA / AMD / Intel / Ascend / Chinese GPUs / TPU, install the matching PyTorch build first (see below).

Accelerator-specific PyTorch install commands (click to expand)

NVIDIA CUDA (cu128)

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
pip install pymss

AMD ROCm — Linux / WSL2

pip install torch --index-url https://download.pytorch.org/whl/rocm7.2
pip install pymss

AMD ROCm — Windows Native (ROCm 7.2.1+, Adrenalin 26.2.2+, Python 3.12)

pip install --no-cache-dir https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm_sdk_core-7.2.1-py3-none-win_amd64.whl https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm_sdk_devel-7.2.1-py3-none-win_amd64.whl https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/rocm_sdk_libraries_custom-7.2.1-py3-none-win_amd64.whl https://repo.radeon.com/rocm/windows/rocm-rel-7.2.1/torch-2.9.1%2Brocm7.2.1-cp312-cp312-win_amd64.whl
pip install pymss

Intel Arc XPU (requires Level Zero & OpenCL drivers on Linux)

pip install torch --index-url https://download.pytorch.org/whl/xpu
pip install pymss

Huawei Ascend NPU (install torch_npu matching CANN & PyTorch ≥ 2.7.1 first)

pip install pymss

Chinese Accelerators (Biren / Iluvatar / MetaX / Enflame / Hygon / Cambricon / Moore Threads — never let PyPI overwrite vendor torch)

pip install --no-deps torch==<vendor-build>
pip install --no-deps pymss

Google TPU (torch_tpu preinstalled in Colab / TPU VM images; Python 3.13+, torch 2.11–2.15)

pip install --no-deps pymss

Full setup instructions, attention backends, and caveats: docs/accelerators.md · docs/cn-gpu.md · docs/tpu.md.


Quick Start

CLI Inference

Run separation by catalog model name — missing weights and configs download automatically (default source: ModelScope):

pymss infer bs_roformer_voc_hyperacev2 \
  -i path/to/input_file_or_folder \
  -o results \
  --save-as-folder \
  --device auto \
  --format wav     # wav | flac | mp3 | m4a | aac | opus | vorbis | ogg

Switch download mirror or model cache directory, or register local weights for reuse by name:

# Use Hugging Face mirror and a custom model directory
pymss --model-dir /path/to/models infer bs_roformer_voc_hyperacev2 \
  --source hf-mirror -i input.wav -o results

# Register local weights once, then call by name like a catalog model
pymss register my_bs --type bs_conformer --model /path/model.ckpt --config /path/config.yaml --overlap-size 44100
pymss infer my_bs -i song.wav -o results
pymss list --user-only
pymss unregister my_bs

Running from a source checkout without installing? Replace pymss with python -m pymss.cli.

Python API

from pymss import MSSeparator

with MSSeparator.from_model_name(
    "bs_roformer_voc_hyperacev2",
    download=True,
    device="auto",
    output_format="wav",
    store_dirs="results",
) as separator:
    separator.process_folder("path/to/input_file_or_folder")

Using the context manager automatically calls separator.close() to release weights and clear backend caches. For custom local weights (model_type="auto"), per-stem store_dirs, audio_params, and inference_params, see the MSSeparator Parameter Guide.


Workflows and Server

Feature Command Details
YAML Workflows pymss workflow init -o chain.yaml
pymss workflow validate -c chain.yaml
pymss workflow run -c chain.yaml -i in/ -o results --download
Chain multiple models (input: split.other), step-batched folder runs, --output-layout flat.
ComfyUI JSON (comfy-mss) pymss comfy run -c workflow.json -i input.wav -o results --download Runs native comfy-mss + ComfyUI audio nodes directly without ComfyUI. Supports --no-strict and Python Graph Execution Events.
Audio Ensemble pymss ensemble a.wav b.wav --algorithm avg_wave --weights 1 0.8 -o out.wav 8 algorithms: {avg,median,min,max}_{wave,fft}.
HTTP Server & WebUI pymss serve --webui Dynamic model loading, catalog browsing, downloads, and browser WebUI. See CLI, API, and Errors.

Plugins

pymss includes a plugin system sharing one global capability pool with the 23 built-in DSP and codec capabilities (eq, mix, ensemble, resample, {fmt}_encode, etc.). The official marketplace supports GitHub and GitCode (auto-selects the fastest synchronized source; override with PYMSS_PLUGINS_SOURCE=github|gitcode).

pymss install pymss.loudnorm                             # from official registry (or @<tag-or-commit>)
pymss install "https://github.com/pymss-project/pymss-plugins#plugins/loudnorm"
pymss install ./my-local-plugin                          # local path (dependencies auto-installed)

pymss plugins list                                       # installed plugins & load status
pymss plugins available                                  # browse official registry
pymss plugins search loudness                            # search registry
pymss plugins update pymss.loudnorm                      # update official or third-party plugin
pymss uninstall pymss.loudnorm

Plugins live in ~/.pymss/plugins/ (PYMSS_PLUGINS_DIR). Write your own operations, capabilities, nodes, or CLI subcommands with docs/plugins.md and docs/plugin-protocol.md.


Supported Models

Architecture (model_type) Highlights
bs_roformer, bs_conformer Band-Split RoFormer / Conformer, BS PolarFormer (use_pope: true, no Triton required), HyperACE
mel_band_roformer, mel_band_conformer Mel-Band RoFormer / Conformer family (144+ catalog models)
htdemucs HTDemucs v4 including CaC (htdemucs.cac: true)
mdx23c, scnet, apollo MDX23C, SCNet, Apollo audio restoration
bandit, bandit_v2 Cinematic / multi-stem Bandit v1 & v2
vr UVR VR .pth series (Vocals, Instrumental, DeNoise, DeEcho, DeReverb)
legacy_demucs, legacy_tasnet Dependency-free .th loader for classic Demucs, v3, ConvTasNet, CaC HDemucs

model_type="auto" automatically detects YAML-based architectures, and Hugging Face / MSST configs using inference.num_overlap are converted to overlap_size automatically. See docs/models-and-benchmarks.md for compatibility notes and fast overlap tuning.


Benchmarks

Measured on NVIDIA GeForce RTX 5090 (PyTorch 2.9.1+cu128, CUDA 12.8, TTA off, 1 warmup + 3 measured runs):

Model Architecture RTFx 1-hour audio
scnet_checkpoint_musdb18 scnet 356.85x 10.1s
UVR-DeNoise-Lite vr 243.62x 14.8s
BS-Roformer-HyperACE_v2_voc bs_roformer 231.83x 15.5s
model_vocals_mdx23c_sdr_10.17 mdx23c 209.41x 17.2s
HTDemucs4 htdemucs 200.52x 18.0s
Mel-Band-Roformer-big mel_band_roformer 194.05x 18.6s
model_bandit_plus_dnr_sdr_11.47 bandit 122.76x 29.3s
Apollo_LQ_MP3_restoration apollo 100.62x 35.8s

See the complete 40-model benchmark table (11 MSS + 29 VR models) in docs/models-and-benchmarks.md.


Documentation

Topic Document
Accelerator Setup & Attention Backends docs/accelerators.md
Chinese GPU Matrix & Bring-up Notes docs/cn-gpu.md
Google TPU (torch_tpu) Guide docs/tpu.md
MSSeparator Python API & Parameters docs/msseparator.md · 中文版
Model Compatibility & Full Benchmarks docs/models-and-benchmarks.md
ComfyUI Workflows & Execution Events docs/graph-events.md
HTTP Server & WebUI CLI · API · Errors
Plugin Development & Protocol docs/plugins.md · docs/plugin-protocol.md

Development

Requires Git, Python 3.11+, and uv (plus Node.js/npm if building pymss-webui):

git clone https://github.com/pymss-project/pymss
cd pymss
uv sync --group dev
uv run pytest test -q
uv build

To bundle a local WebUI build, run npm ci && npm run build inside pymss-webui and copy dist/. into pymss/server/webui_static/.


License

Released under the MIT License.

About

Inference package for music source separation models

Resources

Stars

80 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages