Skip to main content

Inference-only Band-Split Roformer separation toolkit

Project description

BS-RoFormer-Infer

Production-ready, inference-only toolkit for Band-Split RoPE Transformer audio source separation

BS-RoFormer-Infer provides a clean, lightweight API for running music source separation inference using Band-Split RoFormer models with automatic checkpoint management.

Open In Colab Python 3.10+ PyTorch License: MIT PyPI


Features

  • Inference Only: Lightweight package focused on production inference
  • Auto-Download: Automatic checkpoint downloads with hash verification
  • 10 Pre-trained Models: Vocals, instrumentals, and multi-stem separation
  • CLI Tools: bs-roformer-infer and bs-roformer-download commands
  • Python API: Clean programmatic interface
  • Model Registry: Easy model discovery and management

Quick Start

Installation

# Using pip
pip install bs-roformer-infer

# Using UV (recommended)
uv pip install bs-roformer-infer

Download Models

# List available models
bs-roformer-download --list-models

# Download the recommended model (BS-RoFormer-SW)
bs-roformer-download --model roformer-model-bs-roformer-sw-by-jarredou

# Download all models
bs-roformer-download --all --output-dir ./models

CLI Inference

# Using the recommended BS-RoFormer-SW model
bs-roformer-infer \
  --config_path models/roformer-model-bs-roformer-sw-by-jarredou/BS-Rofo-SW-Fixed.yaml \
  --model_path models/roformer-model-bs-roformer-sw-by-jarredou/BS-Rofo-SW-Fixed.ckpt \
  --input_folder ./songs \
  --store_dir ./outputs

Python API

from pathlib import Path
from ml_collections import ConfigDict
import torch
import yaml
from bs_roformer import MODEL_REGISTRY, DEFAULT_MODEL, get_model_from_config

# Use the default recommended model (BS-RoFormer-SW)
entry = MODEL_REGISTRY.get(DEFAULT_MODEL)

# Load config and model
config = ConfigDict(yaml.safe_load(open(f"models/{entry.slug}/{entry.config}")))
model = get_model_from_config("bs_roformer", config)
state_dict = torch.load(f"models/{entry.slug}/{entry.checkpoint}", map_location="cpu")
model.load_state_dict(state_dict)

Recommended Model

BS-RoFormer-SW (roformer-model-bs-roformer-sw-by-jarredou) is the recommended default model for audio source separation. It supports 6-stem separation (vocals, drums, bass, guitar, piano, other) and provides excellent quality for production workflows.

from bs_roformer import DEFAULT_MODEL
print(DEFAULT_MODEL)  # "roformer-model-bs-roformer-sw-by-jarredou"

Available Models

Model Category Description
roformer-model-bs-roformer-sw-by-jarredou 6-stem Recommended - BS-RoFormer SW (vocals, drums, bass, guitar, piano, other)
roformer-model-bs-roformer-vocals-resurrection-by-unwa vocals Vocals Resurrection by unwa
roformer-model-bs-roformer-vocals-revive-v3e-by-unwa vocals Vocals Revive V3e by unwa
roformer-model-bs-roformer-instrumental-resurrection-by-unwa instrumental Instrumental Resurrection by unwa
roformer-model-bs-roformer-de-reverb dereverb De-reverberation model
... ... See --list-models for full list

Registry Helpers

from bs_roformer import MODEL_REGISTRY

# List all categories
print(MODEL_REGISTRY.categories())

# List models by category
for model in MODEL_REGISTRY.list("vocals"):
    print(model.name, model.checkpoint)

# Search models
results = MODEL_REGISTRY.search("viperx")

Development Installation

# Clone repository
git clone https://github.com/openmirlab/bs-roformer-infer.git
cd bs-roformer-infer

# Install with UV
uv sync

# Install with pip
pip install -e ".[dev]"

Acknowledgments

This project builds upon the excellent work of several open-source projects:

  • BS-RoFormer by Phil Wang (lucidrains) - Clean PyTorch implementation of the Band-Split RoPE Transformer architecture
  • python-audio-separator by Andrew Beveridge (nomadkaraoke) - Pre-trained checkpoints and model configurations
  • Original Research - Wei-Tsung Lu, Ju-Chiang Wang, Qiuqiang Kong, and Yun-Ning Hung for the Band-Split RoPE Transformer paper

License

MIT License - see LICENSE for details.

This project includes code and configurations adapted from:

  • BS-RoFormer (MIT) - Phil Wang
  • python-audio-separator (MIT) - Andrew Beveridge

Citation

If you use BS-RoFormer-Infer in your research, please cite the original paper:

@inproceedings{Lu2023MusicSS,
    title   = {Music Source Separation with Band-Split RoPE Transformer},
    author  = {Wei-Tsung Lu and Ju-Chiang Wang and Qiuqiang Kong and Yun-Ning Hung},
    year    = {2023},
    url     = {https://api.semanticscholar.org/CorpusID:261556702}
}

Support

For issues and questions:


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bs_roformer_infer-0.1.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bs_roformer_infer-0.1.1-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file bs_roformer_infer-0.1.1.tar.gz.

File metadata

  • Download URL: bs_roformer_infer-0.1.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bs_roformer_infer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6b6339e041959eb2134bb2680a67ce6aea57a0b8e8fa0a44b2d819b415c5681
MD5 754844485e56a8b2e5c64fef44f6129f
BLAKE2b-256 4c27ce81a95d872f38f7305e2862f2944605c2da3849b87c0682c62e3665cc5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for bs_roformer_infer-0.1.1.tar.gz:

Publisher: publish.yml on openmirlab/bs-roformer-infer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bs_roformer_infer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bs_roformer_infer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a3c1d9badbd0ca33293268c1fe6f4275b329068115982e6277b60f42fb38b8b
MD5 5825f549e50359b6b66b07ac4c04a899
BLAKE2b-256 afe14599d9f715eb3394690311a497ba812b2ffc522c4c549d79f1f50395a1a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for bs_roformer_infer-0.1.1-py3-none-any.whl:

Publisher: publish.yml on openmirlab/bs-roformer-infer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page