File size: 2,998 Bytes
5491fb4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
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 | <audio controls src="https://huggingface.co/AnotherPotatoCoder/Khmer-TTS/resolve/main/sample_audios/sample_1.wav"></audio> |
| Sample 2 | <audio controls src="https://huggingface.co/AnotherPotatoCoder/Khmer-TTS/resolve/main/sample_audios/sample_2.wav"></audio> |
| Sample 3 | <audio controls src="https://huggingface.co/AnotherPotatoCoder/Khmer-TTS/resolve/main/sample_audios/sample_3.wav"></audio> |
| Sample 4 | <audio controls src="https://huggingface.co/AnotherPotatoCoder/Khmer-TTS/resolve/main/sample_audios/sample_4.wav"></audio> |

## 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).