mcPear commited on
Commit
0cdc3ae
·
verified ·
1 Parent(s): c24c082

ONNX: every voice × style baked as speaker rows; default voice trio (Faszczewska+Masiak+Bielenia); structured voices.json

Browse files
README.md CHANGED
@@ -36,36 +36,42 @@ git clone https://github.com/machinekind/tts-pl-playground.git && cd tts-pl-play
36
  python -c "from huggingface_hub import snapshot_download as d; d('machinekind/Matcha-TTS-PL', local_dir='.')"
37
  python playground.py --port 8771 # UI: voices, blends, style tokens, effects, sequence composer, video visualizer
38
  python synth_samples.py --ckpt model/matcha_pl_target.ckpt --vocoder vocoder/hifigan_pl.pt \
39
- --sentences my_sentences.txt --voice "0.5*6+0.5*3" --steps 4 --temperature 0.5 --out out/
40
  ```
41
- ONNX Runtime (CPU or GPU), no PyTorch needed at run time:
42
  ```python
43
  import onnxruntime as ort, numpy as np
44
  sess = ort.InferenceSession("onnx/matcha_pl_voices_t4.onnx")
45
  x = phonemes # int64 [1, T]: espeak-ng "pl" ids from the playground's polish_cleaners (see RECIPE.md §1)
46
- wav, n = sess.run(None, {"x": x, "x_lengths": np.array([x.shape[1]]), "scales": np.array([0.5, 0.95], np.float32), "spks": np.array([24])})
47
  ```
48
 
49
  ## Voices
50
 
51
  Speaker ids 0–7 are the target readers (0 Bartosz Bielenia, 1 Katarzyna Faszczewska, 2 Wojciech Masiak, 3 Bartosz Głogowski, 4 Jan Staszczyk, 5 Marek Proszek, 6 Piotr Kopa, 7 Radosław Krzyżowski); ids 8–19 are base-training speakers kept for completeness.
52
- Blend voices by averaging embedding rows (`--voice "0.5*6+0.5*3"`). The ONNX graphs have these blends baked in as
53
- extra speaker ids:
54
-
55
- | id | name | blend (weight × speaker id) |
56
- |---|---|---|
57
- | 20 | `kopa` | 6 |
58
- | 21 | `glogowski` | 3 |
59
- | 22 | `faszczewska` | 1 |
60
- | 23 | `bielenia` | 0 |
61
- | 24 | `mix3` | 0.5*6+0.3*3+0.2*1 |
62
- | 25 | `kopa_glogowski` | 0.5*6+0.5*3 |
63
-
64
- `mix3` (0.5 Kopa + 0.3 Głogowski + 0.2 Faszczewska) and `kopa_glogowski` are the recommended robot voices.
 
 
 
 
 
 
65
 
66
  ## Style tokens
67
 
68
- An extra embedding added to the speaker embedding (pass `styles=<id>` to `synthesise`, or bake a row for ONNX).
69
  Neutral = `7`. Pitch-range tokens move the spread by about ±1.3 semitones; the question tokens give a rising
70
  terminal contour for yes/no questions (Polish wh-questions fall — write real punctuation, "?" drives intonation).
71
 
 
36
  python -c "from huggingface_hub import snapshot_download as d; d('machinekind/Matcha-TTS-PL', local_dir='.')"
37
  python playground.py --port 8771 # UI: voices, blends, style tokens, effects, sequence composer, video visualizer
38
  python synth_samples.py --ckpt model/matcha_pl_target.ckpt --vocoder vocoder/hifigan_pl.pt \
39
+ --sentences my_sentences.txt --voice "0.3333*1+0.3333*2+0.3334*0" --steps 4 --temperature 0.5 --out out/
40
  ```
41
+ ONNX Runtime (CPU or GPU), no PyTorch needed at run time (`spks` 20 = the default `trio` voice, see *Voices*):
42
  ```python
43
  import onnxruntime as ort, numpy as np
44
  sess = ort.InferenceSession("onnx/matcha_pl_voices_t4.onnx")
45
  x = phonemes # int64 [1, T]: espeak-ng "pl" ids from the playground's polish_cleaners (see RECIPE.md §1)
46
+ wav, n = sess.run(None, {"x": x, "x_lengths": np.array([x.shape[1]]), "scales": np.array([0.5, 0.95], np.float32), "spks": np.array([20])})
47
  ```
48
 
49
  ## Voices
50
 
51
  Speaker ids 0–7 are the target readers (0 Bartosz Bielenia, 1 Katarzyna Faszczewska, 2 Wojciech Masiak, 3 Bartosz Głogowski, 4 Jan Staszczyk, 5 Marek Proszek, 6 Piotr Kopa, 7 Radosław Krzyżowski); ids 8–19 are base-training speakers kept for completeness.
52
+ Blend voices by averaging embedding rows (`--voice "0.33*1+0.33*2+0.34*0"`). The ONNX graphs cannot take a style input,
53
+ so every voice × style combination is baked in as an extra speaker row; `onnx/voices.json` maps
54
+ `voices[key].id` (no style) and `voices[key].styles[style_id]` to the row to pass as `spks`:
55
+
56
+ | key | voice | blend (weight × speaker id) | row, no style | rows with style 0–17 |
57
+ |---|---|---|---|---|
58
+ | `trio` | Faszczewska + Masiak + Bielenia (⅓ each) · default | 0.3333*1+0.3333*2+0.3334*0 | 20 | 21–38 |
59
+ | `mix3` | mix3 · Kopa 0.5 + Głogowski 0.3 + Faszczewska 0.2 | 0.5*6+0.3*3+0.2*1 | 39 | 40–57 |
60
+ | `kopa_glogowski` | Kopa 0.5 + Głogowski 0.5 | 0.5*6+0.5*3 | 58 | 59–76 |
61
+ | `reader_0` | Bartosz Bielenia | 0 | 0 | 77–94 |
62
+ | `reader_1` | Katarzyna Faszczewska | 1 | 1 | 95–112 |
63
+ | `reader_2` | Wojciech Masiak | 2 | 2 | 113–130 |
64
+ | `reader_3` | Bartosz Głogowski | 3 | 3 | 131–148 |
65
+ | `reader_4` | Jan Staszczyk | 4 | 4 | 149–166 |
66
+ | `reader_5` | Marek Proszek | 5 | 5 | 167–184 |
67
+ | `reader_6` | Piotr Kopa | 6 | 6 | 185–202 |
68
+ | `reader_7` | Radosław Krzyżowski | 7 | 7 | 203–220 |
69
+
70
+ The default voice is `trio`, an equal blend of Katarzyna Faszczewska, Wojciech Masiak and Bartosz Bielenia.
71
 
72
  ## Style tokens
73
 
74
+ An extra embedding added to the speaker embedding: pass `styles=<id>` to `synthesise` in PyTorch; in ONNX pick the baked row from `onnx/voices.json`.
75
  Neutral = `7`. Pitch-range tokens move the spread by about ±1.3 semitones; the question tokens give a rising
76
  terminal contour for yes/no questions (Polish wh-questions fall — write real punctuation, "?" drives intonation).
77
 
onnx/matcha_pl_voices_t2.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:592c27f56bb1f0a4d887c1c0d28073e61da0f6296c335a2b385f1a7d785fb8db
3
- size 140056083
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8bcb52a6c3a8fb0ac9b7a1e091c28b303af56b13d8686ea671574f0d1c12bb1d
3
+ size 140106006
onnx/matcha_pl_voices_t4.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bfe75b72a4cf7c492c06c2742b36e383d90b03c5edb7092805662ac9e47be3a8
3
- size 140558613
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e90fb19c21ec51299e20001d9d53f02319e333484a6d9bc6e9a5869fa3774c8f
3
+ size 140608536
onnx/voices.json CHANGED
@@ -1,32 +1,301 @@
1
  {
2
- "kopa": {
3
- "id": 20,
4
- "spec": "6",
5
- "style": null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  },
7
- "glogowski": {
8
- "id": 21,
9
- "spec": "3",
10
- "style": null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  },
12
- "faszczewska": {
13
- "id": 22,
14
- "spec": "1",
15
- "style": null
16
- },
17
- "bielenia": {
18
- "id": 23,
19
- "spec": "0",
20
- "style": null
21
- },
22
- "mix3": {
23
- "id": 24,
24
- "spec": "0.5*6+0.3*3+0.2*1",
25
- "style": null
26
- },
27
- "kopa_glogowski": {
28
- "id": 25,
29
- "spec": "0.5*6+0.5*3",
30
- "style": null
31
- }
32
  }
 
1
  {
2
+ "default": "trio",
3
+ "styles": {
4
+ "0": "flat-range · slow",
5
+ "1": "flat-range · slow · question",
6
+ "2": "flat-range · normal",
7
+ "3": "flat-range · normal · question",
8
+ "4": "flat-range · fast",
9
+ "5": "flat-range · fast · question",
10
+ "6": "mid-range · slow",
11
+ "7": "mid-range · slow · question",
12
+ "8": "mid-range · normal",
13
+ "9": "mid-range · normal · question",
14
+ "10": "mid-range · fast",
15
+ "11": "mid-range · fast · question",
16
+ "12": "wide-range · slow",
17
+ "13": "wide-range · slow · question",
18
+ "14": "wide-range · normal",
19
+ "15": "wide-range · normal · question",
20
+ "16": "wide-range · fast",
21
+ "17": "wide-range · fast · question"
22
  },
23
+ "voices": {
24
+ "trio": {
25
+ "label": "Faszczewska + Masiak + Bielenia (⅓ each) · default",
26
+ "blend": "0.3333*1+0.3333*2+0.3334*0",
27
+ "id": 20,
28
+ "styles": {
29
+ "0": 21,
30
+ "1": 22,
31
+ "2": 23,
32
+ "3": 24,
33
+ "4": 25,
34
+ "5": 26,
35
+ "6": 27,
36
+ "7": 28,
37
+ "8": 29,
38
+ "9": 30,
39
+ "10": 31,
40
+ "11": 32,
41
+ "12": 33,
42
+ "13": 34,
43
+ "14": 35,
44
+ "15": 36,
45
+ "16": 37,
46
+ "17": 38
47
+ }
48
+ },
49
+ "mix3": {
50
+ "label": "mix3 · Kopa 0.5 + Głogowski 0.3 + Faszczewska 0.2",
51
+ "blend": "0.5*6+0.3*3+0.2*1",
52
+ "id": 39,
53
+ "styles": {
54
+ "0": 40,
55
+ "1": 41,
56
+ "2": 42,
57
+ "3": 43,
58
+ "4": 44,
59
+ "5": 45,
60
+ "6": 46,
61
+ "7": 47,
62
+ "8": 48,
63
+ "9": 49,
64
+ "10": 50,
65
+ "11": 51,
66
+ "12": 52,
67
+ "13": 53,
68
+ "14": 54,
69
+ "15": 55,
70
+ "16": 56,
71
+ "17": 57
72
+ }
73
+ },
74
+ "kopa_glogowski": {
75
+ "label": "Kopa 0.5 + Głogowski 0.5",
76
+ "blend": "0.5*6+0.5*3",
77
+ "id": 58,
78
+ "styles": {
79
+ "0": 59,
80
+ "1": 60,
81
+ "2": 61,
82
+ "3": 62,
83
+ "4": 63,
84
+ "5": 64,
85
+ "6": 65,
86
+ "7": 66,
87
+ "8": 67,
88
+ "9": 68,
89
+ "10": 69,
90
+ "11": 70,
91
+ "12": 71,
92
+ "13": 72,
93
+ "14": 73,
94
+ "15": 74,
95
+ "16": 75,
96
+ "17": 76
97
+ }
98
+ },
99
+ "reader_0": {
100
+ "label": "Bartosz Bielenia",
101
+ "blend": "0",
102
+ "id": 0,
103
+ "styles": {
104
+ "0": 77,
105
+ "1": 78,
106
+ "2": 79,
107
+ "3": 80,
108
+ "4": 81,
109
+ "5": 82,
110
+ "6": 83,
111
+ "7": 84,
112
+ "8": 85,
113
+ "9": 86,
114
+ "10": 87,
115
+ "11": 88,
116
+ "12": 89,
117
+ "13": 90,
118
+ "14": 91,
119
+ "15": 92,
120
+ "16": 93,
121
+ "17": 94
122
+ }
123
+ },
124
+ "reader_1": {
125
+ "label": "Katarzyna Faszczewska",
126
+ "blend": "1",
127
+ "id": 1,
128
+ "styles": {
129
+ "0": 95,
130
+ "1": 96,
131
+ "2": 97,
132
+ "3": 98,
133
+ "4": 99,
134
+ "5": 100,
135
+ "6": 101,
136
+ "7": 102,
137
+ "8": 103,
138
+ "9": 104,
139
+ "10": 105,
140
+ "11": 106,
141
+ "12": 107,
142
+ "13": 108,
143
+ "14": 109,
144
+ "15": 110,
145
+ "16": 111,
146
+ "17": 112
147
+ }
148
+ },
149
+ "reader_2": {
150
+ "label": "Wojciech Masiak",
151
+ "blend": "2",
152
+ "id": 2,
153
+ "styles": {
154
+ "0": 113,
155
+ "1": 114,
156
+ "2": 115,
157
+ "3": 116,
158
+ "4": 117,
159
+ "5": 118,
160
+ "6": 119,
161
+ "7": 120,
162
+ "8": 121,
163
+ "9": 122,
164
+ "10": 123,
165
+ "11": 124,
166
+ "12": 125,
167
+ "13": 126,
168
+ "14": 127,
169
+ "15": 128,
170
+ "16": 129,
171
+ "17": 130
172
+ }
173
+ },
174
+ "reader_3": {
175
+ "label": "Bartosz Głogowski",
176
+ "blend": "3",
177
+ "id": 3,
178
+ "styles": {
179
+ "0": 131,
180
+ "1": 132,
181
+ "2": 133,
182
+ "3": 134,
183
+ "4": 135,
184
+ "5": 136,
185
+ "6": 137,
186
+ "7": 138,
187
+ "8": 139,
188
+ "9": 140,
189
+ "10": 141,
190
+ "11": 142,
191
+ "12": 143,
192
+ "13": 144,
193
+ "14": 145,
194
+ "15": 146,
195
+ "16": 147,
196
+ "17": 148
197
+ }
198
+ },
199
+ "reader_4": {
200
+ "label": "Jan Staszczyk",
201
+ "blend": "4",
202
+ "id": 4,
203
+ "styles": {
204
+ "0": 149,
205
+ "1": 150,
206
+ "2": 151,
207
+ "3": 152,
208
+ "4": 153,
209
+ "5": 154,
210
+ "6": 155,
211
+ "7": 156,
212
+ "8": 157,
213
+ "9": 158,
214
+ "10": 159,
215
+ "11": 160,
216
+ "12": 161,
217
+ "13": 162,
218
+ "14": 163,
219
+ "15": 164,
220
+ "16": 165,
221
+ "17": 166
222
+ }
223
+ },
224
+ "reader_5": {
225
+ "label": "Marek Proszek",
226
+ "blend": "5",
227
+ "id": 5,
228
+ "styles": {
229
+ "0": 167,
230
+ "1": 168,
231
+ "2": 169,
232
+ "3": 170,
233
+ "4": 171,
234
+ "5": 172,
235
+ "6": 173,
236
+ "7": 174,
237
+ "8": 175,
238
+ "9": 176,
239
+ "10": 177,
240
+ "11": 178,
241
+ "12": 179,
242
+ "13": 180,
243
+ "14": 181,
244
+ "15": 182,
245
+ "16": 183,
246
+ "17": 184
247
+ }
248
+ },
249
+ "reader_6": {
250
+ "label": "Piotr Kopa",
251
+ "blend": "6",
252
+ "id": 6,
253
+ "styles": {
254
+ "0": 185,
255
+ "1": 186,
256
+ "2": 187,
257
+ "3": 188,
258
+ "4": 189,
259
+ "5": 190,
260
+ "6": 191,
261
+ "7": 192,
262
+ "8": 193,
263
+ "9": 194,
264
+ "10": 195,
265
+ "11": 196,
266
+ "12": 197,
267
+ "13": 198,
268
+ "14": 199,
269
+ "15": 200,
270
+ "16": 201,
271
+ "17": 202
272
+ }
273
+ },
274
+ "reader_7": {
275
+ "label": "Radosław Krzyżowski",
276
+ "blend": "7",
277
+ "id": 7,
278
+ "styles": {
279
+ "0": 203,
280
+ "1": 204,
281
+ "2": 205,
282
+ "3": 206,
283
+ "4": 207,
284
+ "5": 208,
285
+ "6": 209,
286
+ "7": 210,
287
+ "8": 211,
288
+ "9": 212,
289
+ "10": 213,
290
+ "11": 214,
291
+ "12": 215,
292
+ "13": 216,
293
+ "14": 217,
294
+ "15": 218,
295
+ "16": 219,
296
+ "17": 220
297
+ }
298
+ }
299
  },
300
+ "note": "spks row = voices[key].id (no style) or voices[key].styles[style_id]; rows are speaker embedding + style embedding, baked before export"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }