Instructions to use openbmb/VoxCPM2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- VoxCPM
How to use openbmb/VoxCPM2 with VoxCPM:
import soundfile as sf from voxcpm import VoxCPM model = VoxCPM.from_pretrained("openbmb/VoxCPM2") wav = model.generate( text="VoxCPM is an innovative end-to-end TTS model from ModelBest, designed to generate highly expressive speech.", prompt_wav_path=None, # optional: path to a prompt speech for voice cloning prompt_text=None, # optional: reference text cfg_value=2.0, # LM guidance on LocDiT, higher for better adherence to the prompt, but maybe worse inference_timesteps=10, # LocDiT inference timesteps, higher for better result, lower for fast speed normalize=True, # enable external TN tool denoise=True, # enable external Denoise tool retry_badcase=True, # enable retrying mode for some bad cases (unstoppable) retry_badcase_max_times=3, # maximum retrying times retry_badcase_ratio_threshold=6.0, # maximum length restriction for bad case detection (simple but effective), it could be adjusted for slow pace speech ) sf.write("output.wav", wav, 16000) print("saved: output.wav") - Notebooks
- Google Colab
- Kaggle
Commit History
-
fix: use hasattr for BatchEncoding compatibility
Verified signaturea9d2a4d -
feat: point AutoTokenizer to VoxCPM2Tokenizer via auto_map
Verified signature513c9ed -
feat: add custom tokenizer with multi-char Chinese token splitting
Verified signatureVoxCPM2 was trained with `mask_multichar_chinese_tokens` which splits multi-character Chinese tokens (e.g. "你好" → ["你", "好"]) into individual character IDs. The current HF repo ships a plain LlamaTokenizerFast without this splitting, causing downstream inference frameworks (vLLM-Omni, etc.) to produce garbled Chinese audio. This PR adds `VoxCPM2Tokenizer` (subclass of LlamaTokenizerFast) that applies char-splitting inside `encode()` and `__call__()` transparently. Note: `tokenizer_config.json` also needs `auto_map` and `tokenizer_class` updates to point to this custom tokenizer. Will add in a follow-up commit to this PR.3690391
-
Update README.md
Verified signature2b5660c
-
Update README.md
Verified signaturee8b9280
-
Update README.md
Verified signaturec2a4b03 -
Update README.md
Verified signature4a2dd51 -
update
Verified signature07f4cde
-
init
Verified signature9454c2d -
initial commit
Verified signature34ee490