MeanVC2 ONNX

ONNX builds of MeanVC2, 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
int8 int8/content_160ms.onnx 75.8 MB b0fbc32e871e content fp32, rest int8. 120ms: WER 3.2 % / CER 22.9 % (original 3.2 / 22.9, CPU), similarity 0.929 / 0.914 (0.929 / 0.906), DNSMOS 3.36 / 3.26 (3.34 / 3.26), RTF 0.32 (CUDA). 40ms: WER 4.2 % / CER 10.4 % (4.2 / 10.4), similarity 0.922 / 0.886 (0.921 / 0.879), DNSMOS 3.03 / 3.06 (3.10 / 3.09), RTF 0.89 (CUDA)
int8 int8/content_80ms.onnx 75.8 MB 74466705219e (the same build: numbers in its first row)
int8 int8/dit_120ms.onnx 18.4 MB 1d2bb292220a (the same build: numbers in its first row)
int8 int8/dit_40ms.onnx 18.4 MB ae5ecb1c244f (the same build: numbers in its first row)
int8 int8/pipeline.py 8.6 kB a17bfee18db7 (the same build: numbers in its first row)
int8 int8/speaker.onnx 352.6 MB 24764e4095c9 (the same build: numbers in its first row)
int8 int8/vocoder.onnx 8.5 MB 8f1153cee321 (the same build: numbers in its first row)

How to run

MeanVC2 (ASLP-lab: streaming zero-shot voice conversion; re-voices a recording into the voice of a few seconds of reference audio, keeping its words and timing; 16 kHz output) as six ONNX graphs plus pipeline.py, a numpy runtime that reproduces the official end-to-end conversion (src/infer/infer_e2e.py: 3 mean-flow steps per chunk) around them, for both of the official presets: 120ms (120 ms chunks + 40 ms look-ahead, the official recommendation for quality) and 40ms (40 ms chunks + 40 ms look-ahead, lower latency).

  • content_160ms.onnx / content_80ms.onnx: one streaming step of the FastU2++ content encoder (the official TorchScript fastu2pp_160ms.pt / fastu2pp_80ms.pt): 80-bin Kaldi fbank window fbank [1, 19, 80] ([1, 11, 80]), offset [] int64, att_cache [6, 4, 8, 128] ([6, 4, 4, 128]), cnn_cache [6, 1, 256, 8] -> content features bn [1, 4, 256] ([1, 2, 256]) and the next caches. The pipeline starts from zero caches and steps 16 (8) fbank frames at a time, as the official script does.
  • 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].
  • dit_120ms.onnx / dit_40ms.onnx: one mean-flow step of the chunked DiT (18M parameters, with its timbre memory): x, cond [1, L, 80 / 256] (a chunk and its look-ahead frames), t, r [1], spk [1, 256], offset [] int64, k_cache, v_cache [4, 1, 2, P, 64] -> velocity u [1, L, 80] and the next caches [4, 1, 2, P + L - 4, 64] (the look-ahead frames are not cached).
  • 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 content features' 4x linear upsampling to the 100 Hz mel rate, the chunk loop with its KV cache, the three flow steps (t = 1, 2/3, 1/3, 0) and the inverse STFT. The flow'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). It converts whole files; the official real-time runner (runtime/run_rt.py: microphone streaming with 2 flow steps and a cross-faded chunked vocoder) is not included, but the graphs are the same step functions it calls. It needs numpy, onnxruntime (or onnxruntime-gpu), soundfile and soxr:

python int8/pipeline.py source.wav voice.wav out.wav --preset 120ms --cuda --seed 0
import sys, soundfile as sf
sys.path.insert(0, "int8")
import pipeline
vc = pipeline.MeanVC2("int8", "120ms", "cuda")       # or "40ms"; "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=3, seed=0)    # 16 kHz

Precision. int8/ (0.55 GB): weight-only int8 (per-output-channel, behind DequantizeLinear) for the speaker encoder, both DiTs and the vocoder; the two content encoders stay fp32, because int8 content weights cost 3 characters of Chinese CER on the 120ms preset (29.2 % against the original's 22.9 %). Both presets use the same folder. No fp16 build: fp16 passes the 120ms preset (WER 3.2 % / CER 22.9 %, similarity 0.933 / 0.903, DNSMOS 3.29 / 3.29) but misses the 40ms preset's Chinese error rate by one character (12.5 % against 10.4 %, with or without fp32 content encoders). 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 per preset. 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 (MeanVC2 @13acf84, infer_e2e.py with --steps 3) on the CPU, its default 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
120ms original (PyTorch, CPU) 3.2 % 0.929 3.34 22.9 % 0.906 3.26 0.79
120ms int8/ (CUDA) 3.2 % 0.929 3.36 22.9 % 0.914 3.26 0.32
40ms original (PyTorch, CPU) 4.2 % 0.921 3.10 10.4 % 0.879 3.09 1.65
40ms int8/ (CUDA) 4.2 % 0.922 3.03 10.4 % 0.886 3.06 0.89

The Chinese set is small (two 4 s AISHELL-1 sources: 4 clips, about 48 characters, so one character is about 2 points), and the 120ms original itself loses about a fifth of the Chinese characters. The 40ms preset makes three DiT calls per 40 ms chunk: on a GPU its speed is bound by call overhead, not arithmetic. The fp32 graphs match the PyTorch modules to 1e-5 on test inputs, and on the CPU they reproduce the original's output to 66 dB SNR on average (34 dB worst clip) given the same noise. On CUDA, and in the int8 build, the outputs are not close sample by sample: each chunk's KV cache feeds the next, so small numeric differences grow into a different waveform with the same words and voice.

License. MeanVC2 (the DiT checkpoints, the FastU2++ content encoders and the Vocos vocoder from ASLP-lab/MeanVC2) 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/MeanVC2 at revision 39cdd19 (code github.com/ASLP-lab/MeanVC2 @13acf84). fastu2pp_*.pt and vocos.pt are TorchScript archives and were read with torch.jit.load (there is no weights-only loader for TorchScript); every other checkpoint was read with torch.load(weights_only=True) or safetensors. The speaker encoder's weights are wavlm_large_finetune.pth from bezzam/wavlm_large_finetune_seed_tts_eval (revision f127f69, a byte-for-byte mirror of the Google Drive file that the official initialization.py links; sha256 51f07e3b94d9e0262a6a675ef5a087be3dd09e8c62e9d886827f44f82fe7f94b, 1,301,926,579 bytes; downloaded from Google Drive as well on 2026-11-30, identical bytes). It holds every WavLM and ECAPA weight; WavLM-Large's configuration was read from s3prl/converted_ckpts wavlm_large.pt (revision 8cad0b3, sha256 6fb4b3c3e6aa…, the file UniSpeech's code loads through s3prl's hub; the official initialization.py points at a GitHub release URL that no longer exists).

How these were made

From MeanVC2 at revision 39cdd19522. 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

MeanVC2: Robust Low-Latency Streaming Zero-Shot Voice Conversion

Paper Github Demo Page

MeanVC2 is a robust, low-latency streaming zero-shot voice conversion (VC) system built upon the diffusion-based conditional flow matching (CFM) framework. By introducing Future-Receptive Chunking (FRC) and a Universal Timbre Token Encoder (UTTE), MeanVC2 achieves high-fidelity voice conversion with an end-to-end pipeline latency of only 110 ms while maintaining superior speaker similarity and audio naturalness even with a 40 ms chunk size.

img

✨ Key Features

  • πŸš€ Ultra-Low Latency Streaming: 110 ms end-to-end first-packet latency with 40 ms chunk size; full pipeline RTF < 0.633 on single CPU core.
  • ⚑ Single-Step Generation: Mean flows + 1-NFE ODE solving for high-quality mel-spectrogram synthesis.
  • 🎯 Zero-Shot Capability: Convert to any unseen target speaker without re-training, robust under low-quality reference audio.
  • πŸ’Ύ Lightweight: Only 18M parameters β€” far smaller than competing streaming VC systems.
  • πŸ”Š High Fidelity: Future-Receptive Chunking (FRC) with Universal Timbre Token Encoder (UTTE) for pronunciation-aware timbre modeling.

πŸ“ Model Checkpoints

This repository hosts all pretrained models for MeanVC2:

Voice Conversion Models

File Description
meanvc2_120ms_40ms.safetensors 120ms chunk + 40ms future (recommended for quality)
meanvc2_40ms_40ms.safetensors 40ms chunk + 40ms future (lower latency)

Vocoder (JIT)

File Description
vocos.pt Vocos JIT-traced vocoder

ASR Encoder (Fast-U2++ JIT)

File Description
fastu2pp_80ms.pt 80ms chunk JIT model (11-frame window, stride=8)
fastu2pp_160ms.pt 160ms chunk JIT model (19-frame window, stride=16)

πŸ’» Quick Start

1. Clone and Install

git clone https://github.com/ASLP-lab/MeanVC2.git
cd MeanVC2

conda create -n meanvc2 python=3.11 -y
conda activate meanvc2

pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt

2. Download Pretrained Models

python initialization.py --task all

Or download selectively:

python initialization.py --task preprocess   # BN + SpkEmb extraction only
python initialization.py --task train_120ms  # preprocess + 120ms VC + vocoder
python initialization.py --task train_40ms   # preprocess + 40ms VC + vocoder

3. End-to-End Voice Conversion

No pre-extracted features needed β€” input two wavs, output converted audio:

# 120ms+40ms model (recommended for quality)
python src/infer/infer_e2e.py \
    --source-wav /path/to/source.wav \
    --target-wav /path/to/target.wav \
    --ckpt-path ckpts/pretrained_models/meanvc2_120ms_40ms.safetensors \
    --model-config src/config/config_120ms_40ms.json \
    --vocoder-ckpt-path ckpts/vocos/vocos.pt \
    --chunk-size 12 --steps 3 \
    --output-wav output.wav

# 40ms+40ms model (lower latency)
python src/infer/infer_e2e.py \
    --source-wav /path/to/source.wav \
    --target-wav /path/to/target.wav \
    --ckpt-path ckpts/pretrained_models/meanvc2_40ms_40ms.safetensors \
    --model-config src/config/config_40ms_40ms.json \
    --vocoder-ckpt-path ckpts/vocos/vocos.pt \
    --chunk-size 4 --steps 3 \
    --output-wav output.wav

4. Real-Time Streaming

cd runtime

# File mode
python run_rt.py --mode file --input in.wav --output out.wav --model 120ms

# Microphone mode
python run_rt.py --mode realtime --model 40ms

πŸ—οΈ Model Architecture

Component Description
Streaming ASR Encoder Fast-U2++ (WeNet) extracts bottleneck features (BNFs) from source waveform
Speaker Encoder ECAPA-TDNN + WavLM upstream extracts global speaker embedding from reference audio
Universal Timbre Token Encoder (UTTE) Transforms speaker embedding into K key-value UTT pairs; BNFs serve as queries in cross-attention for fine-grained, pronunciation-aware timbre cues
DiT-based CFM Decoder 4-layer DiT (hidden dim 512, 2 heads) with Future-Receptive Chunking (FRC); trained with mean flows objective for 1-NFE mel-spectrogram generation
Vocoder Vocos converts mel-spectrograms to 16 kHz high-fidelity speech waveforms

Total parameters: ~18M

πŸ“œ License & Disclaimer

MeanVC2 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.

MeanVC2 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 malicious use including impersonation, fraud, or creating misleading audio content. Users are solely responsible for ensuring compliance with ethical standards and legal requirements.

πŸ“„ Citation

If you find our work helpful, please cite:

@article{ma2026meanvc2,
  title={MeanVC2: Robust Low-Latency Streaming Zero-Shot Voice Conversion},
  author={Ma, Guobin and Xia, Yuxuan and Jiang, Yuepeng and Guo, Dake and Xie, Hanke and Hu, Jingbin and Wang, Yanbo and Xie, Lei and Zhu, Pengcheng},
  journal={arXiv preprint arXiv:2606.09050},
  year={2026}
}

πŸ“§ Contact

For questions or collaborations, please contact: guobin.ma@mail.nwpu.edu.cn

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for moonbox-dev/MeanVC2-ONNX

Base model

ASLP-lab/MeanVC2
Quantized
(4)
this model

Paper for moonbox-dev/MeanVC2-ONNX