Audio-to-Audio
MLX
Safetensors
mel_band_roformer
audio
source-separation
music-source-separation
vocal-separation
mel-band-roformer
roformer
apple-silicon
Instructions to use mlx-community/mel-roformer-kim-vocal-2-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/mel-roformer-kim-vocal-2-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir mel-roformer-kim-vocal-2-mlx mlx-community/mel-roformer-kim-vocal-2-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Initial bf16 conversion of Kim Vocal 2 — 66.08 dB SDR parity vs PyTorch reference
Browse files- LICENSE +27 -0
- README.md +175 -0
- config.json +27 -0
- model.safetensors +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Xocialize (MLX conversion and packaging)
|
| 4 |
+
Copyright (c) 2025-2026 Kimberley Jensen (KimberleyJSN) — original Kim Vocal 2 weights
|
| 5 |
+
|
| 6 |
+
The original Kim Vocal 2 weights at https://huggingface.co/KimberleyJSN/melbandroformer
|
| 7 |
+
were initially released under GPL-3.0 on 2025-06-17 and relicensed to MIT on
|
| 8 |
+
2026-04-22 (commit ac9b0614ab3cd7f77219e18ba494dfd93956c348). This MLX
|
| 9 |
+
conversion was performed after the relicense and is redistributed under MIT.
|
| 10 |
+
|
| 11 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 12 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 13 |
+
in the Software without restriction, including without limitation the rights
|
| 14 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 15 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 16 |
+
furnished to do so, subject to the following conditions:
|
| 17 |
+
|
| 18 |
+
The above copyright notice and this permission notice shall be included in all
|
| 19 |
+
copies or substantial portions of the Software.
|
| 20 |
+
|
| 21 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 22 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 23 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 24 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 25 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 26 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 27 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: mlx
|
| 4 |
+
base_model: KimberleyJSN/melbandroformer
|
| 5 |
+
pipeline_tag: audio-to-audio
|
| 6 |
+
tags:
|
| 7 |
+
- mlx
|
| 8 |
+
- audio
|
| 9 |
+
- audio-to-audio
|
| 10 |
+
- source-separation
|
| 11 |
+
- music-source-separation
|
| 12 |
+
- vocal-separation
|
| 13 |
+
- mel-band-roformer
|
| 14 |
+
- roformer
|
| 15 |
+
- apple-silicon
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# mlx-community/mel-roformer-kim-vocal-2-mlx
|
| 19 |
+
|
| 20 |
+
This model was converted to MLX format from [`KimberleyJSN/melbandroformer`](https://huggingface.co/KimberleyJSN/melbandroformer) using a custom Mel-Band-RoFormer MLX port (the [`Blaizzy/mlx-audio`](https://github.com/Blaizzy/mlx-audio) PR + the [`xocialize/mel-roformer-mlx-swift`](https://github.com/xocialize/mel-roformer-mlx-swift) Swift consumer). Refer to the [original model card](https://huggingface.co/KimberleyJSN/melbandroformer) for more details on the model.
|
| 21 |
+
|
| 22 |
+
## Model
|
| 23 |
+
|
| 24 |
+
- **Family:** Mel-Band-RoFormer (Lu, Wang, Won, "Mel-Band RoFormer for Music Source Separation," [arXiv:2310.01809](https://arxiv.org/abs/2310.01809))
|
| 25 |
+
- **Checkpoint:** Kim Vocal 2 by Kimberley Jensen
|
| 26 |
+
- **Parameters:** ~228M
|
| 27 |
+
- **Sample rate:** 44100 Hz, stereo
|
| 28 |
+
- **Stems produced:** `vocals` (single-stem model — derive `instrumental` as `mixture - vocals`)
|
| 29 |
+
- **Chunk size:** 352800 samples (~8 s at 44.1 kHz), 50% overlap
|
| 30 |
+
- **STFT:** `n_fft=2048`, `hop_length=441`, `win_length=2048`
|
| 31 |
+
- **Transformer:** `dim=384`, `depth=6`, `heads=8`, `dim_head=64`
|
| 32 |
+
- **Bands:** 60 mel bands
|
| 33 |
+
- **Mask estimator depth:** 2
|
| 34 |
+
|
| 35 |
+
Full hyperparameters in [`config.json`](config.json).
|
| 36 |
+
|
| 37 |
+
## Source
|
| 38 |
+
|
| 39 |
+
- **Original repository:** https://huggingface.co/KimberleyJSN/melbandroformer
|
| 40 |
+
- **Original author:** Kimberley Jensen ([@KimberleyJSN](https://huggingface.co/KimberleyJSN))
|
| 41 |
+
- **Original license:** MIT (relicensed from GPL-3.0 — see License provenance below)
|
| 42 |
+
- **Original commit at conversion time:** [`ac9b061`](https://huggingface.co/KimberleyJSN/melbandroformer/commit/ac9b0614ab3cd7f77219e18ba494dfd93956c348)
|
| 43 |
+
- **Source file:** `MelBandRoformer.ckpt`
|
| 44 |
+
|
| 45 |
+
## License
|
| 46 |
+
|
| 47 |
+
This redistribution is MIT-licensed, matching the original checkpoint license. See [`LICENSE`](LICENSE).
|
| 48 |
+
|
| 49 |
+
### License provenance (Kim Vocal 2)
|
| 50 |
+
|
| 51 |
+
This checkpoint was originally released under GPL-3.0 on June 17, 2025
|
| 52 |
+
(see https://huggingface.co/KimberleyJSN/melbandroformer/discussions/2)
|
| 53 |
+
and relicensed to MIT on April 22, 2026 by the original author Kimberley Jensen
|
| 54 |
+
(commit https://huggingface.co/KimberleyJSN/melbandroformer/commit/ac9b0614ab3cd7f77219e18ba494dfd93956c348).
|
| 55 |
+
This MLX conversion was made after the relicense and inherits the MIT terms.
|
| 56 |
+
|
| 57 |
+
The relicense was independently confirmed with the original author the week of April 20, 2026 prior to this redistribution.
|
| 58 |
+
|
| 59 |
+
| Date | Event | Reference |
|
| 60 |
+
|---|---|---|
|
| 61 |
+
| 2025-06-17 | Original license assigned: GPL-3.0 | [Discussion #2](https://huggingface.co/KimberleyJSN/melbandroformer/discussions/2) |
|
| 62 |
+
| 2026-04-22 | Relicense to MIT (HuggingFace README updated, `license: mit`) | [Commit `ac9b061`](https://huggingface.co/KimberleyJSN/melbandroformer/commit/ac9b0614ab3cd7f77219e18ba494dfd93956c348) |
|
| 63 |
+
| Week of 2026-04-20 | Direct confirmation with author | Private correspondence |
|
| 64 |
+
| 2026-04-25 | Repo `license: mit` badge confirmed | [README front-matter](https://huggingface.co/KimberleyJSN/melbandroformer/blob/main/README.md) |
|
| 65 |
+
|
| 66 |
+
## Conversion
|
| 67 |
+
|
| 68 |
+
- **Tool:** `mlx_audio.sts.models.mel_roformer.convert` (custom port — pending upstream merge to [Blaizzy/mlx-audio](https://github.com/Blaizzy/mlx-audio))
|
| 69 |
+
- **Tool version:** [`8380ab8`](https://github.com/xocialize/mlx-audio/commit/8380ab8) on the `feat/mel-band-roformer` branch (xocialize fork)
|
| 70 |
+
- **mlx (Python) version:** 0.31.0
|
| 71 |
+
- **Architecture preset:** `MelRoFormerConfig.kim_vocal_2()`
|
| 72 |
+
- **Output precision:** `bfloat16`
|
| 73 |
+
- **Source `MelBandRoformer.ckpt` SHA-256:** `87201f4d31afb5bc79993230fc49446918425574db48c01c405e44f365c7559e`
|
| 74 |
+
- **Conversion date:** 2026-04-25
|
| 75 |
+
|
| 76 |
+
## Parity
|
| 77 |
+
|
| 78 |
+
Verified against the PyTorch reference implementation:
|
| 79 |
+
|
| 80 |
+
- **SDR:** **66.08 dB** between PyTorch and MLX outputs (target: > 40 dB per the upload guide). The upload guide treats > 40 dB SDR as effectively bit-exact up to floating-point precision; 66 dB indicates the bf16 conversion is faithful to the lucidrains PyTorch reference.
|
| 81 |
+
- **PyTorch reference:** [`bs_roformer==0.3.10`](https://pypi.org/project/BS-RoFormer/0.3.10/) — `bs_roformer.MelBandRoformer` instantiated from the original training YAML. Newer `bs_roformer` releases (0.4+) are **not** compatible with the Kim Vocal 2 checkpoint (the `layers` ModuleList nesting was reordered and nGPT-style normalization was added).
|
| 82 |
+
- **Test signal:** 8-second stereo 44.1 kHz clip (mid-episode anime audio, mono → stereo duplication, music + dialogue mix).
|
| 83 |
+
- **Reproduce:** see `mlx_audio/tests/sts/test_mel_roformer_parity.py` and `tests/sts/torch_infer.py` in the [xocialize/mlx-audio](https://github.com/xocialize/mlx-audio/tree/feat/mel-band-roformer) fork.
|
| 84 |
+
|
| 85 |
+
## Intended use
|
| 86 |
+
|
| 87 |
+
Vocal isolation for music source separation. Input is a stereo music mixture; output is a separated vocal stem. Trained for vocals; not validated for general-purpose source separation (drums, bass, other). Derive an instrumental stem as `mixture - vocals` if needed.
|
| 88 |
+
|
| 89 |
+
## Files
|
| 90 |
+
|
| 91 |
+
- `model.safetensors` — MLX weights
|
| 92 |
+
- `config.json` — architecture hyperparameters
|
| 93 |
+
- `LICENSE` — MIT license text
|
| 94 |
+
|
| 95 |
+
## Usage
|
| 96 |
+
|
| 97 |
+
### Python (mlx-audio)
|
| 98 |
+
|
| 99 |
+
> Requires the Mel-Band-RoFormer architecture from the [pending mlx-audio PR](https://github.com/Blaizzy/mlx-audio); not yet on the released `pip install mlx-audio` line. Once merged, the snippet below works as-is. In the meantime, install the fork branch directly.
|
| 100 |
+
|
| 101 |
+
```python
|
| 102 |
+
import soundfile as sf
|
| 103 |
+
import numpy as np
|
| 104 |
+
import mlx.core as mx
|
| 105 |
+
|
| 106 |
+
from mlx_audio.sts.models.mel_roformer import MelRoFormer, MelRoFormerConfig
|
| 107 |
+
from mlx_audio.utils import load_audio
|
| 108 |
+
|
| 109 |
+
# 1. Load model + weights from the Hub.
|
| 110 |
+
model = MelRoFormer.from_pretrained(
|
| 111 |
+
"mlx-community/mel-roformer-kim-vocal-2-mlx",
|
| 112 |
+
config=MelRoFormerConfig.kim_vocal_2(), # optional if config.json is present
|
| 113 |
+
)
|
| 114 |
+
model.eval()
|
| 115 |
+
|
| 116 |
+
# 2. Load the input mixture as 44.1 kHz stereo and add a batch axis.
|
| 117 |
+
mixture = load_audio("input_mixture.wav", sample_rate=44100) # mx.array [2, samples]
|
| 118 |
+
batched = mixture[None, ...] # [1, 2, samples]
|
| 119 |
+
|
| 120 |
+
# 3. Separate vocals.
|
| 121 |
+
vocals = model(batched)[0] # [2, samples]
|
| 122 |
+
|
| 123 |
+
# 4. Derive instrumental as (mixture - vocals).
|
| 124 |
+
instrumental = mixture - vocals
|
| 125 |
+
|
| 126 |
+
# 5. Write stems to disk (soundfile expects [samples, channels]).
|
| 127 |
+
sf.write("vocals.wav", np.array(vocals).T, 44100)
|
| 128 |
+
sf.write("instrumental.wav", np.array(instrumental).T, 44100)
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
For long inputs, chunk the audio at `chunk_size = 352800` samples with 50% overlap and overlap-add the outputs — see the model code for the canonical helper once it's added.
|
| 132 |
+
|
| 133 |
+
### Swift ([`mel-roformer-mlx-swift`](https://github.com/xocialize/mel-roformer-mlx-swift))
|
| 134 |
+
|
| 135 |
+
```swift
|
| 136 |
+
import SwiftRoFormer
|
| 137 |
+
|
| 138 |
+
// 1. Construct the model with the matching preset.
|
| 139 |
+
let model = MelRoFormer(config: .kimVocal2)
|
| 140 |
+
|
| 141 |
+
// 2. Load weights via the WeightLoader utility.
|
| 142 |
+
// The HuggingFace download path can be obtained with the swift-transformers
|
| 143 |
+
// Hub helpers, or by manually downloading model.safetensors first.
|
| 144 |
+
try WeightLoader.loadWeights(
|
| 145 |
+
into: model,
|
| 146 |
+
from: weightsURL // local URL to model.safetensors
|
| 147 |
+
)
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
> A `MelRoFormer.fromPretrained(_:)` convenience that wraps Hub download + load is on the roadmap but not yet implemented in `mel-roformer-mlx-swift`. For now, download `model.safetensors` separately (e.g. via `huggingface-cli download`) and pass the local URL to `WeightLoader.loadWeights`.
|
| 151 |
+
|
| 152 |
+
## Citation
|
| 153 |
+
|
| 154 |
+
If you use this checkpoint, please cite the Mel-Band-RoFormer paper and the original Kim Vocal 2 release:
|
| 155 |
+
|
| 156 |
+
```bibtex
|
| 157 |
+
@misc{lu2023melband,
|
| 158 |
+
title = {Mel-Band {RoFormer} for Music Source Separation},
|
| 159 |
+
author = {Lu, Wei-Tsung and Wang, Ju-Chiang and Won, Minz and Choi, Keunwoo and Song, Xuchen},
|
| 160 |
+
year = {2023},
|
| 161 |
+
eprint = {2310.01809},
|
| 162 |
+
archivePrefix = {arXiv},
|
| 163 |
+
primaryClass = {eess.AS},
|
| 164 |
+
url = {https://arxiv.org/abs/2310.01809}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
@misc{kim_vocal_2_2025,
|
| 168 |
+
title = {Kim Vocal 2 — Mel-Band-RoFormer for vocal source separation},
|
| 169 |
+
author = {Jensen, Kimberley},
|
| 170 |
+
year = {2025},
|
| 171 |
+
url = {https://huggingface.co/KimberleyJSN/melbandroformer}
|
| 172 |
+
}
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
The training-time configurations are from [ZFTurbo/Music-Source-Separation-Training](https://github.com/ZFTurbo/Music-Source-Separation-Training) (MIT). The MLX implementation lineage is [`lucidrains/BS-RoFormer`](https://github.com/lucidrains/BS-RoFormer) (MIT) → [`Blaizzy/mlx-audio`](https://github.com/Blaizzy/mlx-audio) (Apache-2.0).
|
config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class": "MelRoFormerConfig",
|
| 3 |
+
"model_type": "mel_band_roformer",
|
| 4 |
+
"checkpoint_family": "kim_vocal_2",
|
| 5 |
+
"dim": 384,
|
| 6 |
+
"depth": 6,
|
| 7 |
+
"heads": 8,
|
| 8 |
+
"dim_head": 64,
|
| 9 |
+
"num_bands": 60,
|
| 10 |
+
"num_stems": 1,
|
| 11 |
+
"ff_mult": 4,
|
| 12 |
+
"mlp_expansion_factor": 4,
|
| 13 |
+
"mask_estimator_depth": 2,
|
| 14 |
+
"n_fft": 2048,
|
| 15 |
+
"hop_length": 441,
|
| 16 |
+
"win_length": 2048,
|
| 17 |
+
"sample_rate": 44100,
|
| 18 |
+
"chunk_size": 352800,
|
| 19 |
+
"num_overlap": 2,
|
| 20 |
+
"_dtype": "bfloat16",
|
| 21 |
+
"_mlx_version": "0.31.0",
|
| 22 |
+
"_tool_version": "8380ab8",
|
| 23 |
+
"_source_input": "MelBandRoformer.ckpt",
|
| 24 |
+
"_source_sha256": "87201f4d31afb5bc79993230fc49446918425574db48c01c405e44f365c7559e",
|
| 25 |
+
"_source_repository": "https://huggingface.co/KimberleyJSN/melbandroformer",
|
| 26 |
+
"_source_license_at_conversion": "MIT (relicensed from GPL-3.0 on 2026-04-22, commit ac9b0614ab3cd7f77219e18ba494dfd93956c348)"
|
| 27 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:312c38e5b698f8dfaa4d6064e8f79010744825828917871a9d22673a43eb7fe5
|
| 3 |
+
size 456483463
|