---
license: mit
language:
- km
tags:
- text-to-speech
- tts
- khmer
---
# SimpleKhmerTTS
Decoder-only transformer TTS, using [WavTokenizer](https://github.com/jishengpeng/WavTokenizer) as the audio codec and [DDD-Cambodia/khmer-speech-dataset](https://huggingface.co/datasets/DDD-Cambodia/khmer-speech-dataset) as dataset.
## Samples
| Text | Audio |
| -------- | -------------------------------------------------------------------------------------------------------------------------- |
| Sample 1 | |
| Sample 2 | |
| Sample 3 | |
| Sample 4 | |
## Setup
```bash
git clone https://github.com/FirstPotatoCoder/SimpleKhmerTTS.git
cd SimpleKhmerTTS
pip install -q -r requirements.txt
python scripts/download_weights.py
```
## Run
```bash
python examples/run_inference.py " ភាសាខ្មែរមានអក្សរច្រើន ហើយពិបាកសរសេរបន្តិច។ ភាសានេះមានប្រវត្តិយូរអង្វែង និងជាផ្នែកមួយយ៉ាងសំខាន់នៃវប្បធម៌កម្ពុជា។" --speaker_id 0
```
Or from Python:
```python
from tts.inference import TTSPipeline
pipe = TTSPipeline(
tts_weights="weights/tts.pt",
wavtokenizer_weights="weights/wavtokenizer.ckpt",
wavtokenizer_config="configs/wavtokenizer_config.yaml"
)
pipe.generate(" ភាសាខ្មែរមានអក្សរច្រើន ហើយពិបាកសរសេរបន្តិច។", speaker_id=1, out_path="out.wav")
```
## Limitations
- The model sometimes hallucinates, generating babbling or garbled output on rare or unseen words, making it ill-suited for direct deployment — likely due to the limited amount of training data and codec's limited performance on Khmer audio.
- Works best when generating ~3s to 10s of audio, matching the length distribution of its training data.
- No chunking support yet — the current repo only supports clip-by-clip generation, one sample at a time.
## Credits
- Data: [Khmer Speech Dataset](https://huggingface.co/datasets/DDD-Cambodia/khmer-speech-dataset) by DDD-Cambodia
- Compute: [Kaggle](https://www.kaggle.com) for free T4 GPU access
- Audio tokenizer/codec: [WavTokenizer](https://github.com/jishengpeng/WavTokenizer)
(vendored under `wavtokenizer/`, trimmed to inference-only code).