Spaces:
Running
Running
Duplicate from seanghay/khmer-tts
Browse filesCo-authored-by: Seanghay Yath <[email protected]>
- .gitattributes +34 -0
- .gitignore +26 -0
- README.md +14 -0
- app.py +41 -0
- khm/G_100000.pth +3 -0
- khm/config.json +87 -0
- khm/vocab.txt +74 -0
- packages.txt +2 -0
- requirements.txt +2 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# General
|
2 |
+
.DS_Store
|
3 |
+
.AppleDouble
|
4 |
+
.LSOverride
|
5 |
+
|
6 |
+
# Icon must end with two \r
|
7 |
+
Icon
|
8 |
+
|
9 |
+
# Thumbnails
|
10 |
+
._*
|
11 |
+
|
12 |
+
# Files that might appear in the root of a volume
|
13 |
+
.DocumentRevisions-V100
|
14 |
+
.fseventsd
|
15 |
+
.Spotlight-V100
|
16 |
+
.TemporaryItems
|
17 |
+
.Trashes
|
18 |
+
.VolumeIcon.icns
|
19 |
+
.com.apple.timemachine.donotpresent
|
20 |
+
|
21 |
+
# Directories potentially created on remote AFP share
|
22 |
+
.AppleDB
|
23 |
+
.AppleDesktop
|
24 |
+
Network Trash Folder
|
25 |
+
Temporary Items
|
26 |
+
.apdisk
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Khmer Text-to-Speech
|
3 |
+
emoji: ๐ค
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: pink
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.32.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: true
|
10 |
+
license: cc-by-4.0
|
11 |
+
duplicated_from: seanghay/khmer-tts
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
import re
|
3 |
+
from ttsmms import TTS
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
tts = TTS("khm")
|
7 |
+
|
8 |
+
def sanitize(text):
|
9 |
+
return re.sub(r"\u200b", "", text)
|
10 |
+
|
11 |
+
def generate_voice(text):
|
12 |
+
audio = tts.synthesis(text)
|
13 |
+
return (audio['sampling_rate'], audio['x'])
|
14 |
+
|
15 |
+
with gr.Blocks(title="Khmer Text to Speech with MMS", theme=gr.themes.Default(font=[gr.themes.GoogleFont("Noto Sans Khmer"), "Arial", "sans-serif"])) as blocks:
|
16 |
+
|
17 |
+
gr.Markdown('# Khmer Text to Speech - MMS')
|
18 |
+
gr.Markdown('MMS: Scaling Speech Technology to 1000+ languages by Meta AI')
|
19 |
+
|
20 |
+
input_text = gr.Textbox(label="แขแแแแ", lines=3)
|
21 |
+
examples = gr.Examples(examples=["แแแโแแถโแแผแแแโแแแแแแแแโแแแโแแแธแแกแถแแ", "แแแแแแแแ แฌแแแแแแแแ แแถแแแแแแขแแแผแแแแแ
แแแแแแแแแถแแทแแแแถแแแแถแแแฝแแแแแปแแแแแแ
แแ
แปแแแแแแแ"], inputs=[input_text])
|
22 |
+
|
23 |
+
run_button = gr.Button(value="แแแแแพแ")
|
24 |
+
|
25 |
+
out_audio = gr.Audio(
|
26 |
+
label="แแแกแแแแแแแถแแแแแแพแ",
|
27 |
+
type="numpy",
|
28 |
+
)
|
29 |
+
|
30 |
+
inputs = [input_text]
|
31 |
+
outputs = [out_audio]
|
32 |
+
|
33 |
+
run_button.click(
|
34 |
+
fn=generate_voice,
|
35 |
+
inputs=inputs,
|
36 |
+
outputs=outputs,
|
37 |
+
queue=True,
|
38 |
+
)
|
39 |
+
|
40 |
+
|
41 |
+
blocks.queue(concurrency_count=1).launch(debug=True)
|
khm/G_100000.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:86a7237c6bd72beb885152631e69743290c03b4a33ea17b7c3ca851a29b9749d
|
3 |
+
size 436464113
|
khm/config.json
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"train": {
|
3 |
+
"log_interval": 200,
|
4 |
+
"eval_interval": 1000,
|
5 |
+
"seed": 1234,
|
6 |
+
"epochs": 20000,
|
7 |
+
"learning_rate": 0.0002,
|
8 |
+
"betas": [
|
9 |
+
0.8,
|
10 |
+
0.99
|
11 |
+
],
|
12 |
+
"eps": 1e-09,
|
13 |
+
"batch_size": 64,
|
14 |
+
"fp16_run": true,
|
15 |
+
"lr_decay": 0.999875,
|
16 |
+
"segment_size": 8192,
|
17 |
+
"init_lr_ratio": 1,
|
18 |
+
"warmup_epochs": 0,
|
19 |
+
"c_mel": 45,
|
20 |
+
"c_kl": 1.0
|
21 |
+
},
|
22 |
+
"data": {
|
23 |
+
"training_files": "train.ltr",
|
24 |
+
"validation_files": "dev.ltr",
|
25 |
+
"text_cleaners": [
|
26 |
+
"transliteration_cleaners"
|
27 |
+
],
|
28 |
+
"max_wav_value": 32768.0,
|
29 |
+
"sampling_rate": 16000,
|
30 |
+
"filter_length": 1024,
|
31 |
+
"hop_length": 256,
|
32 |
+
"win_length": 1024,
|
33 |
+
"n_mel_channels": 80,
|
34 |
+
"mel_fmin": 0.0,
|
35 |
+
"mel_fmax": null,
|
36 |
+
"add_blank": true,
|
37 |
+
"n_speakers": 0,
|
38 |
+
"cleaned_text": true
|
39 |
+
},
|
40 |
+
"model": {
|
41 |
+
"inter_channels": 192,
|
42 |
+
"hidden_channels": 192,
|
43 |
+
"filter_channels": 768,
|
44 |
+
"n_heads": 2,
|
45 |
+
"n_layers": 6,
|
46 |
+
"kernel_size": 3,
|
47 |
+
"p_dropout": 0.1,
|
48 |
+
"resblock": "1",
|
49 |
+
"resblock_kernel_sizes": [
|
50 |
+
3,
|
51 |
+
7,
|
52 |
+
11
|
53 |
+
],
|
54 |
+
"resblock_dilation_sizes": [
|
55 |
+
[
|
56 |
+
1,
|
57 |
+
3,
|
58 |
+
5
|
59 |
+
],
|
60 |
+
[
|
61 |
+
1,
|
62 |
+
3,
|
63 |
+
5
|
64 |
+
],
|
65 |
+
[
|
66 |
+
1,
|
67 |
+
3,
|
68 |
+
5
|
69 |
+
]
|
70 |
+
],
|
71 |
+
"upsample_rates": [
|
72 |
+
8,
|
73 |
+
8,
|
74 |
+
2,
|
75 |
+
2
|
76 |
+
],
|
77 |
+
"upsample_initial_channel": 512,
|
78 |
+
"upsample_kernel_sizes": [
|
79 |
+
16,
|
80 |
+
16,
|
81 |
+
4,
|
82 |
+
4
|
83 |
+
],
|
84 |
+
"n_layers_q": 3,
|
85 |
+
"use_spectral_norm": false
|
86 |
+
}
|
87 |
+
}
|
khm/vocab.txt
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
แ
|
2 |
+
แ
|
3 |
+
แข
|
4 |
+
แ
|
5 |
+
แ
|
6 |
+
แ
|
7 |
+
แพ
|
8 |
+
แ
|
9 |
+
แ
|
10 |
+
แ
|
11 |
+
แ
|
12 |
+
แฅ
|
13 |
+
แ
|
14 |
+
แฝ
|
15 |
+
แ
|
16 |
+
q
|
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 |
+
1
|
59 |
+
แ
|
60 |
+
แ
|
61 |
+
แน
|
62 |
+
แ
|
63 |
+
แ
|
64 |
+
แ
|
65 |
+
แ
|
66 |
+
แ
|
67 |
+
แฎ
|
68 |
+
แ
|
69 |
+
แ
|
70 |
+
แบ
|
71 |
+
แช
|
72 |
+
-
|
73 |
+
แ
|
74 |
+
แ
|
packages.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
libsndfile1
|
2 |
+
espeak-ng
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
ttsmms==0.6
|
2 |
+
gradio==3.32.0
|