Text-to-Speech
VoxCPM
Safetensors
Arabic
English
Hindi
voxcpm2
lora
arabic
arabic-dialects
voice-cloning
Instructions to use VoxCPM-Kernel/VoxCPM2-Arabic-Dialects with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- VoxCPM
How to use VoxCPM-Kernel/VoxCPM2-Arabic-Dialects with VoxCPM:
import soundfile as sf from voxcpm import VoxCPM model = VoxCPM.from_pretrained("VoxCPM-Kernel/VoxCPM2-Arabic-Dialects") 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
|
Download README.md from VoxCPM-Kernel/VoxCPM2-Arabic-Dialects: direct link, hf CLI and curl.
- Browser
- Download file 4.8 kB
-
https://huggingface.co/VoxCPM-Kernel/VoxCPM2-Arabic-Dialects/resolve/main/README.md
- Command line
-
hf download hf://VoxCPM-Kernel/VoxCPM2-Arabic-Dialects/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/VoxCPM-Kernel/VoxCPM2-Arabic-Dialects/resolve/main/README.md
4.8 kB
| license: apache-2.0 | |
| library_name: voxcpm | |
| pipeline_tag: text-to-speech | |
| base_model: openbmb/VoxCPM2 | |
| language: | |
| - ar | |
| - en | |
| - hi | |
| tags: | |
| - text-to-speech | |
| - voxcpm2 | |
| - lora | |
| - arabic | |
| - arabic-dialects | |
| - voice-cloning | |
| # VoxCPM2 Arabic Dialects | |
| [VoxCPM2](https://huggingface.co/openbmb/VoxCPM2) with 11 LoRA adapters, one per dialect. A server keeps every | |
| adapter loaded and picks one per request, so one batch can mix dialects. Use it for fast voice cloning in these | |
| dialects; for one model that covers 17 dialects, see | |
| [Teacher-v3](https://huggingface.co/VoxCPM-Kernel/VoxCPM2-Arabic-Teacher-v3). | |
| ## At a glance | |
| | | | | |
| |---|---| | |
| | Base model | `openbmb/VoxCPM2` (2B parameters, 48 kHz), weights unchanged | | |
| | Trained | 11 LoRA adapters: rank 64, alpha 128, on the attention (q/k/v/o) of the language models and the LocDiT | | |
| | Dialects | 10 Arabic adapters + Hindi-English (table below) | | |
| | Size | 6.55 GB: base 4.96 GB + 145 MB per adapter | | |
| | License | Apache-2.0 | | |
| | Best for | Serving many dialects at once with the [Turbo engine](https://github.com/Speech-Next/voxcpm2-arabic-dialects-turbo) | | |
| | Fast-mode LocDiT | [VoxCPM2-Arabic-Dialects-Distilled-DiT](https://huggingface.co/VoxCPM-Kernel/VoxCPM2-Arabic-Dialects-Distilled-DiT): 2 steps, distilled from these adapters (the engine's default) | | |
| ## Adapters | |
| | adapter | dialect | training step | | |
| |---|---|---:| | |
| | `ab` | Jordanian (a second Jordanian adapter; its weights differ from `jordanian`) | 67,500 | | |
| | `egyptian` | Egyptian | 49,000 | | |
| | `emirati` | Emirati | 96,000 | | |
| | `hejazi` | Hejazi | 72,000 | | |
| | `hindi_english` | Hindi-English code-switched | 40,500 | | |
| | `iraqi` | Iraqi | 28,000 | | |
| | `jordanian` | Jordanian | 149,000 | | |
| | `najdi` | Najdi | 77,500 | | |
| | `palestinian` | Palestinian | 76,500 | | |
| | `qatari` | Qatari | 53,000 | | |
| | `saudi` | Saudi | 78,000 | | |
| ## Files | |
| | path | what it is | | |
| |---|---| | |
| | `model.safetensors`, `audiovae.pth`, `config.json`, tokenizer files | the base VoxCPM2 checkpoint, same weights as `openbmb/VoxCPM2` | | |
| | `adapters/<name>/` | one dialect's LoRA: `lora_weights.safetensors` (fp32) and `lora_config.json` | | |
| | `adapters.json` | index of the adapters: path, description, training step | | |
| ## Results | |
| One NVIDIA A10 with the Turbo engine, cloning the 32 voices of | |
| [`VoxCPM-Kernel/Arabic-Hindi-Reference-Voices`](https://huggingface.co/datasets/VoxCPM-Kernel/Arabic-Hindi-Reference-Voices), | |
| each with its own dialect's adapter. | |
| | requests at once | first audio, avg | first audio, p95 | whole sentence, avg | | |
| |---:|---:|---:|---:| | |
| | 1 | 23 ms | 24 ms | 0.35 s | | |
| | 16 | 26 ms | 27 ms | 0.49 s | | |
| | 64 | 40 ms | 48 ms | 0.88 s | | |
| | 128 | 60 ms | 60 ms | 1.37 s | | |
| | 200 | 92 ms | 92 ms | 1.94 s | | |
| | 256 | 115 ms | 117 ms | 2.39 s | | |
| | mode | LocDiT steps | first audio p95, 200 requests | CER | WER | UTMOS | | |
| |---|---|---:|---:|---:|---:| | |
| | fast (default) | 2, distilled for these adapters | 92 ms | 5.3 % | 16.1 % | 2.14 | | |
| | quality (`dit=None`) | 10, with CFG | 270 ms | 5.3 % | 15.5 % | 2.40 | | |
| - **First audio:** time until the first audio chunk is ready. **CER / WER:** character / word error rate of a speech | |
| recognizer's transcript (better of Whisper large-v3 and Cohere Transcribe Arabic); lower is better. | |
| - **UTMOS:** predicted naturalness, 1-5; higher is better. | |
| - **Quality columns:** a held-out evaluation set, 17 dialects ร 40 sentences ร 2 seeds (1,320 clips), each voice cloned | |
| from another clip of its speaker, int8. Per dialect, and Hindi-English: the | |
| [distilled LocDiT's card](https://huggingface.co/VoxCPM-Kernel/VoxCPM2-Arabic-Dialects-Distilled-DiT). | |
| ## Usage | |
| Install the [Turbo engine](https://github.com/Speech-Next/voxcpm2-arabic-dialects-turbo) (`./setup.sh`), then: | |
| ```python | |
| import asyncio | |
| from nanovllm_voxcpm import DialectTTS | |
| async def main(): | |
| tts = await DialectTTS.load("VoxCPM-Kernel/VoxCPM2-Arabic-Dialects") # fast mode: the 2-step Arabic LocDiT | |
| await tts.add_voice("ahmed", "ahmed.wav") | |
| audio = await tts.synthesize("ููุง ูุงูููุ ููู ุญุงูู ุงูููู ุ", dialect="najdi", voice="ahmed") # 48 kHz | |
| await tts.close() | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |
| ``` | |
| HTTP server (every adapter is registered; a request picks one with `"dialect"`): | |
| ```bash | |
| python -m nanovllm_voxcpm.entrypoints.openai_server --model VoxCPM-Kernel/VoxCPM2-Arabic-Dialects \ | |
| --dit VoxCPM-Kernel/VoxCPM2-Arabic-Dialects-Distilled-DiT:student_k2_dmd.pt --port 8092 | |
| curl localhost:8092/v1/audio/speech -H 'Content-Type: application/json' \ | |
| -d '{"input": "ููุง ูุงูููุ ููู ุญุงูู ุงูููู ุ", "dialect": "saudi", "response_format": "wav"}' > out.wav | |
| ``` | |
| ## Training data and license | |
| The adapters are reorganised from an earlier upload; their training data is not documented here. | |
| License: Apache-2.0, like the base model VoxCPM2. | |