Run this model with HF Jobs
Run moonbox-dev/Seed-VC-v2-MLX on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use moonbox-dev/Seed-VC-v2-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use moonbox-dev/Seed-VC-v2-MLX with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download moonbox-dev/Seed-VC-v2-MLX --local-dir Seed-VC-v2-MLX
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
File size: 37,135 Bytes
cec86ce 02c8203 be35fad efe3174 9e1544c cec86ce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | ---
base_model: Plachta/Seed-VC
base_model_relation: quantized
license: gpl-3.0
pipeline_tag: audio-to-audio
library_name: mlx
tags:
- mlx
- moonbox
- mlx
- seed-vc
- voice-conversion
- zero-shot
- multilingual
- apple-silicon
---
# Seed-VC v2 MLX
MLX builds of [Seed-VC v2](https://github.com/Plachtaa/seed-vc), made by Moonbox for Apple Silicon Macs. Each precision is a folder; keep a folder's
files together. Only the parts listed below are converted: the rest of the pipeline comes from the original
repository unless the section below says otherwise.
## Files
The last column is how far each build is from the original PyTorch model on the same inputs (see the section below
for what was measured).
| Precision | File | Size | sha256 | Checked against the original |
|---|---|---|---|---|
| bf16 | [`bf16/config.json`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/config.json) | 1.0 kB | `7e530165dbf2` | WER 2.63 % / CER 27.1 %, similarity 0.899 / 0.925, DNSMOS 3.13 / 3.10, RTF 2.10 (contended) |
| bf16 | [`bf16/content.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/content.safetensors) | 518.8 MB | `5f6a928b6cdc` | (the same build: numbers in its first row) |
| bf16 | [`bf16/dit.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/dit.safetensors) | 135.6 MB | `40cd16deae0e` | (the same build: numbers in its first row) |
| bf16 | [`bf16/mlx_model.py`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/mlx_model.py) | 34.1 kB | `9c76f2c34084` | (the same build: numbers in its first row) |
| bf16 | [`bf16/regulator.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/regulator.safetensors) | 8.4 MB | `ca2a3367dd9e` | (the same build: numbers in its first row) |
| bf16 | [`bf16/style.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/style.safetensors) | 13.7 MB | `9f3a70b557b9` | (the same build: numbers in its first row) |
| bf16 | [`bf16/vocoder.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/bf16/vocoder.safetensors) | 224.4 MB | `18a973dca36a` | (the same build: numbers in its first row) |
| fp16 | [`fp16/config.json`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/config.json) | 1.0 kB | `f09e117de591` | WER 2.11 % / CER 25.0 %, similarity 0.900 / 0.927, DNSMOS 3.18 / 3.09, RTF 0.97 (contended) |
| fp16 | [`fp16/content.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/content.safetensors) | 518.8 MB | `7604168241c4` | (the same build: numbers in its first row) |
| fp16 | [`fp16/dit.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/dit.safetensors) | 135.6 MB | `3c6b90404cca` | (the same build: numbers in its first row) |
| fp16 | [`fp16/mlx_model.py`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/mlx_model.py) | 34.1 kB | `9c76f2c34084` | (the same build: numbers in its first row) |
| fp16 | [`fp16/regulator.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/regulator.safetensors) | 8.4 MB | `0158c6d1473e` | (the same build: numbers in its first row) |
| fp16 | [`fp16/style.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/style.safetensors) | 13.7 MB | `6fab84973872` | (the same build: numbers in its first row) |
| fp16 | [`fp16/vocoder.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/fp16/vocoder.safetensors) | 224.4 MB | `4ec13b1a9b66` | (the same build: numbers in its first row) |
| 8bit | [`8bit/config.json`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/config.json) | 1.2 kB | `05a1d25078fb` | content + DiT 8-bit: WER 2.11 % / CER 20.8 %, similarity 0.899 / 0.926, DNSMOS 3.19 / 3.13, RTF 1.56 (contended) |
| 8bit | [`8bit/content.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/content.safetensors) | 287.8 MB | `7dba02159c9e` | (the same build: numbers in its first row) |
| 8bit | [`8bit/dit.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/dit.safetensors) | 73.7 MB | `ddf7215711b9` | (the same build: numbers in its first row) |
| 8bit | [`8bit/mlx_model.py`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/mlx_model.py) | 34.1 kB | `9c76f2c34084` | (the same build: numbers in its first row) |
| 8bit | [`8bit/regulator.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/regulator.safetensors) | 8.4 MB | `f0a8fe686462` | (the same build: numbers in its first row) |
| 8bit | [`8bit/style.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/style.safetensors) | 13.7 MB | `ab3ae2eef1a2` | (the same build: numbers in its first row) |
| 8bit | [`8bit/vocoder.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/8bit/vocoder.safetensors) | 224.4 MB | `72aaa0c2e32f` | (the same build: numbers in its first row) |
| 6bit | [`6bit/config.json`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/config.json) | 1.2 kB | `41f8a9bc6422` | content + DiT 6-bit: WER 2.63 % / CER 25.0 %, similarity 0.899 / 0.929, DNSMOS 3.15 / 3.18, RTF 1.10 (contended) |
| 6bit | [`6bit/content.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/content.safetensors) | 226.2 MB | `77f6339b9883` | (the same build: numbers in its first row) |
| 6bit | [`6bit/dit.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/dit.safetensors) | 57.1 MB | `f5b5b3daf103` | (the same build: numbers in its first row) |
| 6bit | [`6bit/mlx_model.py`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/mlx_model.py) | 34.1 kB | `9c76f2c34084` | (the same build: numbers in its first row) |
| 6bit | [`6bit/regulator.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/regulator.safetensors) | 8.4 MB | `a9db4eb34662` | (the same build: numbers in its first row) |
| 6bit | [`6bit/style.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/style.safetensors) | 13.7 MB | `deffad0fa9e1` | (the same build: numbers in its first row) |
| 6bit | [`6bit/vocoder.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/6bit/vocoder.safetensors) | 224.4 MB | `515f63ca2733` | (the same build: numbers in its first row) |
| 4bit | [`4bit/config.json`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/config.json) | 1.2 kB | `0b1374bc2de0` | experimental; content + DiT 4-bit: WER 3.16 % / CER 16.7 %, similarity 0.915 / 0.932, DNSMOS 3.09 / 3.13, RTF 1.51 (contended) |
| 4bit | [`4bit/content.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/content.safetensors) | 164.6 MB | `195bfef44bed` | (the same build: numbers in its first row) |
| 4bit | [`4bit/dit.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/dit.safetensors) | 40.6 MB | `fc2d995c41ae` | (the same build: numbers in its first row) |
| 4bit | [`4bit/mlx_model.py`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/mlx_model.py) | 34.1 kB | `9c76f2c34084` | (the same build: numbers in its first row) |
| 4bit | [`4bit/regulator.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/regulator.safetensors) | 8.4 MB | `fbee686ee3dc` | (the same build: numbers in its first row) |
| 4bit | [`4bit/style.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/style.safetensors) | 13.7 MB | `9e8a12d2dd0e` | (the same build: numbers in its first row) |
| 4bit | [`4bit/vocoder.safetensors`](https://huggingface.co/moonbox-dev/Seed-VC-v2-MLX/blob/main/4bit/vocoder.safetensors) | 224.4 MB | `f96805ceda0c` | (the same build: numbers in its first row) |
## How to run
Seed-VC v2 (Plachta: zero-shot voice conversion; re-voices a recording into the voice of a few seconds of reference
audio, keeping its words and timing; 22.05 kHz output) on [MLX](https://github.com/ml-explore/mlx). Each folder is
the whole pipeline for `mlx_model.py`, the one-file runtime that sits in it (mlx, numpy, soxr; no PyTorch). It
reproduces the official default v2 conversion (`inference_v2.py`: `VoiceConversionWrapper.convert_voice_with_streaming`
with 30 diffusion steps, intelligibility and similarity guidance 0.7, `convert_style` off).
| File | What |
|---|---|
| `content.safetensors` | ASTRAL-quantization content tokenizer (bsq2048): HuBERT-large's first 18 layers (facebook/hubert-large-ll60k), 12 ConvNeXt-V2 blocks, the binary spherical quantizer: 16 kHz audio -> 2048 content tokens at 50 Hz. 259 M parameters |
| `style.safetensors` | CAM++ (funasr/campplus): Kaldi fbank of the reference -> 192-value style vector. 6.9 M |
| `regulator.safetensors` | token embedding + 4 x (conv, GroupNorm, Mish): tokens stretched to the mel length -> DiT condition. 4.2 M |
| `dit.safetensors` | the 13-layer DiT (512 wide, time and style as tokens, adaptive RMSNorm, rotary positions): flow-matching velocity. 66.7 M |
| `vocoder.safetensors` | BigVGAN v2 (nvidia/bigvgan_v2_22khz_80band_256x): 80-band log-mel -> 22.05 kHz audio. 112 M |
| `config.json`, `mlx_model.py` | precision, quantization, sources; the runtime |
```bash
pip install mlx numpy soxr soundfile
hf download moonbox-dev/Seed-VC-v2-MLX --include "fp16/*" --local-dir seed-vc-v2
python seed-vc-v2/fp16/mlx_model.py source.wav voice.wav out.wav --seed 0
```
```python
import sys, soundfile as sf
sys.path.insert(0, "seed-vc-v2/fp16")
from mlx_model import SeedVC2
vc = SeedVC2("seed-vc-v2/fp16")
src, sr = sf.read("source.wav", dtype="float32")
ref, ref_sr = sf.read("voice.wav", dtype="float32")
wav, out_sr = vc(src, sr, ref, ref_sr, steps=30, seed=0) # numpy float32, 22.05 kHz
```
The runtime does the rest as the official code does: resampling (soxr, as librosa), the 80-bin log-mel and the
Kaldi fbank in numpy, the reference cut to 25 s, the content tokens in 30 s windows with 5 s of overlap, 30 Euler
steps on the cosine time schedule with the reference mel as prompt and two-condition guidance (one DiT call with a
batch of 3 per step), and for sources longer than the 30 s context the official chunking with a 16-frame crossfade.
BigVGAN's anti-aliased SnakeBeta activation (2x upsampling, SnakeBeta, 2x downsampling) runs as one Metal kernel, in
float32, like BigVGAN's own fused CUDA kernel. The flow's starting noise comes from numpy's generator, so a seed gives
the same output every run (the same draw as the ONNX build's `pipeline.py`; not the same as PyTorch with that seed).
The style-conversion mode (`convert_style`, the autoregressive model `ar_base.pth`) is not included.
**Precision.** `fp16/` and `bf16/` hold every weight in float16 / bfloat16. In `8bit/`, `6bit/` and `4bit/` the
Linear layers of the content tokenizer (HuBERT and ConvNeXt) and of the DiT are quantized (MLX affine, group size
64): 70 % of the weights. These stay float16 in every folder: the tokenizer's `project_in` (it sets the token bits),
the DiT's time input, style input, final and condition-merge layers, the regulator, CAM++ and BigVGAN (convolutions),
all norms; the DiT's rotary table is float32. **`4bit/` is experimental**: it passes the benchmark, but its 4-bit
tokenizer changes about half of the content tokens, further from the original than 12 conversions can vouch for.
`fp16/` is the recommended folder.
Measured against the official PyTorch pipeline (`convert_voice_with_streaming`, CPU, float32, same starting noise) on
12 conversions (English and Chinese sources, unseen reference voices): Whisper large-v3-turbo word / character error
rate, WavLM speaker similarity to the reference, DNSMOS. A build passes when, per source language, its error rate is
at most 2 points above the original's, similarity at most 0.03 below and DNSMOS at most 0.2 below.
| Folder | Size | English WER / sim / DNSMOS | Chinese CER / sim / DNSMOS | Peak memory | RTF (M5) |
|---|---|---|---|---|---|
| original (PyTorch fp32, CPU) | | 2.11 % / 0.899 / 3.14 | 27.1 % / 0.930 / 3.09 | | 6.2-8.0 |
| `fp16/` | 0.90 GB | 2.11 % / 0.900 / 3.18 | 25.0 % / 0.927 / 3.09 | 2.73 GB | 0.97* |
| `bf16/` | 0.90 GB | 2.63 % / 0.899 / 3.13 | 27.1 % / 0.925 / 3.10 | 2.73 GB | 2.10* |
| `8bit/` | 0.61 GB | 2.11 % / 0.899 / 3.19 | 20.8 % / 0.926 / 3.13 | 2.44 GB | 1.56* |
| `6bit/` | 0.53 GB | 2.63 % / 0.899 / 3.15 | 25.0 % / 0.929 / 3.18 | 2.36 GB | 1.10* |
| `4bit/` (experimental) | 0.45 GB | 3.16 % / 0.915 / 3.09 | 16.7 % / 0.932 / 3.13 | 2.28 GB | 1.51* |
Every folder passes. The 12-conversion set is small: differences of one word or a few characters are noise. RTF is
conversion time over output duration for the whole pipeline (10 s sources, 30 steps), measured while other jobs shared the GPU (load average 12-17, another model's MPS run), so upper bounds and not a ranking (in isolation 8bit ran faster than fp16); * contended. The port was checked
part by part against the official modules with exact float32 kernels (`MLX_METAL_GPU_ARCH=applegpu_g16s`): identical
content tokens, every part 106-131 dB from the original (BigVGAN 67 dB), whole conversion 57-63 dB. With the default
kernels Apple's reduced-precision float32 matmuls, carried through 30 guided steps, give a different waveform of the
same words and voice, so builds are compared by the measures above, not sample by sample.
**License.** Seed-VC v2 and its ASTRAL content tokenizer are GPL-3.0 (Plachtaa/seed-vc, Plachta/Seed-VC,
Plachta/ASTRAL-quantization), so these weights are distributed under GPL-3.0, and `mlx_model.py`, a reimplementation
of the official inference code in MLX (a derivative of it), is GPL-3.0 too: if you ship them in a product, the GPL's
terms for conveying covered works apply, including providing the corresponding source (`mlx_model.py` is the complete
runtime source; `NOTICE` lists the changes). The parts inside come from HuBERT-large (facebook/hubert-large-ll60k,
Apache-2.0), CAM++ (funasr/campplus, 3D-Speaker, Apache-2.0) and BigVGAN v2 (nvidia/bigvgan_v2_22khz_80band_256x,
MIT). Convert voices only with the consent of the people whose voices are used, and not for impersonation, fraud or
misleading audio.
**Sources.** github.com/Plachtaa/seed-vc @51383ef (configs/v2/vc_wrapper.yaml); Plachta/Seed-VC @257283f
(`v2/cfm_small.pth`: the DiT and the length regulator), Plachta/ASTRAL-quantization @4a2e967
(`bsq2048/bsq2048_light.pth`), facebook/hubert-large-ll60k @ff022d0, funasr/campplus @e4b6ede
(`campplus_cn_common.bin`), nvidia/bigvgan_v2_22khz_80band_256x @633ff70 (`bigvgan_generator.pt`), all read with
`torch.load(weights_only=True)`. Weight norm (HuBERT's positional convolution, BigVGAN's convolutions) is folded into
plain weights and CAM++'s BatchNorm into a scale and shift; the DiT's rotary table is the checkpoint's own (bfloat16
values), kept in float32.
## How these were made
From [Seed-VC v2](https://github.com/Plachtaa/seed-vc) at revision `51383ef`: the original weights loaded in MLX and stored as bf16 or fp16, or
quantized with MLX's affine quantization (`8bit`, `6bit`, `4bit`, group size 64; layers MLX can't quantize, such as
convolutions and norms, stay bf16). Every build was checked against the original before upload; the `sha256` column
above is what the files must hash to.
## License
GPL-3.0. These files are a derivative of the original model and carry its license: it is copied in this
repository, and it governs your use of these files. The original model card follows unchanged.
---
# Original model card
# Seed-VC
[](https://huggingface.co/spaces/Plachta/Seed-VC) [](https://arxiv.org/abs/2411.09943)
*English | [简体中文](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/README-ZH.md) | [日本語](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/README-JA.md)*
[real-time-demo.webm](https://github.com/user-attachments/assets/86325c5e-f7f6-4a04-8695-97275a5d046c)
Currently released model supports *zero-shot voice conversion* 🔊 , *zero-shot real-time voice conversion* 🗣️ and *zero-shot singing voice conversion* 🎶. Without any training, it is able to clone a voice given a reference speech of 1~30 seconds.
We support further fine-tuning on custom data to increase performance on specific speaker/speakers, with extremely low data requirement **(minimum 1 utterance per speaker)** and extremely fast training speed **(minimum 100 steps, 2 min on T4)**!
**Real-time voice conversion** is support, with algorithm delay of ~300ms and device side delay of ~100ms, suitable for online meetings, gaming and live streaming.
To find a list of demos and comparisons with previous voice conversion models, please visit our [demo page](https://plachtaa.github.io/seed-vc/)🌐 and [Evaluaiton](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/EVAL.md)📊.
We are keeping on improving the model quality and adding more features.
## Evaluation📊
See [EVAL.md](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/EVAL.md) for objective evaluation results and comparisons with other baselines.
## Installation📥
Suggested python 3.10 on Windows, Mac M Series (Apple Silicon) or Linux.
Windows and Linux:
```bash
pip install -r requirements.txt
```
Mac M Series:
```bash
pip install -r requirements-mac.txt
```
For Windows users, you may consider install `triton-windows` to enable `--compile` usage, which gains speed up on V2 models:
```bash
pip install triton-windows==3.2.0.post13
```
## Usage🛠️
We have released 4 models for different purposes:
| Version | Name | Purpose | Sampling Rate | Content Encoder | Vocoder | Hidden Dim | N Layers | Params | Remarks |
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|---------------|------------------------------------------------------------------------|---------|------------|----------|--------------------|--------------------------------------------------------|
| v1.0 | seed-uvit-tat-xlsr-tiny ([🤗](https://huggingface.co/Plachta/Seed-VC/blob/main/DiT_uvit_tat_xlsr_ema.pth)[📄](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/configs/presets/config_dit_mel_seed_uvit_xlsr_tiny.yml)) | Voice Conversion (VC) | 22050 | XLSR-large | HIFT | 384 | 9 | 25M | suitable for real-time voice conversion |
| v1.0 | seed-uvit-whisper-small-wavenet ([🤗](https://huggingface.co/Plachta/Seed-VC/blob/main/DiT_seed_v2_uvit_whisper_small_wavenet_bigvgan_pruned.pth)[📄](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/configs/presets/config_dit_mel_seed_uvit_whisper_small_wavenet.yml)) | Voice Conversion (VC) | 22050 | Whisper-small | BigVGAN | 512 | 13 | 98M | suitable for offline voice conversion |
| v1.0 | seed-uvit-whisper-base ([🤗](https://huggingface.co/Plachta/Seed-VC/blob/main/DiT_seed_v2_uvit_whisper_base_f0_44k_bigvgan_pruned_ft_ema.pth)[📄](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/configs/presets/config_dit_mel_seed_uvit_whisper_base_f0_44k.yml)) | Singing Voice Conversion (SVC) | 44100 | Whisper-small | BigVGAN | 768 | 17 | 200M | strong zero-shot performance, singing voice conversion |
| v2.0 | hubert-bsqvae-small ([🤗](https://huggingface.co/Plachta/Seed-VC/blob/main/v2)[📄](https://raw.githubusercontent.com/Plachtaa/seed-vc/51383ef/configs/v2/vc_wrapper.yaml)) | Voice & Accent Conversion (VC) | 22050 | [ASTRAL-Quantization](https://github.com/Plachtaa/ASTRAL-quantization) | BigVGAN | 512 | 13 | 67M(CFM) + 90M(AR) | Best in suppressing source speaker traits |
Checkpoints of the latest model release will be downloaded automatically when first run inference.
If you are unable to access huggingface for network reason, try using mirror by adding `HF_ENDPOINT=https://hf-mirror.com` before every command.
Command line inference:
```bash
python inference.py --source <source-wav>
--target <referene-wav>
--output <output-dir>
--diffusion-steps 25 # recommended 30~50 for singingvoice conversion
--length-adjust 1.0
--inference-cfg-rate 0.7
--f0-condition False # set to True for singing voice conversion
--auto-f0-adjust False # set to True to auto adjust source pitch to target pitch level, normally not used in singing voice conversion
--semi-tone-shift 0 # pitch shift in semitones for singing voice conversion
--checkpoint <path-to-checkpoint>
--config <path-to-config>
--fp16 True
```
where:
- `source` is the path to the speech file to convert to reference voice
- `target` is the path to the speech file as voice reference
- `output` is the path to the output directory
- `diffusion-steps` is the number of diffusion steps to use, default is 25, use 30-50 for best quality, use 4-10 for fastest inference
- `length-adjust` is the length adjustment factor, default is 1.0, set <1.0 for speed-up speech, >1.0 for slow-down speech
- `inference-cfg-rate` has subtle difference in the output, default is 0.7
- `f0-condition` is the flag to condition the pitch of the output to the pitch of the source audio, default is False, set to True for singing voice conversion
- `auto-f0-adjust` is the flag to auto adjust source pitch to target pitch level, default is False, normally not used in singing voice conversion
- `semi-tone-shift` is the pitch shift in semitones for singing voice conversion, default is 0
- `checkpoint` is the path to the model checkpoint if you have trained or fine-tuned your own model, leave to blank to auto-download default model from huggingface.(`seed-uvit-whisper-small-wavenet` if `f0-condition` is `False` else `seed-uvit-whisper-base`)
- `config` is the path to the model config if you have trained or fine-tuned your own model, leave to blank to auto-download default config from huggingface
- `fp16` is the flag to use float16 inference, default is True
Similarly, to use V2 model, you can run:
```bash
python inference_v2.py --source <source-wav>
--target <referene-wav>
--output <output-dir>
--diffusion-steps 25 # recommended 30~50 for singingvoice conversion
--length-adjust 1.0 # same as V1
--intelligibility-cfg-rate 0.7 # controls how clear the output linguistic content is, recommended 0.0~1.0
--similarity-cfg-rate 0.7 # controls how similar the output voice is to the reference voice, recommended 0.0~1.0
--convert-style true # whether to use AR model for accent & emotion conversion, set to false will only conduct timbre conversion similar to V1
--anonymization-only false # set to true will ignore reference audio but only anonymize source speech to an "average voice"
--top-p 0.9 # controls the diversity of the AR model output, recommended 0.5~1.0
--temperature 1.0 # controls the randomness of the AR model output, recommended 0.7~1.2
--repetition-penalty 1.0 # penalizes the repetition of the AR model output, recommended 1.0~1.5
--cfm-checkpoint-path <path-to-cfm-checkpoint> # path to the checkpoint of the CFM model, leave to blank to auto-download default model from huggingface
--ar-checkpoint-path <path-to-ar-checkpoint> # path to the checkpoint of the AR model, leave to blank to auto-download default model from huggingface
```
Voice Conversion Web UI:
```bash
python app_vc.py --checkpoint <path-to-checkpoint> --config <path-to-config> --fp16 True
```
- `checkpoint` is the path to the model checkpoint if you have trained or fine-tuned your own model, leave to blank to auto-download default model from huggingface. (`seed-uvit-whisper-small-wavenet`)
- `config` is the path to the model config if you have trained or fine-tuned your own model, leave to blank to auto-download default config from huggingface
Then open the browser and go to `http://localhost:7860/` to use the web interface.
Singing Voice Conversion Web UI:
```bash
python app_svc.py --checkpoint <path-to-checkpoint> --config <path-to-config> --fp16 True
```
- `checkpoint` is the path to the model checkpoint if you have trained or fine-tuned your own model, leave to blank to auto-download default model from huggingface. (`seed-uvit-whisper-base`)
- `config` is the path to the model config if you have trained or fine-tuned your own model, leave to blank to auto-download default config from huggingface
V2 model Web UI:
```bash
python app_vc_v2.py --cfm-checkpoint-path <path-to-cfm-checkpoint> --ar-checkpoint-path <path-to-ar-checkpoint>
```
- `cfm-checkpoint-path` is the path to the checkpoint of the CFM model, leave to blank to auto-download default model from huggingface
- `ar-checkpoint-path` is the path to the checkpoint of the AR model, leave to blank to auto-download default model from huggingface
- you may consider adding `--compile` to gain ~x6 speed-up on AR model inference
-
Integrated Web UI:
```bash
python app.py --enable-v1 --enable-v2
```
This will only load pretrained models for zero-shot inference. To use custom checkpoints, please run `app_vc.py` or `app_svc.py` as above.
If you have limited memory, remove `--enable-v2` or `--enable-v1` to only load one of the model sets.
Real-time voice conversion GUI:
```bash
python real-time-gui.py --checkpoint-path <path-to-checkpoint> --config-path <path-to-config>
```
- `checkpoint` is the path to the model checkpoint if you have trained or fine-tuned your own model, leave to blank to auto-download default model from huggingface. (`seed-uvit-tat-xlsr-tiny`)
- `config` is the path to the model config if you have trained or fine-tuned your own model, leave to blank to auto-download default config from huggingface
> [!IMPORTANT]
> It is strongly recommended to use a GPU for real-time voice conversion.
> Some performance testing has been done on a NVIDIA RTX 3060 Laptop GPU, results and recommended parameter settings are listed below:
| Model Configuration | Diffusion Steps | Inference CFG Rate | Max Prompt Length | Block Time (s) | Crossfade Length (s) | Extra context (left) (s) | Extra context (right) (s) | Latency (ms) | Inference Time per Chunk (ms) |
|---------------------------------|-----------------|--------------------|-------------------|----------------|----------------------|--------------------------|---------------------------|--------------|-------------------------------|
| seed-uvit-xlsr-tiny | 10 | 0.7 | 3.0 | 0.18s | 0.04s | 2.5s | 0.02s | 430ms | 150ms |
You can adjust the parameters in the GUI according to your own device performance, the voice conversion stream should work well as long as Inference Time is less than Block Time.
Note that inference speed may drop if you are running other GPU intensive tasks (e.g. gaming, watching videos)
Explanations for real-time voice conversion GUI parameters:
- `Diffusion Steps` is the number of diffusion steps to use, in real-time case usually set to 4~10 for fastest inference;
- `Inference CFG Rate` has subtle difference in the output, default is 0.7, set to 0.0 gains about 1.5x speed-up;
- `Max Prompt Length` is the maximum length of the prompt audio, setting to a low value can speed up inference, but may reduce similarity to prompt speech;
- `Block Time` is the time length of each audio chunk for inference, the higher the value, the higher the latency, note this value must be greater than the inference time per block, set according to your hardware condition;
- `Crossfade Length` is the time length of crossfade between audio chunks, normally not needed to change;
- `Extra context (left)` is the time length of extra history context for inference, the higher the value, the higher the inference time, but can increase stability;
- `Extra context (right)` is the time length of extra future context for inference, the higher the value, the higher the inference time and latency, but can increase stability;
The algorithm delay is appoximately calculated as `Block Time * 2 + Extra context (right)`, device side delay is usually of ~100ms. The overall delay is the sum of the two.
You may wish to use [VB-CABLE](https://vb-audio.com/Cable/) to route audio from GUI output stream to a virtual microphone.
*(GUI and audio chunking logic are modified from [RVC](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI), thanks for their brilliant implementation!)*
## Training🏋️
Fine-tuning on custom data allow the model to clone someone's voice more accurately. It will largely improve speaker similarity on particular speakers, but may slightly increase WER.
A Colab Tutorial is here for you to follow: [](https://colab.research.google.com/drive/1R1BJTqMsTXZzYAVx3j1BiemFXog9pbQG?usp=sharing)
1. Prepare your own dataset. It has to satisfy the following:
- File structure does not matter
- Each audio file should range from 1 to 30 seconds, otherwise will be ignored
- All audio files should be in on of the following formats: `.wav` `.flac` `.mp3` `.m4a` `.opus` `.ogg`
- Speaker label is not required, but make sure that each speaker has at least 1 utterance
- Of course, the more data you have, the better the model will perform
- Training data should be as clean as possible, BGM or noise is not desired
2. Choose a model configuration file from `configs/presets/` for fine-tuning, or create your own to train from scratch.
- For fine-tuning, it should be one of the following:
- `./configs/presets/config_dit_mel_seed_uvit_xlsr_tiny.yml` for real-time voice conversion
- `./configs/presets/config_dit_mel_seed_uvit_whisper_small_wavenet.yml` for offline voice conversion
- `./configs/presets/config_dit_mel_seed_uvit_whisper_base_f0_44k.yml` for singing voice conversion
3. Run the following command to start training:
```bash
python train.py
--config <path-to-config>
--dataset-dir <path-to-data>
--run-name <run-name>
--batch-size 2
--max-steps 1000
--max-epochs 1000
--save-every 500
--num-workers 0
```
where:
- `config` is the path to the model config, choose one of the above for fine-tuning or create your own for training from scratch
- `dataset-dir` is the path to the dataset directory, which should be a folder containing all the audio files
- `run-name` is the name of the run, which will be used to save the model checkpoints and logs
- `batch-size` is the batch size for training, choose depends on your GPU memory.
- `max-steps` is the maximum number of steps to train, choose depends on your dataset size and training time
- `max-epochs` is the maximum number of epochs to train, choose depends on your dataset size and training time
- `save-every` is the number of steps to save the model checkpoint
- `num-workers` is the number of workers for data loading, set to 0 for Windows
Similarly, to train V2 model, you can run: (note that V2 training script supports multi-GPU training)
```bash
accelerate launch train_v2.py
--dataset-dir <path-to-data>
--run-name <run-name>
--batch-size 2
--max-steps 1000
--max-epochs 1000
--save-every 500
--num-workers 0
--train-cfm
```
4. If training accidentially stops, you can resume training by running the same command again, the training will continue from the last checkpoint. (Make sure `run-name` and `config` arguments are the same so that latest checkpoint can be found)
5. After training, you can use the trained model for inference by specifying the path to the checkpoint and config file.
- They should be under `./runs/<run-name>/`, with the checkpoint named `ft_model.pth` and config file with the same name as the training config file.
- You still have to specify a reference audio file of the speaker you'd like to use during inference, similar to zero-shot usage.
## TODO📝
- [x] Release code
- [x] Release pretrained models: [](https://huggingface.co/Plachta/Seed-VC)
- [x] Huggingface space demo: [](https://huggingface.co/spaces/Plachta/Seed-VC)
- [x] HTML demo page: [Demo](https://plachtaa.github.io/seed-vc/)
- [x] Streaming inference
- [x] Reduce streaming inference latency
- [x] Demo video for real-time voice conversion
- [x] Singing voice conversion
- [x] Noise resiliency for source audio
- [ ] Potential architecture improvements
- [x] U-ViT style skip connections
- [x] Changed input to OpenAI Whisper
- [x] Time as Token
- [x] Code for training on custom data
- [x] Few-shot/One-shot speaker fine-tuning
- [x] Changed to BigVGAN from NVIDIA for singing voice decoding
- [x] Whisper version model for singing voice conversion
- [x] Objective evaluation and comparison with RVC/SoVITS for singing voice conversion
- [x] Improve audio quality
- [ ] NSF vocoder for better singing voice conversion
- [x] Fix real-time voice conversion artifact while not talking (done by adding a VAD model)
- [x] Colab Notebook for fine-tuning example
- [x] Replace whisper with more advanced linguistic content extractor
- [ ] More to be added
- [x] Add Apple Silicon support
- [ ] Release paper, evaluations and demo page for V2 model
## Known Issues
- On Mac - running `real-time-gui.py` might raise an error `ModuleNotFoundError: No module named '_tkinter'`, in this case a new Python version **with Tkinter support** should be installed. Refer to [This Guide on stack overflow](https://stackoverflow.com/questions/76105218/why-does-tkinter-or-turtle-seem-to-be-missing-or-broken-shouldnt-it-be-part) for explanation of the problem and a detailed fix.
## CHANGELOGS🗒️
- 2024-04-16
- Released V2 model for voice and accent conversion, with better anonymization of source speaker
- 2025-03-03:
- Added Mac M Series (Apple Silicon) support
- 2024-11-26:
- Updated v1.0 tiny version pretrained model, optimized for real-time voice conversion
- Support one-shot/few-shot single/multi speaker fine-tuning
- Support using custom checkpoint for webUI & real-time GUI
- 2024-11-19:
- arXiv paper released
- 2024-10-28:
- Updated fine-tuned 44k singing voice conversion model with better audio quality
- 2024-10-27:
- Added real-time voice conversion GUI
- 2024-10-25:
- Added exhaustive evaluation results and comparisons with RVCv2 for singing voice conversion
- 2024-10-24:
- Updated 44kHz singing voice conversion model, with OpenAI Whisper as speech content input
- 2024-10-07:
- Updated v0.3 pretrained model, changed speech content encoder to OpenAI Whisper
- Added objective evaluation results for v0.3 pretrained model
- 2024-09-22:
- Updated singing voice conversion model to use BigVGAN from NVIDIA, providing large improvement to high-pitched singing voices
- Support chunking and streaming output for long audio files in Web UI
- 2024-09-18:
- Updated f0 conditioned model for singing voice conversion
- 2024-09-14:
- Updated v0.2 pretrained model, with smaller size and less diffusion steps to achieve same quality, and additional ability to control prosody preservation
- Added command line inference script
- Added installation and usage instructions
## Acknowledgements🙏
- [Amphion](https://github.com/open-mmlab/Amphion) for providing computational resources and inspiration!
- [Vevo](https://github.com/open-mmlab/Amphion/tree/main/models/vc/vevo) for theoretical foundation of V2 model
- [MegaTTS3](https://github.com/bytedance/MegaTTS3) for multi-condition CFG inference implemented in V2 model
- [ASTRAL-quantiztion](https://github.com/Plachtaa/ASTRAL-quantization) for the amazing speaker-disentangled speech tokenizer used by V2 model
- [RVC](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI) for foundationing the real-time voice conversion
- [SEED-TTS](https://arxiv.org/abs/2406.02430) for the initial idea
|