dinhthuan commited on
Commit
9f210d6
·
verified ·
1 Parent(s): 26d16d0

Update model card with ONNX usage

Browse files
Files changed (1) hide show
  1. README.md +35 -56
README.md CHANGED
@@ -5,16 +5,22 @@ pipeline_tag: text-to-speech
5
  tags:
6
  - kokoro
7
  - vietnamese
8
- - tts
9
  - text-to-speech
10
- - vig2p
11
  license: apache-2.0
12
- library_name: kokoro
13
  ---
14
 
15
  # Kokoro Vietnamese
16
 
17
- Vietnamese Kokoro TTS inference model. Vietnamese G2P is handled by [`vig2p`](https://pypi.org/project/vig2p/).
 
 
 
 
 
 
 
 
18
 
19
  ## Install
20
 
@@ -24,70 +30,43 @@ cd Kokoro-Vietnamese
24
  pip install -e .
25
  ```
26
 
27
- Install the PyTorch build that matches your machine first if you need CUDA.
28
-
29
- ## Voices
30
-
31
- Use these names with `voice=...` in Python or `--voice ...` in the CLI.
32
-
33
- | Voice | Name |
34
- | --- | --- |
35
- | `diem_trinh` | Diễm Trinh |
36
- | `hung_thinh` | Hưng Thịnh |
37
- | `mai_linh` | Mai Linh |
38
- | `mai_loan` | Mai Loan |
39
- | `manh_dung` | Mạnh Dũng |
40
- | `my_yen` | Mỹ Yến |
41
- | `ngoc_huyen` | Ngọc Huyền |
42
- | `phat_tai` | Phát Tài |
43
- | `thanh_dat` | Thành Đạt |
44
- | `thuc_trinh` | Thục Trinh |
45
- | `tuan_ngoc` | Tuấn Ngọc |
46
- | `storyvert` | storyvert |
47
- | `duc_an` | Đức An |
48
- | `duc_duy` | đức duy |
49
-
50
- ## Python API
51
-
52
- ```python
53
- import soundfile as sf
54
- from kokoro_vietnamese import KokoroVietnamese
55
-
56
- tts = KokoroVietnamese(device="cuda", voice="diem_trinh")
57
-
58
- audio, phonemes = tts.synthesize(
59
- "Giữa một buổi chiều yên tĩnh, cô ấy kể lại câu chuyện bằng một giọng nói ấm áp và chậm rãi."
60
- )
61
 
62
- sf.write("sample.wav", audio, 24000)
63
- print(phonemes)
64
- ```
65
-
66
- Use another voice:
67
-
68
- ```python
69
- tts = KokoroVietnamese(device="cuda", voice="mai_linh")
70
- audio, phonemes = tts.synthesize("Hôm nay trời trong xanh, gió thổi nhẹ qua hiên nhà.")
71
  ```
72
 
73
- ## CLI
74
 
75
  ```bash
76
  kokoro-vietnamese \
77
- --text "Giữa một buổi chiều yên tĩnh, ấy kể lại câu chuyện bằng một giọng nói ấm áp và chậm rãi." \
 
78
  --voice diem_trinh \
79
- --output sample.wav \
80
  --device cuda
81
  ```
82
 
83
- List voices:
84
 
85
  ```bash
86
- kokoro-vietnamese --list-voices
 
 
 
 
87
  ```
88
 
89
- ## Notes
 
 
 
 
 
 
 
 
 
 
90
 
91
- - Text is split by sentence punctuation and merged with a short crossfade.
92
- - The model expects Vietnamese text normalized enough for `vig2p`.
93
- - The voicepacks are derived from the LarVoice multi-speaker training set and are distributed as inference artifacts.
 
5
  tags:
6
  - kokoro
7
  - vietnamese
 
8
  - text-to-speech
9
+ - onnx
10
  license: apache-2.0
 
11
  ---
12
 
13
  # Kokoro Vietnamese
14
 
15
+ Fine-tuned Vietnamese Kokoro TTS artifacts.
16
+
17
+ ## Files
18
+
19
+ - `kokoro_vi.pth`: PyTorch Kokoro `KModel` checkpoint for inference.
20
+ - `kokoro_vi.onnx`: ONNX Runtime export of the acoustic model.
21
+ - `kokoro_vi_voicepack.pt`: default Vietnamese voicepack.
22
+ - `config.json`: Kokoro config/vocab used by both PyTorch and ONNX inference.
23
+ - `voicepacks/*.pt`: additional Vietnamese voicepacks.
24
 
25
  ## Install
26
 
 
30
  pip install -e .
31
  ```
32
 
33
+ For ONNX Runtime:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ ```bash
36
+ pip install -e ".[onnx]"
 
 
 
 
 
 
 
37
  ```
38
 
39
+ ## PyTorch Inference
40
 
41
  ```bash
42
  kokoro-vietnamese \
43
+ --text "Xin chào, hôm nay tôi đang kiểm tra giọng đọc tiếng Việt." \
44
+ --output outputs/sample.wav \
45
  --voice diem_trinh \
 
46
  --device cuda
47
  ```
48
 
49
+ ## ONNX Runtime Inference
50
 
51
  ```bash
52
+ kokoro-vietnamese-onnx \
53
+ --text "Tường nhà khách đã được sơn lại." \
54
+ --output outputs/onnx.wav \
55
+ --device cpu \
56
+ --print-phonemes
57
  ```
58
 
59
+ The ONNX CLI downloads `kokoro_vi.onnx`, `kokoro_vi_voicepack.pt`, and
60
+ `config.json` from this repository when local paths are not provided. Install
61
+ `onnxruntime-gpu` and pass `--device cuda` to use CUDAExecutionProvider when
62
+ available.
63
+
64
+ ## Export ONNX Yourself
65
+
66
+ ```bash
67
+ kokoro-vietnamese-export-onnx \
68
+ --output outputs/kokoro_vi.onnx
69
+ ```
70
 
71
+ Vietnamese G2P is handled by `vig2p`, matching the GitHub inference and
72
+ training code.