File size: 16,228 Bytes
5176832 c8cc470 5176832 | 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 | ---
base_model: ASLP-lab/MeanVC
base_model_relation: quantized
license: other
license_name: apache-2.0-and-cc-by-sa-3.0
license_link: https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/NOTICE
pipeline_tag: audio-to-audio
library_name: onnx
tags:
- onnx
- moonbox
- onnxruntime
- meanvc
- voice-conversion
- zero-shot
- streaming
- wavlm
- multilingual
---
# MeanVC ONNX
ONNX builds of [MeanVC](https://huggingface.co/ASLP-lab/MeanVC), made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each
precision is one folder holding the graphs and a small Python `pipeline.py` that does the rest (features,
resampling, the conversion steps); what the graphs take and return is under *How to run*.
## Files
The last column is the benchmark on Moonbox's voice-conversion set (English LibriSpeech and Chinese AISHELL-1
recordings, each converted into an English and a Chinese target voice; details under *How to run*): error rate of a
Whisper transcript of the output against the source's transcript, speaker similarity to the target voice and DNSMOS,
against the original PyTorch model.
| Precision | File | Size | sha256 | Benchmark |
|---|---|---|---|---|
| fp16 | [`fp16/content.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/fp16/content.onnx) | 43.2 MB | `d291e11b3eee` | WER 13.7 % / CER 6.3 % (original 14.2 / 8.3, CPU), similarity 0.749 / 0.700 (0.757 / 0.704), DNSMOS 3.19 / 3.21 (3.17 / 3.14); RTF 0.18 (CUDA) |
| fp16 | [`fp16/dit.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/fp16/dit.onnx) | 28.6 MB | `4c5cad95f449` | (the same build: numbers in its first row) |
| fp16 | [`fp16/mel_basis.npy`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/fp16/mel_basis.npy) | 0.2 MB | `50f72dcd637c` | (the same build: numbers in its first row) |
| fp16 | [`fp16/pipeline.py`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/fp16/pipeline.py) | 9.0 kB | `d7615e80b1e2` | (the same build: numbers in its first row) |
| fp16 | [`fp16/speaker.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/fp16/speaker.onnx) | 648.9 MB | `7e7f09d71188` | (the same build: numbers in its first row) |
| fp16 | [`fp16/vocoder.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/fp16/vocoder.onnx) | 16.6 MB | `72d4def75902` | (the same build: numbers in its first row) |
| int8 | [`int8/content.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/int8/content.onnx) | 26.0 MB | `cc73300066f3` | WER 13.2 % / CER 6.3 %, similarity 0.752 / 0.707, DNSMOS 3.11 / 3.20; RTF 0.17 (CUDA) |
| int8 | [`int8/dit.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/int8/dit.onnx) | 14.7 MB | `15f2c6c1fba1` | (the same build: numbers in its first row) |
| int8 | [`int8/mel_basis.npy`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/int8/mel_basis.npy) | 0.2 MB | `50f72dcd637c` | (the same build: numbers in its first row) |
| int8 | [`int8/pipeline.py`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/int8/pipeline.py) | 9.0 kB | `d7615e80b1e2` | (the same build: numbers in its first row) |
| int8 | [`int8/speaker.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/int8/speaker.onnx) | 352.6 MB | `24764e4095c9` | (the same build: numbers in its first row) |
| int8 | [`int8/vocoder.onnx`](https://huggingface.co/moonbox-dev/MeanVC-ONNX/blob/main/int8/vocoder.onnx) | 8.5 MB | `8f1153cee321` | (the same build: numbers in its first row) |
## How to run
MeanVC (ASLP-lab: lightweight streaming zero-shot voice conversion with mean flows; re-voices a recording into the
voice of a few seconds of reference audio, keeping its words and timing; 16 kHz output) as four ONNX graphs plus
`pipeline.py`, a numpy runtime that reproduces the official offline conversion (`src/infer/infer_ref.py` as
`scripts/infer_ref.sh` runs it: the 200 ms model, 20-frame chunks, 2 mean-flow steps) around them. Its successor is
MeanVC2 (moonbox-dev/MeanVC2-ONNX).
- `content.onnx`: one streaming step of the FastU2++ content encoder (the official TorchScript `fastu2++.pt`, a wenet
Conformer with 7 layers; rebuilt as plain modules for the export, since its scripted `forward_encoder_chunk` does
not export): 80-bin Kaldi fbank window `fbank` [1, W, 80] (23 frames, the last one shorter), `offset` [] int64,
`att_cache` [7, 4, C, 128] (C = 0 on the first step, then up to 10), `cnn_cache` [7, 1, 256, 8] -> content features
`bn` [1, (W - 3) / 4, 256] and the next caches.
- `speaker.onnx`: WavLM-Large + ECAPA-TDNN (Microsoft UniSpeech's speaker-verification model, the one the official
code loads): 16 kHz `wave` [1, N] -> speaker embedding `emb` [1, 256]. The same graph as MeanVC2's.
- `dit.onnx`: one mean-flow step of the chunked DiT (with its timbre encoder over the reference mel): `x`, `cond`
[1, n, 80 / 256] (a 20-frame chunk), `t`, `r` [1], `cache` [1, m, 80] (the previous chunk's output; m = 0 first),
`spk` [1, 256], `prompt` [1, NT, 80] (the reference's mel spectrogram), `offset` [] int64, `k_cache`, `v_cache`
[4, 1, 2, P, 64] -> velocity `u` [1, n, 80] and the next caches [4, 1, 2, P + m, 64]; the pipeline keeps the last 100
frames, as the official script does.
- `vocoder.onnx`: Vocos (the official TorchScript `vocos.pt`) up to the spectrum: mel `mel` [1, 80, T] -> `real`,
`imag` [1, 321, T]; the inverse STFT (640-point, hop 160) runs in numpy.
`pipeline.py` does the rest in numpy: resampling to 16 kHz (soxr), the Kaldi fbank, the reference's mel spectrogram
(`mel_basis.npy`), the content features' 4x linear upsampling to the 100 Hz mel rate, the chunk loop with its caches,
the two flow steps (t = 1, 0.8, 0) and the inverse STFT. Each chunk's starting noise comes from numpy's generator, so
a seed gives the same output every run here (not the same as PyTorch with that seed). The official real-time runner
(`src/runtime/run_rt.py`, microphone streaming) is not included. It needs numpy, onnxruntime (or onnxruntime-gpu),
soundfile and soxr:
```bash
python int8/pipeline.py source.wav voice.wav out.wav --cuda --seed 0
```
```python
import sys, soundfile as sf
sys.path.insert(0, "int8")
import pipeline
vc = pipeline.MeanVC("int8", "cuda") # or "cpu"
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=2, seed=0) # 16 kHz
```
**Precisions.** `fp16/` (0.74 GB): every graph fp16 math with fp32 inputs and outputs. `int8/` (0.40 GB):
weight-only int8 (per-output-channel, behind DequantizeLinear) for every graph. Both pass the benchmark below. No
int4 or bf16 build.
**Benchmark.** The lab's voice-conversion set: 4 English recordings (LibriSpeech test-clean) and 2 Chinese ones
(AISHELL-1 test), each converted into the English (LibriSpeech) and the Chinese (AISHELL-1) voice of the lab's TTS
prompts: 12 conversions. Each output is judged by Whisper large-v3-turbo's WER (English sources) or CER (Chinese)
against the source's transcript, WavLM-base-plus-sv speaker similarity to the target voice, and DNSMOS (P.835
overall). The original is the official code (MeanVC @fe5286a, `infer_ref.py` with the 200 ms model, `--chunk-size 20
--steps 2`) on the CPU, its only device, given the same starting noise. Pass, per source language: error rate at most
2 points above the original's, similarity at most 0.03 below, DNSMOS at most 0.2 below. Real-time factor (processing
time / audio time) of the whole pipeline on an RTX 3080 Laptop GPU (the original: on the CPU).
| | English WER | similarity | DNSMOS | Chinese CER | similarity | DNSMOS | Real-time factor |
|---|---|---|---|---|---|---|---|
| original (PyTorch, CPU) | 14.2 % | 0.757 | 3.17 | 8.3 % | 0.704 | 3.14 | 0.40 |
| `fp16/` (CUDA) | 13.7 % | 0.749 | 3.19 | 6.3 % | 0.700 | 3.21 | 0.18 |
| `int8/` (CUDA) | 13.2 % | 0.752 | 3.11 | 6.3 % | 0.707 | 3.20 | 0.17 |
The original itself loses words on this set (English WER 14 %) and its speaker similarity is well below MeanVC2's
(0.93 / 0.91 on the same set): MeanVC2 is the better model. The Chinese set is small (two 4 s AISHELL-1 sources: 4
clips, about 48 characters, so one character is about 2 points). The graphs match the PyTorch modules to 1e-5 (the
content encoder step by step through a real recording, against the official scripted encoder), and the fp32 graphs
reproduce the original's output to 19 dB SNR on average on CUDA given the same noise; in the fp16 and int8 builds the
outputs are not close sample by sample: each chunk's output and KV cache feed the next, so small numeric differences
grow into a different waveform with the same words and voice.
**License.** MeanVC (the DiT checkpoint, the FastU2++ content encoder and the Vocos vocoder from ASLP-lab/MeanVC, code
github.com/ASLP-lab/MeanVC) is Apache-2.0. `speaker.onnx` is a derivative of Microsoft UniSpeech's WavLM-Large
speaker-verification checkpoint (`wavlm_large_finetune.pth`, github.com/microsoft/UniSpeech,
downstreams/speaker_verification), which is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported
(`LICENSE.CC-BY-SA-3.0`): `speaker.onnx` is distributed under CC BY-SA 3.0, so adaptations of it must carry the same
licence and credit Microsoft. Its WavLM-Large backbone comes from Microsoft's WavLM (github.com/microsoft/unilm, MIT,
`LICENSE.MIT-WavLM`). `NOTICE` lists the changes. The original authors ask that voices be converted only with the
consent of the people whose voices are used, and not for impersonation, fraud or misleading audio.
**Sources.** ASLP-lab/MeanVC at revision 2e2a116 (`model_200ms.safetensors`, read with safetensors; code
github.com/ASLP-lab/MeanVC @fe5286a). `fastu2++.pt` and `vocos.pt` are TorchScript archives and were read with
`torch.jit.load` (there is no weights-only loader for TorchScript). The speaker encoder's weights are
`wavlm_large_finetune.pth`, the Google Drive file the official README links (id 1-aE1NfzpRCLxA4GUxX9ITI3F9LlbtEGP,
sha256 `51f07e3b94d9e0262a6a675ef5a087be3dd09e8c62e9d886827f44f82fe7f94b`, 1,301,926,579 bytes; the same bytes as its
Hub mirror bezzam/wavlm_large_finetune_seed_tts_eval), read with `torch.load(weights_only=True)`. It holds every WavLM
and ECAPA weight; WavLM-Large's configuration was read from s3prl/converted_ckpts `wavlm_large.pt` (revision 8cad0b3,
the file the official code's `torch.hub.load('s3prl/s3prl', 'wavlm_large')` downloads; the hub call itself was not
run, s3prl's packaged loader read the file with `weights_only=True`).
## How these were made
From [MeanVC](https://huggingface.co/ASLP-lab/MeanVC) at revision `2e2a116d1b`. The graphs were exported from the original PyTorch modules with
torch.onnx (opset 17 / 18) and checked against them. Weight-only quantization: int8 is a per-output-channel int8
weight behind DequantizeLinear, int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision every graph uses. Every precision was
benchmarked against the original before upload (pass, per language: error rate at most 2 points above the
original's, similarity to the target voice at most 0.03 below, DNSMOS at most 0.2 below), and the `sha256` column above is what
the files must hash to.
## License
Apache-2.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
# MeanVC: Lightweight and Streaming Zero-Shot Voice Conversion via Mean Flows
<div align="center">
[](https://arxiv.org/pdf/2510.08392)
[](https://github.com/ASLP-lab/MeanVC)
[](https://aslp-lab.github.io/MeanVC/)
</div>
**MeanVC** is a lightweight and streaming zero-shot voice conversion system that enables real-time timbre transfer from any source speaker to any target speaker while preserving linguistic content. The system introduces a diffusion transformer with a chunk-wise autoregressive denoising strategy and mean flows for efficient single-step inference.

## β¨ Key Features
- **π Streaming Inference**: Real-time voice conversion with chunk-wise processing.
- **β‘ Single-Step Generation**: Direct mapping from start to endpoint via mean flows for fast generation.
- **π― Zero-Shot Capability**: Convert to any unseen target speaker without re-training.
- **πΎ Lightweight**: Significantly fewer parameters than existing methods.
- **π High Fidelity**: Superior speech quality and speaker similarity.
## π» Sample Usage
### 1. Environment Setup
First, follow these steps to clone the repository and install the required environment.
```bash
# Clone the repository and enter the directory
git clone https://github.com/ASLP-lab/MeanVC.git
cd MeanVC
# Create and activate a Conda environment
conda create -n meanvc python=3.11 -y
conda activate meanvc
# Install dependencies
pip install -r requirements.txt
```
### 2. Download Pre-trained Models
Run the provided script to automatically download all necessary pre-trained models.
```bash
python download_ckpt.py
```
This will download the main VC model, vocoder, and ASR model into the `src/ckpt/` directories.
The speaker verification model (`wavlm_large_finetune.pth`) must be downloaded manually from Google Drive. Download the file from [this link](https://drive.google.com/file/d/1-aE1NfzpRCLxA4GUxX9ITI3F9LlbtEGP/view). Place the downloaded `wavlm_large_finetune.pth` file into the `src/runtime/speaker_verification/ckpt/` directory.
### 3. Real-Time Voice Conversion
This script captures audio from your microphone and converts it in real-time to the voice of a target speaker.
```bash
python src/runtime/run_rt.py --target-path "path/to/target_voice.wav"
```
- `--target-path`: Path to a clean audio file of the target speaker. This voice will be used as the conversion target. An example file is provided at `src/runtime/example/test.wav`.
When you run the script, you will be prompted to select your audio input (microphone) and output (speaker) devices from a list.
### 4. Offline Voice Conversion
For batch processing or converting pre-recorded audio files, use the offline conversion script.
```bash
bash scripts/infer_ref.sh
```
Before running the script, you need to configure the following paths in `scripts/infer_ref.sh`:
- `source_path`: Path to the source audio file or directory containing multiple audio files to be converted
- `reference_path`: Path to a clean audio file of the target speaker (used as voice reference)
- `output_dir`: Directory where converted audio files will be saved (default: `src/outputs`)
- `steps`: Number of denoising steps (default: 2)
## π License & Disclaimer
MeanVC is released under the Apache License 2.0. This open-source license allows you to freely use, modify, and distribute the model, as long as you include the appropriate copyright notice and disclaimer.
MeanVC is designed for research and legitimate applications in voice conversion technology. Users must obtain proper consent from individuals whose voices are being converted or used as references. We strongly discourage any malicious use including impersonation, fraud, or creating misleading audio content. Users are solely responsible for ensuring their use cases comply with ethical standards and legal requirements.
## π Citation
If you find our work helpful, please cite our paper:
```bibtex
@article{ma2025meanvc,
title={MeanVC: Lightweight and Streaming Zero-Shot Voice Conversion via Mean Flows},
author={Ma, Guobin and Yao, Jixun and Ning, Ziqian and Jiang, Yuepeng and Xiong, Lingxin and Xie, Lei and Zhu, Pengcheng},
journal={arXiv preprint arXiv:2510.08392},
year={2025}
}
```
## π§ Contact
If you are interested in leaving a message to our research team, feel free to email guobin.ma@mail.nwpu.edu.cn
<p align="center">
<img src="https://huggingface.co/ASLP-lab/MeanVC/resolve/main/figs/npu@aslp.jpeg" width="500"/>
</p>
|