[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114650":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":14,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":9,"pushedAt":32,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},114650,"VieNeu-TTS","pnnbao97\u002FVieNeu-TTS","pnnbao97","Vietnamese TTS with instant voice cloning • On-device • Real-time CPU inference • 48kHz audio quality • Chuyển văn bản thành giọng nói tiếng Việt • Text to speech tiếng Việt • TTS tiếng Việt ",null,"https:\u002F\u002Fgithub.com\u002Fpnnbao97\u002FVieNeu-TTS","Python",3552,1075,48,18,0,7,153,163,102.09,false,"main",[24,25,26,27,28,29,30,31],"deep-learning","text-to-speech","on-device-ml","real-time","speech-synthesis","tts","vietnamese-language","vietnamese","2026-11-20 16:35:30","2026-11-23 16:19:52","# 🦜 VieNeu-TTS\n\n[![Awesome](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FAwesome-NLP-green?logo=github)](https:\u002F\u002Fgithub.com\u002Fkeon\u002Fawesome-nlp)\n[![Discord](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-Join%20Us-5865F2?logo=discord&logoColor=white)](https:\u002F\u002Fdiscord.gg\u002FyJt8kzjzWZ)\n\n[![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1b9PO-lcGZX9pEkEwQmu8MfhSnjxKrALW?usp=sharing)\n[![Hugging Face VieNeu-TTS-v3-Turbo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-v3--Turbo-red)](https:\u002F\u002Fhuggingface.co\u002Fpnnbao-ump\u002FVieNeu-TTS-v3-Turbo)\n[![Hugging Face VieNeu-TTS-v2](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-v2-blue)](https:\u002F\u002Fhuggingface.co\u002Fpnnbao-ump\u002FVieNeu-TTS-v2)\n[![Hugging Face VieNeu-TTS](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-v1-orange)](https:\u002F\u002Fhuggingface.co\u002Fpnnbao-ump\u002FVieNeu-TTS)\n\n\u003Cimg width=\"1087\" height=\"710\" alt=\"image\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F5534b5db-f30b-4d27-8a35-80f1cf6e5d4d\" \u002F>\n\n**VieNeu-TTS** is the next generation of on-device Vietnamese TTS: **10,000+ hours** of bilingual training, **instant voice cloning**, a dedicated **Podcast\u002FConversation** mode, and **extremely fast** — real-time streaming with first audio in ~115 ms, **RTF ≈ 0.01–0.02** batched on a consumer GPU (RTX 3060), ~2× real-time on a plain CPU ([benchmarks](#benchmarks)).\n\n> [!IMPORTANT]\n> **🦜 VieNeu-TTS v4 — available on [vieneu.io](https:\u002F\u002Fwww.vieneu.io)**\n>\n> VieNeu-TTS v4 delivers **near-original voice cloning fidelity**, allowing a short reference clip to be reproduced with very high speaker similarity.\n>\n> Due to the strength of its voice-cloning capabilities and the potential for misuse, **v4 is proprietary and will not be open-sourced**. It is available exclusively through the **VieNeu API \u002F vieneu.io**.\n>\n> **VieNeu-TTS v3 Turbo remains the latest open-source version available in this repository.** Future open-source releases, including potential v3.x updates, may also be published here.\n\n> [!NOTE]\n> **🦜 VieNeu-TTS v3 Turbo is officially released!**\n> A brand-new architecture **designed and trained from scratch by Phạm Nguyễn Ngọc Bảo** (codec: [MOSS-Audio-Tokenizer-Nano](https:\u002F\u002Fhuggingface.co\u002FOpenMOSS-Team\u002FMOSS-Audio-Tokenizer-Nano); phonemizer: [sea-g2p](https:\u002F\u002Fgithub.com\u002Fpnnbao97\u002Fsea-g2p)):\n> - **48 kHz** high-fidelity audio (up from 24 kHz).\n> - **25 built-in preset voices** (10 editors' picks) — stable and consistent, no reference clip needed.\n> - **Natural reading style** everywhere — the style follows the reference voice (the `style` argument is deprecated and ignored).\n> - **Emotion \u002F non-verbal cues** *(experimental)*: drop `[cười]`, `[thở dài]`, `[hắng giọng]` straight into the text.\n> - **Batched generation** (batch size up to 32), including a multi-speaker **Conversation** mode that batches the whole script regardless of speaker.\n> - **Instant voice cloning** from a 3–8s clip, with automatic reference denoising.\n> - **Real-time streaming + OpenAI-compatible API + Docker** — `POST \u002Fv1\u002Faudio\u002Fspeech` drop-in for the OpenAI SDK \u002F Pipecat \u002F LiveKit; first audio in **~115 ms** and **16 concurrent streams under 200 ms** on a single RTX 3060 (32 max), CPU-only streaming too. See [§3](#docker-remote), [§4 Benchmarks](#benchmarks) and [docs\u002Fstreaming.md](docs\u002Fstreaming.md).\n> - **LoRA fine-tuning** — train your own voice or reading style on one consumer GPU ([§5](#finetune)).\n>\n> Try it in the Web UI (backbone **\"VieNeu-TTS-v3-Turbo\"**) or the SDK (`Vieneu(mode=\"v3turbo\")`, the default).\n\n\u003Ch3>🎬 Demos\u003C\u002Fh3>\n\n> [!TIP]\n> **Dubbing**, **Lecture**, **Tiktok Reel** and **Audiobook** features are exclusively available in the [official VieNeu App](https:\u002F\u002Fwww.vieneu.io\u002F#\u002Fdownload). This GitHub repository only provides a simplified Gradio demo interface and the core SDK for developers.\n\n\u003Ctable>\n  \u003C!-- Hàng 1 -->\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"35%\">\n      \u003Cb>Voice Cloning\u003C\u002Fb>\u003Cbr>\u003Cbr>\n      \u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F021f6671-2d7f-4635-91fb-88b2ab0ddbcd\" controls width=\"100%\">\u003C\u002Fvideo>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"35%\">\n      \u003Cb>Dubbing\u003C\u002Fb>\u003Cbr>\u003Cbr>\n      \u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F5888aea1-4f32-4397-9dd9-9c7b743d31bd\" controls width=\"100%\">\u003C\u002Fvideo>\n    \u003C\u002Ftd>\n    \u003C!-- Cột phải: TikTok Reel chiếm 2 hàng -->\n    \u003Ctd align=\"center\" width=\"30%\" rowspan=\"2\" style=\"vertical-align: middle;\">\n      \u003Cb>Tiktok Reel\u003C\u002Fb>\u003Cbr>\u003Cbr>\n      \u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F561a1c55-a298-4a78-a501-c778c2640013\" controls width=\"100%\">\u003C\u002Fvideo>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003C!-- Hàng 2 -->\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"35%\">\n      \u003Cb>Dubbing \u002F Conversation\u003C\u002Fb>\u003Cbr>\u003Cbr>\n      \u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F28104b78-2d55-4914-85b7-5f425a7e99da\" controls width=\"100%\">\u003C\u002Fvideo>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"35%\">\n      \u003Cb>Lecture\u003C\u002Fb>\u003Cbr>\u003Cbr>\n      \u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fde3b2d4e-4c50-4164-acdc-e3de90840e26\" controls width=\"100%\">\u003C\u002Fvideo>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n## 📌 Table of Contents\n\n1. [🦜 Installation & Web UI](#installation)\n2. [📦 Using the Python SDK](#sdk)\n3. [🐳 API Server & Docker](#docker-remote) — OpenAI-compatible streaming API (v3 Turbo) · legacy v2 server\n4. [📊 Benchmarks](#benchmarks) — every speed \u002F latency number in one place (CPU vs GPU, batch, streaming, Nano)\n5. [🎓 Fine-tuning (LoRA)](#finetune)\n6. [🔬 Model Overview](#backbones)\n7. [🚀 Roadmap](#roadmap)\n8. [🤝 Support & Contact](#support)\n9. [📑 Citation](#citation)\n\n---\n\n## 🦜 1. Installation & Web UI \u003Ca name=\"installation\">\u003C\u002Fa>\n> [!TIP]\n> **On Windows?** The fastest way to get started is the standalone installer at **[vieneu.io\u002F#\u002Fdownload](https:\u002F\u002Fwww.vieneu.io\u002F#\u002Fdownload)** — no need to install `uv` or clone the repo manually.\n> **macOS**: a similar installer is coming in an upcoming release; for now, please use the `uv sync` steps below.\n> **Docker?** Skip the steps below: `--profile api-gpu` \u002F `api-cpu` (OpenAI-compatible streaming API) — see [§3 API Server & Docker](#docker-remote).\n\n### Setup with `uv` (Recommended)\n`uv` is the fastest way to manage dependencies. \n```bash\n# Windows:\npowershell -c \"irm https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.ps1 | iex\"\n\n# Linux\u002FmacOS:\ncurl -LsSf https:\u002F\u002Fastral.sh\u002Fuv\u002Finstall.sh | sh\n```\n\n1. **Clone the Repo:**\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002Fpnnbao97\u002FVieNeu-TTS.git\n   cd VieNeu-TTS\n   ```\n\n2. **Install Dependencies:**\n   > 📊 **Which one?** CPU ≈ **RTF 0.5** (2× real-time, one stream) · GPU ≈ **RTF 0.02** batched (~50× real-time) and **16 real-time streams** — all measurements in [§4 Benchmarks](#benchmarks).\n\n   - **Option 1: CPU & macOS (minimal, torch-free)** — RTF ≈ 0.5, no GPU needed\n\n     ```bash\n     uv sync\n     ```\n   - **Option 2: GPU** — **v3 Turbo on GPU (PyTorch)** — RTF ≈ 0.02 batched, 16 real-time streams\n\n     ```bash\n     uv sync --extra cuda\n     ```\n\n3. **Start the Web UI:**\n   ```bash\n   uv run vieneu-web\n   ```\n   Access the UI at `http:\u002F\u002F127.0.0.1:7860`.\n\n---\n\n\n## 📦 2. Using the Python SDK (vieneu) \u003Ca name=\"sdk\">\u003C\u002Fa>\n\nThe `vieneu` SDK **defaults to VieNeu-TTS v3 Turbo (48 kHz)**. The minimal install is **torch-free**: on CPU everything runs on **ONNX Runtime** (PyTorch is never imported), and on a CUDA machine it auto-switches to the PyTorch engine — where inference is **batched automatically** (same API, no code change).\n\n### Quick Start\n\n**CPU (default)** — torch-free, runs v3 Turbo via ONNX Runtime. Most users want this — **RTF ≈ 0.5** on a 12th-gen Core i5 (numbers in [§4 Benchmarks](#benchmarks)):\n> ⚡**On CPU the backbone runs `fp32` by default** (maximum fidelity). Need more speed? Pass `Vieneu(precision=\"int8\")` — ~1.6× faster (RTF ≈ 0.35) and ~4× smaller, but it requires a CPU with VNNI (AVX-512 VNNI \u002F AVX-VNNI); on older CPUs int8 can produce garbled audio. `precision` only affects the CPU\u002FONNX path; on GPU it's ignored (PyTorch).\n>\n> 🪶 **Still too slow, or deploying on a phone \u002F ARM board?** Try **[VieNeu-TTS v3 Nano (preview)](#v3-nano)** — `Vieneu(mode=\"v3nano\")`, ~3× faster than Turbo fp32 on CPU (RTF 0.11–0.22 on a desktop CPU), but **noticeably lower quality** (especially English \u002F bilingual), 24 kHz, 11 preset voices + voice cloning. Details and caveats in the [v3 Nano section](#v3-nano) below.\n\n```bash\npip install vieneu\n```\n\n**GPU (CUDA)** — only if you have an NVIDIA GPU; **~25× faster than the CPU path** (RTF ≈ 0.02 batched, 16 real-time streams — [§4 Benchmarks](#benchmarks)). On Linux `pip install \"vieneu[cuda]\"` is enough (PyPI torch ships CUDA there); on Windows install the CUDA torch **first** as below.\n> ⚡ Every audio frame on GPU is **one CUDA graph** (acoustic decoder + sampling +\n> repetition penalty + backbone step in a single replay — no `torch.compile`, no\n> C++ toolchain needed). The first call for each batch size pays ~0.5 s to capture\n> the graph (kept afterwards; servers can call `warm_fused()` at start-up).\n> `VIENEU_FUSED_FRAME=0` restores the plain loop.\n\n```bash\npip install torch==2.8.0 torchaudio==2.8.0 --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu128\npip install \"transformers==4.57.6\"   # pinned — most stable transformers for the GPU SDK\npip install vieneu\n```\n\n```python\nimport time\nfrom vieneu import Vieneu\n\n# Default = v3 Turbo (48 kHz). GPU → PyTorch (auto-detected).\nvieneu = Vieneu() # On a GPU machine you can still switch to ONNX\u002FCPU if you prefer: Vieneu(backend=\"onnx\")\n\n# 1. Built-in voice by name — no reference clip needed\nprint(\"🔊 Generating speech...\")\n\nstart_time = time.time()\naudio = vieneu.infer(\"[cười] Trời ơi, cái giọng nó tự nhiên mà nó mượt mà dã man, nghe không khác gì người thật luôn. Giờ thì tha hồ mà quẩy content với cả kho giọng nói đa dạng, đủ mọi sắc thái biểu cảm. Mọi người bật loa lên rồi cùng trải nghiệm thử với mình nhé!\", voice=\"Phạm Tuyên\")\nelapsed_time = time.time() - start_time\n\nvieneu.save(audio, \"output.wav\")\nprint(\"✅ Saved to output.wav\")\n\n# Tính RTF (Real-Time Factor)\nsample_rate = 48000\naudio_duration = len(audio) \u002F sample_rate\nrtf = elapsed_time \u002F audio_duration\n\nprint(f\"\\n⏱️  Thời gian xử lý: {elapsed_time:.3f}s\")\nprint(f\"🎵 Thời lượng audio: {audio_duration:.3f}s\")\nprint(f\"📊 RTF: {rtf:.4f}  ({'nhanh hơn' if rtf \u003C 1 else 'chậm hơn'} real-time {1\u002Frtf:.2f}x)\" if rtf > 0 else \"\")\n\n# List the built-in voices\nvoices = vieneu.list_preset_voices()\nprint(f\"\\n🎙️  {len(voices)} built-in voices available:\")\nfor label, voice_id in voices:\n    print(f\"  - {label} ({voice_id})\")\n\n# 2. ⚡ Batch on GPU: infer_batch() runs many texts in ONE batched forward — same API.\n#    On a CUDA GPU the chunks from every text share each forward step (big throughput\n#    win). On CPU it still WORKS (no error) — just sequentially, so there's no batch\n#    gain. Batch caps at max_batch_size (default 32; tune via Vieneu(max_batch_size=64)\n#    or infer_batch(..., batch_size=64), or batch_size=1 to disable). A single long\n#    infer() also auto-batches its own chunks. For real-time use, infer_stream() is the\n#    streaming twin (GPU: 16 concurrent streams — see \"Streaming\" below). Uncomment to\n#    try (GPU recommended):\n#\n# import time\n# texts = [\n#     \"Chào cả nhà, hôm nay mình sẽ hướng dẫn các bạn cách cài đặt và sử dụng bộ giọng đọc mới.\",\n#     \"Giọng nghe cực kỳ tự nhiên và truyền cảm, lại có thể chuyển đổi biểu cảm một cách linh hoạt.\",\n#     \"Nếu thấy hữu ích, các bạn nhớ để lại một lượt thích và chia sẻ video này cho mọi người nhé!\",\n# ] * 10   # 30 texts — enough to fill the batch and really show the GPU throughput win\n# t0 = time.time()\n# audios = vieneu.infer_batch(texts, voice=\"Hải Đăng\")\n# elapsed = time.time() - t0\n# total_audio = sum(len(a) for a in audios) \u002F 48_000\n# print(f\"⚡ {len(texts)} texts | audio {total_audio:.1f}s | wall {elapsed:.1f}s | RTF {elapsed\u002Ftotal_audio:.3f}\")\n# for i, a in enumerate(audios):\n#     vieneu.save(a, f\"batch_{i}.wav\")\n```\n\n#### Streaming (real-time) 🔊\n\n> v3 Turbo streams **frame by frame** on both backends. **GPU** (PyTorch): first audio in **~115 ms** and **16 concurrent streams** on one RTX 3060 (continuous batching — one CUDA graph serves every `infer_stream` call, each keeping RTF ≈ 0.5–0.6). **CPU** (ONNX): first audio in ~140 ms (int8) \u002F ~300 ms (fp32), one stream (two with int8). Just iterate `infer_stream`:\n\n```python\nfrom vieneu import Vieneu\nvieneu = Vieneu()                                  # GPU → PyTorch + stream scheduler; no GPU → ONNX\u002FCPU\nfor chunk in vieneu.infer_stream(\"Xin chào các bạn!\", voice=\"Mai Anh\"):\n    play(chunk)                                   # np.float32 @ 48 kHz — play\u002Fwrite as it arrives\n```\n\nCalling `infer_stream` from many threads at once is the intended way to serve many listeners on a GPU (`Vieneu(max_streams=16)` sets the ceiling).\n\nAn **OpenAI-compatible streaming API** (`POST \u002Fv1\u002Faudio\u002Fspeech`, `pcm`\u002F`wav`, chunked or SSE — works with the OpenAI SDK, Pipecat, LiveKit, …) is in [`apps\u002Fopenai_speech.py`](apps\u002Fopenai_speech.py):\n\n```bash\n# Pick ONE of these — all serve http:\u002F\u002Flocalhost:8000\u002Fv1\u002Faudio\u002Fspeech\nuv run python -m apps.openai_speech                                  # from the repo (auto-detects GPU\u002FCPU)\ndocker compose -f docker\u002Fdocker-compose.yml --profile api-gpu up     # or: Docker, GPU\ndocker compose -f docker\u002Fdocker-compose.yml --profile api-cpu up     # or: Docker, CPU only\n```\n\n📊 **[docs\u002Fstreaming.md](docs\u002Fstreaming.md)** — every measurement on an RTX 3060 (TTFA \u002F RTF \u002F streams vs `max_streams`), estimates for smaller GPUs, and the CPU numbers. The older browser demo is still at [`apps\u002Fweb_stream.py`](apps\u002Fweb_stream.py).\n\n#### Available Voices\n\nThe v3 Turbo engine includes **25 preset voices** covering **3 regions** (North, Central, South) with diverse genders and speaking characters. `list_preset_voices()` (and the Web UI \u002F API voice lists) show them in this order:\n\n- ⭐ **Editors' picks** — the 10 we recommend starting with, hand-selected for naturalness and stability: **Adam bựa, Trúc Ly, Thiện Minh, Mai Anh, Hải Đăng** *(default)*, **Thùy Dung, Thiền Tâm Đức, Ngọc Huyền, Quang Sơn, Ngọc Trân**\n- **Northern (Bắc)**: Minh Đức, Phạm Tuyên, Xuân Vĩnh, Thanh Bình, Ngọc Linh, Đoan Trang, Quỳnh Anh, Quốc Tuấn (+ picks above)\n- **Central (Trung)**: Quang Sơn, Ngọc Trân\n- **Southern (Nam)**: Adam, Thái Sơn, Thục Đoan, Minh Triết, Mỹ Duyên, Đức Trí, Kim Thanh (+ Thùy Dung)\n\n### Reading style — **deprecated** ⚠️\n\n> [!WARNING]\n> **`style` is deprecated on v3 Turbo and has no effect.** The reading style is already\n> baked into the reference itself (the speaker embedding + reference codes of the preset\n> voice or of your cloned clip), so every generation follows the reference and comes out\n> in its natural reading style.\n>\n> The `style` argument is **still accepted** by `infer`, `infer_stream`, `infer_batch`\n> and `add_voice` so existing code keeps running — whatever you pass (`\"tin_tuc\"`,\n> `\"doc_truyen\"`, …) is simply ignored. New code should just omit it.\n\n```python\n# Old code — still runs, but `style` is ignored\naudio = vieneu.infer(\"Bản tin sáng nay.\", voice=\"Hải Đăng\", style=\"tin_tuc\")\n\n# New code — pick the reading character through the voice \u002F reference clip instead\naudio = vieneu.infer(\"Bản tin sáng nay.\", voice=\"Hải Đăng\")\n```\n\n### Emotion cues (experimental)\n\nInline tags are supported anywhere in the text: `[cười]` (chuckle), `[thở dài]` (sigh), `[hắng giọng]` (clear throat).\n\n```python\naudio = vieneu.infer(\"Nghe hay quá đi [cười]. Để mình nói tiếp [hắng giọng].\", voice=\"Hải Đăng\")\n```\n\n### Voice cloning\n\nClone any voice from a short reference clip. The clip is cleaned up automatically\n(background noise removed, and trimmed to ≤ 8 seconds) before cloning — keep\n`denoise=True` unless your clip is already clean.\n\n```python\naudio = vieneu.infer(\n    \"Đây là giọng được nhân bản tức thì.\",\n    ref_audio=\"my_voice.wav\",   # a 3–8s reference clip\n    denoise=True,               # default; set False if the clip is already clean\n)\nvieneu.save(audio, \"cloned.wav\")\n```\n\n### Save & reuse a cloned voice\n\nRegister a reference once with `add_voice`, then use it by name like a built-in voice.\n\n```python\n# Enroll a voice (denoises + extracts the speaker profile once)\nvieneu.add_voice(\"Giọng của tôi\", \"my_voice.wav\")\n\n# Now reuse it anywhere, including the conversation mode\naudio = vieneu.infer(\"Câu này dùng giọng đã lưu.\", voice=\"Giọng của tôi\")\n\n# Persist your voices so they load next session\nvieneu.save_voices()                 # writes to the default voices file\n# vieneu.remove_voice(\"Giọng của tôi\")\n\n# Add a voice you already cleaned yourself → skip denoising\nvieneu.add_voice(\"Giọng sạch\", \"already_clean.wav\", denoise=False)\n```\n\n### Clean up a clip on its own\n\nGet the denoised audio without synthesizing anything (e.g. to inspect or store it):\n\n```python\nwav, sr = vieneu.denoise(\"noisy.wav\", out_path=\"clean.wav\")   # 44.1 kHz mono\n```\n\n> **Note:** `denoise`, `add_voice`, and voice cloning work on every backend — the\n> torch-free CPU\u002FONNX install included (the whole cloning pipeline runs on\n> onnxruntime + soxr + kaldi-native-fbank). **v3 Nano** below clones the same way (its cloning graphs are fetched on first use).\n\n\u003Ca id=\"v3-nano\">\u003C\u002Fa>\n### v3 Nano (preview) — for edge devices \u002F weak CPUs only 🪶\n\n> [!WARNING]\n> **v3 Turbo remains the default and the recommended model.** Use v3 Nano only when Turbo is\n> too slow on your hardware (old laptops, mini PCs, ARM boards, CPUs without AVX-512\u002FVNNI where\n> the int8 Turbo build produces garbled audio). Nano is a 48M-parameter flow-matching model\n> (ONNX, CPU, torch-free) and it **trades quality for speed**:\n> - **Lower quality than v3 Turbo — most noticeably on English and code-switched (En-Vi) text.**\n>   Vietnamese is close; English words come out with a Vietnamese accent and are less stable.\n> - **24 kHz** output (Turbo: 48 kHz).\n> - **11 preset voices + voice cloning** (`ref_audio`, `add_voice`, `encode_reference` work like Turbo; the three cloning graphs, ~110 MB, download on first use).\n> - **No frame-level streaming** — `infer_stream` yields one finished chunk at a time.\n\nOn the same 12th-gen Core i5, Nano runs at **RTF 0.22** (16 steps) or **0.11** (8 steps) against Turbo's 0.62 fp32 \u002F 0.37 int8 — about **3× faster than Turbo fp32**, with a 282 MB download and ~3 s load time. Full table in [§4 Benchmarks](#benchmarks).\n\n```python\nfrom vieneu import Vieneu\n\ntts = Vieneu(mode=\"v3nano\")                      # ONNX, CPU, torch-free\naudio = tts.infer(\"Xin chào, mình là giọng đọc của VieNeu Nano.\", voice=\"Minh Quân\")\ntts.save(audio, \"nano.wav\")                      # 24 kHz\n\ntts.list_preset_voices()                         # Adam, Ái Hân, Mỹ Duyên, Đức Trí, Hữu Quân, Xuân Tiên, Mai Anh, Trúc Ly, Anh Khôi, Minh Quân, Mạnh Dũng\naudio = tts.infer(\"Bản nhanh cho máy rất yếu.\", voice=\"Ái Hân\", steps=8, sway=-1)   # ~2× faster\n```\n\nKnobs: `steps` (Euler steps, 16 default; 8 ≈ 2× faster, slightly rougher — pair with `sway=-1`),\n`cfg` (classifier-free guidance, 3.0 default; `cfg=0` halves compute but hurts intelligibility),\n`speed`, `seed`, `threads`. Emotion cues `[cười]` `[thở dài]` `[hắng giọng]` work as on Turbo.\n\n---\n\n## 🐳 3. API Server & Docker \u003Ca name=\"docker-remote\">\u003C\u002Fa>\n\n### Streaming API — OpenAI-compatible (v3 Turbo, CPU or GPU)\n\n`apps\u002Fopenai_speech.py` serves `POST \u002Fv1\u002Faudio\u002Fspeech` exactly like OpenAI's TTS endpoint (`pcm`\u002F`wav`, chunked body or SSE), so the **OpenAI SDK, Pipecat, LiveKit Agents, Vercel AI SDK, …** work by changing `base_url`. Audio streams as it is generated: first chunk in **~115 ms** with **16 concurrent streams** on an RTX 3060 (continuous batching), ~140–300 ms and 1–2 streams on a CPU.\n\n```bash\n# Start the server — pick ONE of these three (all listen on http:\u002F\u002Flocalhost:8000):\nuv run python -m apps.openai_speech                                  # from the repo (auto-detects GPU\u002FCPU)\ndocker compose -f docker\u002Fdocker-compose.yml --profile api-gpu up     # or: Docker, GPU container\ndocker compose -f docker\u002Fdocker-compose.yml --profile api-cpu up     # or: Docker, CPU container (torch-free)\n\n# Then, in another terminal: measure TTFA \u002F RTF on your machine\nuv run python examples\u002Fopenai_speech_client.py --bench 8\n```\n\n```python\nfrom openai import OpenAI\nclient = OpenAI(base_url=\"http:\u002F\u002Flocalhost:8000\u002Fv1\", api_key=\"x\")\nwith client.audio.speech.with_streaming_response.create(\n    model=\"vieneu-v3-turbo\", voice=\"Mai Anh\", input=\"Xin chào! Đây là chế độ streaming của VieNeu, phát tới đâu nghe tới đó.\", response_format=\"pcm\",\n) as r:\n    for chunk in r.iter_bytes(4096):   # s16le 48 kHz mono, as it is generated\n        play(chunk)\n```\n\nEndpoints: `POST \u002Fv1\u002Faudio\u002Fspeech`, `GET \u002Fv1\u002Fmodels`, `GET \u002Fv1\u002Fvoices`, `POST \u002Fv1\u002Fvoices` (clone from an uploaded clip), `GET \u002Fhealth`. Concurrency is capped per backend (`VIENEU_MAX_STREAMS`, default 16 on GPU \u002F 1 on CPU) with a small queue and `429` beyond it.\n\n📊 **[docs\u002Fstreaming.md](docs\u002Fstreaming.md)** — every measurement on an RTX 3060 (TTFA \u002F RTF \u002F streams vs `max_streams`), estimates for smaller GPUs, the CPU numbers, and tuning notes (e.g. the first request after the GPU idles pays +100–300 ms until it clocks up).\n\n### Web UI in Docker\n\n```bash\ndocker compose -f docker\u002Fdocker-compose.yml --profile gpu up   # or --profile cpu → http:\u002F\u002Flocalhost:7860\n```\n\nSee [docs\u002FDeploy.md](docs\u002FDeploy.md) for production builds and images.\n\n### Legacy v2 API server (LMDeploy) — deprecated\n\n> [!WARNING]\n> **Deprecated.** This LMDeploy server and the `remote` mode only work with **VieNeu-TTS v2**, which is no longer updated. They are kept for existing deployments. For v3 Turbo use the streaming API above.\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Legacy v2 server instructions (Docker + remote mode)\u003C\u002Fb>\u003C\u002Fsummary>\n\nDeploy VieNeu-TTS as a high-performance API Server (powered by LMDeploy) with a single command.\n\n### 1. Run with Docker\n\n**Requirement**: [NVIDIA Container Toolkit](https:\u002F\u002Fdocs.nvidia.com\u002Fdatacenter\u002Fcloud-native\u002Fcontainer-toolkit\u002Flatest\u002Finstall-guide.html) is required for GPU support.\n\n**Start the Server with a Public Tunnel (No port forwarding needed):**\n```bash\ndocker run --gpus all -p 23333:23333 -v huggingface_cache:\u002Froot\u002F.cache\u002Fhuggingface pnnbao\u002Fvieneu-tts:latest --tunnel\n```\n\n*   **Default**: The server loads the `VieNeu-TTS-v2` model for maximum quality.\n*   **Tunneling**: The Docker image includes a built-in `bore` tunnel. Check the container logs to find your public address (e.g., `bore.pub:31631`).\n\n### 2. Using the SDK (Remote Mode)\n\nOnce the server is running, you can connect from anywhere (Colab, Web Apps, etc.) without loading heavy models locally.\n\n**Installation**:\n```bash\npip install \"vieneu[legacy]\"\n```\n\n**Usage**:\n```python\nfrom vieneu import Vieneu\nimport os\n\n# Configuration\nREMOTE_API_BASE = 'http:\u002F\u002Fyour-server-ip:23333\u002Fv1'  # Or bore tunnel URL\nREMOTE_MODEL_ID = \"pnnbao-ump\u002FVieNeu-TTS-v2\"\n\n# Initialization (LIGHTWEIGHT - only loads small codec locally)\n# Default emotion is \"natural\" (conversational) - set emotion=\"storytelling\" for storytelling mode\nvieneu = Vieneu(mode='remote', api_base=REMOTE_API_BASE, model_name=REMOTE_MODEL_ID, emotion=\"natural\")\nos.makedirs(\"outputs\", exist_ok=True)\n\n# List remote voices\navailable_voices = vieneu.list_preset_voices()\nfor desc, name in available_voices:\n    print(f\"   - {desc} (ID: {name})\")\n\n# Use specific voice (dynamically select second voice)\nif available_voices:\n    _, my_voice_id = available_voices[1]\n    voice_data = vieneu.get_preset_voice(my_voice_id)\n    audio_spec = vieneu.infer(text=\"Chào bạn, tôi đang nói bằng giọng của bác sĩ Tuyên.\", voice=voice_data)\n    vieneu.save(audio_spec, f\"outputs\u002Fremote_{my_voice_id}.wav\")\n    print(f\"💾 Saved synthesis to: outputs\u002Fremote_{my_voice_id}.wav\")\n\n# Standard synthesis (uses default voice)\ntext_input = \"Chế độ remote giúp tích hợp VieNeu vào ứng dụng Web hoặc App cực nhanh mà không cần GPU tại máy khách.\"\naudio = vieneu.infer(text=text_input)\nvieneu.save(audio, \"outputs\u002Fremote_output.wav\")\nprint(\"💾 Saved remote synthesis to: outputs\u002Fremote_output.wav\")\n\n# Zero-shot voice cloning (encodes audio locally, sends codes to server)\nif os.path.exists(\"examples\u002Faudio_ref\u002Fexample_ngoc_huyen.wav\"):\n    cloned_audio = vieneu.infer(\n        text=\"Đây là giọng nói được clone và xử lý thông qua VieNeu Server.\",\n        ref_audio=\"examples\u002Faudio_ref\u002Fexample_ngoc_huyen.wav\",\n        ref_text=\"Tác phẩm dự thi bảo đảm tính khoa học, tính đảng, tính chiến đấu, tính định hướng.\"\n    )\n    vieneu.save(cloned_audio, \"outputs\u002Fremote_cloned_output.wav\")\n    print(\"💾 Saved remote cloned voice to: outputs\u002Fremote_cloned_output.wav\")\n```\n*For full implementation details, see: [examples\u002Fmain_remote.py](examples\u002Fmain_remote.py)*\n\n### Voice Preset Specification (v1.0)\nVieNeu-TTS uses the official `vieneu.voice.presets` specification to define reusable voice assets. Only `voices.json` files following this spec are guaranteed to be compatible with VieNeu-TTS SDK ≥ v1.x.\n\n### 3. Advanced Configuration\n\nCustomize the server to run specific versions or your own fine-tuned models.\n\n**Run the 0.3B Model (Faster):**\n```bash\ndocker run --gpus all pnnbao\u002Fvieneu-tts:serve --model pnnbao-ump\u002FVieNeu-TTS-0.3B --tunnel\n```\n\n**Fine-tuned v3 Turbo models** are not served by this container (it hosts the v1\u002Fv2 LMDeploy backends). Load them with the SDK instead — see [Fine-tuning (LoRA)](#finetune):\n\n```python\ntts = Vieneu(mode=\"v3turbo\", backbone_repo=\"finetune\u002Foutput\u002Fmy_voice\u002Fmerged\")\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## 📊 4. Benchmarks \u003Ca name=\"benchmarks\">\u003C\u002Fa>\n\nEvery speed and latency number quoted in this README, measured on one machine so they are comparable:\n**RTX 3060 12 GB** · **Intel Core i5 12th gen (6 P-cores, 12 threads)** · Windows 11 · torch 2.8 + cu128 (bf16) · ONNX Runtime 1.24 (fp32\u002Fint8, 6 threads) · `vieneu` 3.8.x · September 2026. Reproduce with the snippets in [§2](#sdk) and `examples\u002Fopenai_speech_client.py --bench N`.\n\n**RTF** = generation time ÷ audio duration — lower is faster, **\u003C 1 is faster than real-time** (0.02 = 50× real-time). **TTFA** = time to the first audio chunk when streaming.\n\n### Throughput — how fast a whole text is synthesized\n\n| Engine \u002F mode | RTF ↓ | Example | Notes |\n|---|---|---|---|\n| **GPU, batched** (`infer_batch`, or one long `infer`) | **0.011–0.02** | 30 sentences \u002F 130 s of audio in **1.5–2.3 s**; 154 s in 2.8 s | first call per batch size +~0.5 s (CUDA-graph capture) |\n| **GPU, one sentence** (`infer`) | 0.10 | 3.5 s sentence in 0.36 s | launch-bound: a short sentence cannot fill the GPU |\n| **CPU v3 Turbo fp32** (default on CPU) | 0.55–0.62 | 10 s sentence in ~6 s | 48 kHz, load ~19 s |\n| **CPU v3 Turbo int8** (`precision=\"int8\"`) | 0.35–0.37 | 10 s sentence in ~3.6 s | needs VNNI (AVX-512 VNNI \u002F AVX-VNNI); load ~14 s |\n| **CPU v3 Nano**, 16 steps (default) | 0.22 | — | 24 kHz, lower quality; load ~3 s |\n| **CPU v3 Nano**, 8 steps, sway −1 | 0.11 | — | fastest, lowest quality |\n\nThe GPU is **~25–50× faster than the CPU** on bulk work; on a *single short sentence* the gap shrinks to ~5× because the work is too small to fill the GPU.\n\n### Streaming — first-audio latency and concurrency (`infer_stream`, OpenAI API)\n\n| Backend | Concurrent streams | TTFA (first audio) | RTF per stream |\n|---|---|---|---|\n| **GPU**, 1 stream | 1 | **~115 ms** (106 ms over HTTP) | 0.49 |\n| **GPU**, 8 streams | 8 | 164 ms | 0.56 |\n| **GPU**, 16 streams (default `max_streams`) | 16 | 185 ms median (max 339 when all 16 start at once); **134 ms** for a request arriving while 15 play | 0.59 |\n| **GPU**, 32 streams (`max_streams=32`) | 32 | ~450 ms | 0.93 — still real-time, no margin |\n| **CPU** fp32 | 1 | 260–400 ms | 0.55–0.61 (two at once → 1.19, both stall) |\n| **CPU** int8 | 2 | 140–195 ms | 0.35 (two at once → 0.58–0.67) |\n\nStreams ≠ users: a stream lives only while a reply plays, so 16 streams ≈ 45–80 active voice-chat users. Set `max_streams` to the real load — every reserved slot adds ~2.5 ms to each codec call. After a few idle seconds the GPU parks at low clocks and the *first* request pays +100–300 ms (lock clocks with `nvidia-smi -lgc` or \"prefer maximum performance\"). VRAM: 1.1 GB peak at 16 streams. Estimates for other GPUs and the full method: **[docs\u002Fstreaming.md](docs\u002Fstreaming.md)**.\n\n---\n\n## 🎓 5. Fine-tuning (LoRA) \u003Ca name=\"finetune\">\u003C\u002Fa>\n\nv3 Turbo already clones a voice from a clip of a few seconds. Fine-tune with **LoRA** when you need a tighter match than cloning, a specific reading style (storytelling, news, narration…), or better reading on your own domain. A LoRA teaches **one voice**: about **10–30 minutes** of clean audio from one speaker (one LoRA per voice if you need several). Only a few million parameters are trained, so a ~6 GB GPU is enough.\n\n```bash\nuv sync --extra finetune\nuv run python finetune\u002Fprepare_dataset.py --dataset-dir finetune\u002Fdataset   # CPU, torch-free; all clips = one speaker\nuv run python finetune\u002Ftrain_lora.py --data finetune\u002Fdataset\u002Ftrain.parquet --run my_voice --merge\nuv run python finetune\u002Fmake_voice.py --audio ref.wav --name \"My voice\" --out finetune\u002Foutput\u002Fmy_voice\u002Fmerged\n```\n\n```python\ntts = Vieneu(mode=\"v3turbo\", backbone_repo=\"finetune\u002Foutput\u002Fmy_voice\u002Fmerged\")   # or your Hub repo\naudio = tts.infer(\"Xin chào!\", voice=\"My voice\")        # packed voice — no reference audio needed\n```\n\nThe merged model speaks that one voice from its packed speaker embedding (no reference audio) and keeps the v3 Turbo API (presets, batching, streaming) on the PyTorch\u002FGPU backend; use the base model to clone other voices. Data layout, options and tips: [`finetune\u002FREADME.md`](finetune\u002FREADME.md).\n\n---\n\n## 🔬 6. Model Overview \u003Ca name=\"backbones\">\u003C\u002Fa>\n\n| Model | Status | Format | Device | Bilingual | Features | Speed ([§4](#benchmarks)) |\n|---|---|---|---|---|---|---|\n| **VieNeu-TTS-v3** | 🔜 **Coming soon** | PyTorch | **GPU** | ✅ | ? | ? |\n| **VieNeu-TTS-v3-Turbo** *(default)* | 🦜 **Current** | PyTorch\u002FONNX | **GPU\u002FCPU** | ✅ | **48 kHz, 25 preset voices, Cloning, Emotion cues, Conversation, Streaming (OpenAI-compatible API)** | **Ultra Fast** — GPU: RTF ≈ 0.02 batched, 16 real-time streams; CPU: RTF ≈ 0.5 (int8 0.35) |\n| **VieNeu-TTS-v3-Nano** | 🧪 Preview | ONNX | **weak CPU \u002F edge** | ⚠️ weak | 24 kHz, 11 preset voices, cloning, emotion cues — **lower quality (esp. English \u002F En-Vi)** | Fastest on CPU (RTF 0.11–0.22) |\n| VieNeu-TTS-v2 | ⛔ Deprecated | PyTorch | GPU | ✅ | Podcast, En-Vi CS | Fast (LMDeploy) |\n| VieNeu-v2-CPU | ⛔ Deprecated | GGUF\u002FONNX | CPU\u002FEdge | ✅ | Podcast, En-Vi CS | Medium |\n| VieNeu-v2-Turbo | ⛔ Deprecated | GGUF\u002FONNX | CPU\u002FEdge | ✅ | Lightweight En-Vi | Fast |\n| VieNeu-TTS (v1) | ⛔ Deprecated | PyTorch | GPU\u002FCPU | ❌ | Stable (Vi only) | Slow |\n\n> ⛔ **Deprecated** models are no longer updated and are kept only for existing deployments; new projects should use **v3 Turbo** (and **v3** once released).\n\n---\n\n## 🚀 7. Roadmap \u003Ca name=\"roadmap\">\u003C\u002Fa>\n\n- [x] **VieNeu-TTS v3 Turbo** *(on-device, personal use)*: from-scratch 48 kHz architecture — preset voices, instant voice cloning, emotion cues, batched generation, multi-speaker conversation, frame-level streaming; torch-free on CPU.\n- [x] **VieNeu-TTS v3 Nano** *(preview)*: 48M flow-matching model for weak CPUs \u002F edge devices — 11 preset voices + cloning, torch-free.\n- [x] **LoRA fine-tuning** for v3 Turbo — train your own voice or reading style on one consumer GPU.\n- [x] **VieNeu-TTS v3 Turbo GPU streaming server**: OpenAI-compatible `\u002Fv1\u002Faudio\u002Fspeech` with continuous batching on one CUDA graph — first audio ~115 ms, 16 concurrent streams on an RTX 3060, Docker profiles `api-gpu` \u002F `api-cpu` ([docs\u002Fstreaming.md](docs\u002Fstreaming.md)).\n- [ ] **VieNeu-TTS v3 (GPU, server release)**: the full v3 model for API \u002F server deployment — finalized quality, stable emotion control, more voices.\n- [ ] **Mobile SDK**: official Android \u002F iOS deployment.\n\n---\n\n## 🤝 8. Support & Contact \u003Ca name=\"support\">\u003C\u002Fa>\n\n- **Hugging Face:** [pnnbao-ump](https:\u002F\u002Fhuggingface.co\u002Fpnnbao-ump)\n- **Discord:** [Join our community](https:\u002F\u002Fdiscord.gg\u002FyJt8kzjzWZ)\n- **Facebook:** [Pham Nguyen Ngoc Bao](https:\u002F\u002Fwww.facebook.com\u002Fpnnbao97)\n- **License:** Apache 2.0 (Free to use).\n\n---\n## 📑 9. Citation \u003Ca name=\"citation\">\u003C\u002Fa>\n\n```bibtex\n@misc{vieneutts2026,\n  title        = {VieNeu-TTS: Advanced Vietnamese Text-to-Speech with Instant Voice Cloning},\n  author       = {Pham Nguyen Ngoc Bao},\n  year         = {2026},\n  publisher    = {Hugging Face},\n  howpublished = {\\url{https:\u002F\u002Fhuggingface.co\u002Fpnnbao-ump\u002FVieNeu-TTS}}\n}\n```\n\n---\n\n## 🌟 Star History\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpnnbao97\u002FVieNeu-TTS\u002Fstargazers\">\n \u003Cpicture>\n   \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fpnnbao97\u002Fstar-charts\u002Fmain\u002Fcharts\u002Fpnnbao97\u002FVieNeu-TTS\u002Fdark.svg\" \u002F>\n   \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fpnnbao97\u002Fstar-charts\u002Fmain\u002Fcharts\u002Fpnnbao97\u002FVieNeu-TTS\u002Flight.svg\" \u002F>\n   \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fpnnbao97\u002Fstar-charts\u002Fmain\u002Fcharts\u002Fpnnbao97\u002FVieNeu-TTS\u002Flight.svg\" \u002F>\n \u003C\u002Fpicture>\n\u003C\u002Fa>\n\n---\n\n## 🤝 Contributors\n\nThanks to all the amazing people who have contributed to this project!\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpnnbao97\u002FVieNeu-TTS\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Fcontrib.rocks\u002Fimage?repo=pnnbao97\u002FVieNeu-TTS\" \u002F>\n\u003C\u002Fa>\n\n---\n\n## 🙏 Acknowledgements\n\nThis project uses [neucodec](https:\u002F\u002Fhuggingface.co\u002Fneuphonic\u002Fneucodec) (v1\u002Fv2) and [MOSS-Audio-Tokenizer-Nano](https:\u002F\u002Fhuggingface.co\u002FOpenMOSS-Team\u002FMOSS-Audio-Tokenizer-Nano) (v3 Turbo) for audio coding, and [sea-g2p](https:\u002F\u002Fgithub.com\u002Fpnnbao97\u002Fsea-g2p) for text normalization and phonemization.\n\n**Made with ❤️ for the Vietnamese TTS community**\n","VieNeu-TTS 是一个专为越南语设计的端侧实时文本转语音（TTS）系统，支持无需网络的本地运行与毫秒级语音克隆。其核心功能包括：48kHz高保真音频合成、3–8秒短样本即时语音克隆（含自动降噪）、25种预置音色、支持情绪标记（如[cười]）的自然语调建模，以及面向播客\u002F对话场景的批处理与多说话人模式。基于轻量级自研编解码器（MOSS-Audio-Tokenizer-Nano）与越南语专用音素化器（sea-g2p），在消费级CPU上可达约2倍实时推理速度（RTF≈0.01–0.02）。适用于离线越南语语音播报、无障碍辅助、本地化播客生成及资源受限设备上的语音交互场景。",2,"2026-11-24 04:49:19","trending"]