Instructions to use quangdung/Piper_checkpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Piper
How to use quangdung/Piper_checkpoint with Piper:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
|
Download README.md from quangdung/Piper_checkpoint: direct link, hf CLI and curl.
- Browser
- Download file 8.48 kB
-
https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/README.md
- Command line
-
hf download hf://quangdung/Piper_checkpoint/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/README.md
8.48 kB
| language: vi | |
| tags: | |
| - tts | |
| - text-to-speech | |
| - piper | |
| - vits | |
| - vietnamese | |
| - multi-speaker | |
| - onnx | |
| license: mit | |
| datasets: | |
| - quangdung/ly-tts-dataset | |
| # Piper TTS — Vietnamese Multi-Speaker Voice Models | |
| Bộ 14 mô hình giọng nói tiếng Việt được fine-tune từ [Piper TTS](https://github.com/OHF-Voice/piper1-gpl) (VITS medium), hỗ trợ tổng hợp giọng nói (TTS) với chất lượng cao, tốc độ nhanh, chạy local trên CPU/GPU. | |
| ## Tổng quan | |
| | Mục | Chi tiết | | |
| |---|---| | |
| | **Base model** | [piper1-gpl](https://github.com/OHF-Voice/piper1-gpl) medium (VITS) | | |
| | **Base checkpoint** | `vi_VN/vais1000/medium` — epoch 4769, step 919580 | | |
| | **Sample rate** | 22050 Hz | | |
| | **Ngôn ngữ** | Tiếng Việt (code-switched Vi-En) | | |
| | **Số giọng** | 14 speakers | | |
| | **Định dạng** | `.ckpt` (PyTorch Lightning) + `.onnx` (ONNX export) | | |
| | **License** | MIT | | |
| ## Danh sách giọng nói | |
| | # | Speaker | .ckpt | .onnx | Sample (.mp3) | | |
| |---|---|---|---|---| | |
| | 1 | **Bảo Hân** | ✅ | ✅ | — | | |
| | 2 | **Châu Anh** | — | ✅ | ✅ | | |
| | 3 | **Chi Nguyễn** | — | — | ✅ | | |
| | 4 | **Gia Hiếu** | ✅ | ✅ | ✅ | | |
| | 5 | **Lọ Lem** | ✅ | ✅ | ✅ | | |
| | 6 | **Mai Linh** | ✅ | ✅ | ✅ | | |
| | 7 | **Nguyễn Hiếu** | — | — | ✅ | | |
| | 8 | **Nhật** | — | ✅ | ✅ | | |
| | 9 | **Quốc Khánh** | ✅ | ✅ | ✅ | | |
| | 10 | **Quỳnh Trang** | ✅ | ✅ | ✅ | | |
| | 11 | **Thanh Duy** | — | — | ✅ | | |
| | 12 | **Thu Minh** | — | — | ✅ | | |
| | 13 | **Tường Vy** | ✅ | ✅ | ✅ | | |
| | 14 | **Yến Nhi** | ✅ | ✅ | ✅ | | |
| - **6 giọng đầy đủ** (.ckpt + .onnx + .mp3): Gia Hiếu, Lọ Lem, Quốc Khánh, Quỳnh Trang, Tường Vy, Yến Nhi | |
| - **Các giọng khác**: đang trong quá trình train hoặc mới có sample | |
| ## 🎧 Nghe thử (Audio Samples) | |
| ### Châu Anh | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Ch%C3%A2u%20Anh/audio14.mp3"></audio> | |
| ### Chi Nguyễn | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Chi%20Nguy%E1%BB%85n/chinguyen.mp3"></audio> | |
| ### Gia Hiếu | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Gia%20Hi%E1%BA%BFu/giahieu.mp3"></audio> | |
| ### Lọ Lem | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/L%E1%BB%8D%20Lem/lolem.mp3"></audio> | |
| ### Mai Linh | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Mai%20Linh/mailinh_7BKaqqkh.mp3"></audio> | |
| ### Nguyễn Hiếu | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Nguy%E1%BB%85n%20Hi%E1%BA%BFu/nguyehieu.mp3"></audio> | |
| ### Nhật | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Nh%E1%BA%ADt/nh%E1%BA%ADt.mp3"></audio> | |
| ### Quốc Khánh | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Qu%E1%BB%91c%20Kh%C3%A1nh/quockhanh.mp3"></audio> | |
| ### Quỳnh Trang | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Qu%E1%BB%B3nh%20Trang/quynhtrang.mp3"></audio> | |
| ### Thanh Duy | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Thanh%20Duy/thanhduy.mp3"></audio> | |
| ### Thu Minh | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Thu%20Minh/thuminh.mp3"></audio> | |
| ### Tường Vy | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/T%C6%B0%E1%BB%9Dng%20Vy/tuongvy.mp3"></audio> | |
| ### Yến Nhi | |
| <audio controls src="https://huggingface.co/quangdung/Piper_checkpoint/resolve/main/Y%E1%BA%BFn%20Nhi/yennhi.mp3"></audio> | |
| ## Dataset | |
| - **Nguồn**: [quangdung/ly-tts-dataset](https://huggingface.co/datasets/quangdung/ly-tts-dataset) trên Hugging Face | |
| - **Kích thước**: 2,834 câu tiếng Việt (có xen kẽ tiếng Anh code-switched) | |
| - **Format**: audio WAV 22050 Hz + text transcript | |
| - **Mỗi giọng**: ~100 giờ audio | |
| ## Cài đặt | |
| ### Yêu cầu hệ thống | |
| - Python 3.10+ | |
| - espeak-ng (cho Vietnamese phonemization) | |
| - CUDA (tùy chọn, cho GPU inference/training) | |
| ### Cài đặt dependencies | |
| ```bash | |
| # Cài espeak-ng | |
| sudo apt-get install -y espeak-ng espeak-ng-data libespeak-ng-dev | |
| # Cài piper-tts | |
| pip install piper-tts | |
| # HOẶC: Cài từ source piper1-gpl (cần cho training) | |
| git clone https://github.com/OHF-Voice/piper1-gpl.git | |
| cd piper1-gpl | |
| pip install -e ".[train]" | |
| ./build_monotonic_align.sh | |
| ``` | |
| ## Cách sử dụng | |
| ### 1. Tải model từ Hugging Face | |
| ```python | |
| from huggingface_hub import snapshot_download | |
| snapshot_download( | |
| repo_id="quangdung/Piper_checkpoint", | |
| local_dir="./piper-vn-models" | |
| ) | |
| ``` | |
| ### 2. Inference bằng Python API | |
| ```python | |
| import wave | |
| from piper import PiperVoice, SynthesisConfig | |
| # Load model ONNX | |
| voice = PiperVoice.load( | |
| model_path="./piper-vn-models/Yến Nhi/yennhi.onnx", | |
| config_path="./piper-vn-models/Yến Nhi/yennhi.onnx.json", # cần config.json đi kèm | |
| use_cuda=True # bật GPU nếu có | |
| ) | |
| # Cấu hình giọng đọc | |
| config = SynthesisConfig( | |
| volume=1.0, # âm lượng (0-1) | |
| length_scale=1.0, # tốc độ nói (>1: chậm, <1: nhanh) | |
| noise_scale=0.667, # độ biến thiên giọng | |
| noise_w_scale=0.8, # độ biến thiên cảm xúc | |
| normalize_audio=False, | |
| ) | |
| # Tổng hợp giọng nói | |
| with wave.open("output.wav", "wb") as wav_file: | |
| voice.synthesize_wav( | |
| "Xin chào các bạn, mình là trợ lý ảo tiếng Việt.", | |
| wav_file, | |
| syn_config=config | |
| ) | |
| ``` | |
| ### 3. Inference bằng CLI | |
| ```bash | |
| echo "Xin chào các bạn" | piper \ | |
| --model "Yến Nhi/yennhi.onnx" \ | |
| --config "Yến Nhi/yennhi.onnx.json" \ | |
| --output_file output.wav | |
| ``` | |
| ### 4. Nghe sample | |
| Xem phần [🎧 Nghe thử](#-nghe-thử-audio-samples) ở trên để nghe demo từng giọng trước khi chọn model. | |
| ## Huấn luyện (Training) | |
| ### Chuẩn bị dataset | |
| ```python | |
| from datasets import load_dataset | |
| import numpy as np | |
| import soundfile as sf | |
| import os | |
| dataset = load_dataset("quangdung/ly-tts-dataset") | |
| os.makedirs("formatted_dataset/wavs", exist_ok=True) | |
| with open("formatted_dataset/metadata.csv", "w", encoding="utf-8") as f: | |
| for i, sample in enumerate(dataset["train"]): | |
| audio = np.frombuffer(sample["audio_bytes"], dtype=np.float32) | |
| sf.write(f"formatted_dataset/wavs/audio{i+1}.wav", audio, 22050) | |
| f.write(f"audio{i+1}.wav|{sample['text'].strip()}\n") | |
| ``` | |
| ### Train từ base checkpoint | |
| ```bash | |
| python3 -m piper.train fit \ | |
| --data.voice_name "ten_giong" \ | |
| --data.csv_path "formatted_dataset/metadata.csv" \ | |
| --data.audio_dir "formatted_dataset/wavs" \ | |
| --model.sample_rate 22050 \ | |
| --data.espeak_voice "vi" \ | |
| --data.cache_dir CACHE_DIR \ | |
| --data.config_path "config.json" \ | |
| --data.batch_size 16 \ | |
| --ckpt_path "pretrained-weights-only.ckpt" \ | |
| --trainer.max_epochs 1000 \ | |
| --trainer.callbacks+=ModelCheckpoint \ | |
| --trainer.callbacks.every_n_epochs=20 \ | |
| --trainer.callbacks.save_top_k=-1 \ | |
| --trainer.callbacks.dirpath="checkpoints" \ | |
| --trainer.callbacks.filename="ten_giong-{epoch:04d}" | |
| ``` | |
| ### Export ONNX | |
| ```bash | |
| python3 -m piper.train.export_onnx \ | |
| --checkpoint "checkpoints/ten_giong-epoch=0019.ckpt" \ | |
| --output_file "ten_giong.onnx" | |
| ``` | |
| ## Cấu trúc thư mục | |
| ``` | |
| Piper_checkpoint/ | |
| ├── README.md | |
| ├── text.txt # Training text corpus | |
| ├── giong1.mp3 # Reference voice sample | |
| ├── Bảo Hân/ | |
| │ ├── baohan-epoch=0019.ckpt | |
| │ └── baohan250626.onnx | |
| ├── Gia Hiếu/ | |
| │ ├── giahieu-epoch=0019.ckpt | |
| │ ├── giahieu.onnx | |
| │ └── giahieu.mp3 | |
| ├── ... # (các giọng khác tương tự) | |
| └── Yến Nhi/ | |
| ├── yennhi-epoch=0019.ckpt | |
| ├── yennhi.onnx | |
| └── yennhi.mp3 | |
| ``` | |
| ## Credits | |
| - **Piper TTS**: [OHF-Voice/piper1-gpl](https://github.com/OHF-Voice/piper1-gpl) — Open Home Foundation | |
| - **Base checkpoint**: [rhasspy/piper-checkpoints](https://huggingface.co/datasets/rhasspy/piper-checkpoints) | |
| - **Dataset**: [quangdung/ly-tts-dataset](https://huggingface.co/datasets/quangdung/ly-tts-dataset) | |
| - **Training**: Fine-tuned trên Google Colab với GPU T4/A100 | |
| ## License | |
| MIT License — xem file [LICENSE](LICENSE) (nếu có) hoặc tự do sử dụng cho mục đích cá nhân và thương mại. | |