kevinwang676 commited on
Commit
de332ab
·
1 Parent(s): 710a66d

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -1,35 +1,2 @@
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
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DUMMY1
2
+ DUMMY2
3
+ DUMMY3
4
+ logs
5
+ __pycache__
6
+ .ipynb_checkpoints
7
+ .*.swp
8
+
9
+ build
10
+ *.c
11
+ monotonic_align/monotonic_align
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Kevin Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,13 +1,17 @@
1
- ---
2
- title: VITS2 Chinese
3
- emoji: 🐨
4
- colorFrom: pink
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 3.44.4
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
1
+ # VITS2-Chinese 🎶🌟💕
2
+ ## 只需上传一段语音素材,程序自动将语音切片、标注、预处理,一键训练
3
+ [English]()
4
+ ## 环境配置
5
+ 1. 运行
6
+ ```
7
+ git clone https://github.com/KevinWang676/VITS2-Chinese.git
8
+ cd VITS2-Chinese
9
+ pip install -r requirements.txt
10
+ ```
11
+ 2. 运行
12
+ ```
13
+ cd monotonic_align
14
+ python setup.py build_ext --inplace
15
+ ```
16
+ 3. 上传语音文件:请上传一段**中文**、**单说话人**的语音文件,建议为长度大于10分钟的`.wav`文件
17
+ ## 语音切片
attentions.py ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import math
3
+ import numpy as np
4
+ import torch
5
+ from torch import nn
6
+ from torch.nn import functional as F
7
+ from torch.nn.utils import remove_weight_norm, weight_norm
8
+
9
+ import commons
10
+ import modules
11
+ from modules import LayerNorm
12
+
13
+
14
+ class Encoder(nn.Module): # backward compatible vits2 encoder
15
+ def __init__(
16
+ self,
17
+ hidden_channels,
18
+ filter_channels,
19
+ n_heads,
20
+ n_layers,
21
+ kernel_size=1,
22
+ p_dropout=0.0,
23
+ window_size=4,
24
+ **kwargs
25
+ ):
26
+ super().__init__()
27
+ self.hidden_channels = hidden_channels
28
+ self.filter_channels = filter_channels
29
+ self.n_heads = n_heads
30
+ self.n_layers = n_layers
31
+ self.kernel_size = kernel_size
32
+ self.p_dropout = p_dropout
33
+ self.window_size = window_size
34
+
35
+ self.drop = nn.Dropout(p_dropout)
36
+ self.attn_layers = nn.ModuleList()
37
+ self.norm_layers_1 = nn.ModuleList()
38
+ self.ffn_layers = nn.ModuleList()
39
+ self.norm_layers_2 = nn.ModuleList()
40
+ # if kwargs has spk_emb_dim, then add a linear layer to project spk_emb_dim to hidden_channels
41
+ self.cond_layer_idx = self.n_layers
42
+ if "gin_channels" in kwargs:
43
+ self.gin_channels = kwargs["gin_channels"]
44
+ if self.gin_channels != 0:
45
+ self.spk_emb_linear = nn.Linear(self.gin_channels, self.hidden_channels)
46
+ # vits2 says 3rd block, so idx is 2 by default
47
+ self.cond_layer_idx = (
48
+ kwargs["cond_layer_idx"] if "cond_layer_idx" in kwargs else 2
49
+ )
50
+ assert (
51
+ self.cond_layer_idx < self.n_layers
52
+ ), "cond_layer_idx should be less than n_layers"
53
+
54
+ for i in range(self.n_layers):
55
+ self.attn_layers.append(
56
+ MultiHeadAttention(
57
+ hidden_channels,
58
+ hidden_channels,
59
+ n_heads,
60
+ p_dropout=p_dropout,
61
+ window_size=window_size,
62
+ )
63
+ )
64
+ self.norm_layers_1.append(LayerNorm(hidden_channels))
65
+ self.ffn_layers.append(
66
+ FFN(
67
+ hidden_channels,
68
+ hidden_channels,
69
+ filter_channels,
70
+ kernel_size,
71
+ p_dropout=p_dropout,
72
+ )
73
+ )
74
+ self.norm_layers_2.append(LayerNorm(hidden_channels))
75
+
76
+ def forward(self, x, x_mask, g=None):
77
+ attn_mask = x_mask.unsqueeze(2) * x_mask.unsqueeze(-1)
78
+ x = x * x_mask
79
+ for i in range(self.n_layers):
80
+ if i == self.cond_layer_idx and g is not None:
81
+ g = self.spk_emb_linear(g.transpose(1, 2))
82
+ g = g.transpose(1, 2)
83
+ x = x + g
84
+ x = x * x_mask
85
+ y = self.attn_layers[i](x, x, attn_mask)
86
+ y = self.drop(y)
87
+ x = self.norm_layers_1[i](x + y)
88
+
89
+ y = self.ffn_layers[i](x, x_mask)
90
+ y = self.drop(y)
91
+ x = self.norm_layers_2[i](x + y)
92
+ x = x * x_mask
93
+ return x
94
+
95
+
96
+ class Decoder(nn.Module):
97
+ def __init__(
98
+ self,
99
+ hidden_channels,
100
+ filter_channels,
101
+ n_heads,
102
+ n_layers,
103
+ kernel_size=1,
104
+ p_dropout=0.0,
105
+ proximal_bias=False,
106
+ proximal_init=True,
107
+ **kwargs
108
+ ):
109
+ super().__init__()
110
+ self.hidden_channels = hidden_channels
111
+ self.filter_channels = filter_channels
112
+ self.n_heads = n_heads
113
+ self.n_layers = n_layers
114
+ self.kernel_size = kernel_size
115
+ self.p_dropout = p_dropout
116
+ self.proximal_bias = proximal_bias
117
+ self.proximal_init = proximal_init
118
+
119
+ self.drop = nn.Dropout(p_dropout)
120
+ self.self_attn_layers = nn.ModuleList()
121
+ self.norm_layers_0 = nn.ModuleList()
122
+ self.encdec_attn_layers = nn.ModuleList()
123
+ self.norm_layers_1 = nn.ModuleList()
124
+ self.ffn_layers = nn.ModuleList()
125
+ self.norm_layers_2 = nn.ModuleList()
126
+ for i in range(self.n_layers):
127
+ self.self_attn_layers.append(
128
+ MultiHeadAttention(
129
+ hidden_channels,
130
+ hidden_channels,
131
+ n_heads,
132
+ p_dropout=p_dropout,
133
+ proximal_bias=proximal_bias,
134
+ proximal_init=proximal_init,
135
+ )
136
+ )
137
+ self.norm_layers_0.append(LayerNorm(hidden_channels))
138
+ self.encdec_attn_layers.append(
139
+ MultiHeadAttention(
140
+ hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout
141
+ )
142
+ )
143
+ self.norm_layers_1.append(LayerNorm(hidden_channels))
144
+ self.ffn_layers.append(
145
+ FFN(
146
+ hidden_channels,
147
+ hidden_channels,
148
+ filter_channels,
149
+ kernel_size,
150
+ p_dropout=p_dropout,
151
+ causal=True,
152
+ )
153
+ )
154
+ self.norm_layers_2.append(LayerNorm(hidden_channels))
155
+
156
+ def forward(self, x, x_mask, h, h_mask):
157
+ """
158
+ x: decoder input
159
+ h: encoder output
160
+ """
161
+ self_attn_mask = commons.subsequent_mask(x_mask.size(2)).to(
162
+ device=x.device, dtype=x.dtype
163
+ )
164
+ encdec_attn_mask = h_mask.unsqueeze(2) * x_mask.unsqueeze(-1)
165
+ x = x * x_mask
166
+ for i in range(self.n_layers):
167
+ y = self.self_attn_layers[i](x, x, self_attn_mask)
168
+ y = self.drop(y)
169
+ x = self.norm_layers_0[i](x + y)
170
+
171
+ y = self.encdec_attn_layers[i](x, h, encdec_attn_mask)
172
+ y = self.drop(y)
173
+ x = self.norm_layers_1[i](x + y)
174
+
175
+ y = self.ffn_layers[i](x, x_mask)
176
+ y = self.drop(y)
177
+ x = self.norm_layers_2[i](x + y)
178
+ x = x * x_mask
179
+ return x
180
+
181
+
182
+ class MultiHeadAttention(nn.Module):
183
+ def __init__(
184
+ self,
185
+ channels,
186
+ out_channels,
187
+ n_heads,
188
+ p_dropout=0.0,
189
+ window_size=None,
190
+ heads_share=True,
191
+ block_length=None,
192
+ proximal_bias=False,
193
+ proximal_init=False,
194
+ ):
195
+ super().__init__()
196
+ assert channels % n_heads == 0
197
+
198
+ self.channels = channels
199
+ self.out_channels = out_channels
200
+ self.n_heads = n_heads
201
+ self.p_dropout = p_dropout
202
+ self.window_size = window_size
203
+ self.heads_share = heads_share
204
+ self.block_length = block_length
205
+ self.proximal_bias = proximal_bias
206
+ self.proximal_init = proximal_init
207
+ self.attn = None
208
+
209
+ self.k_channels = channels // n_heads
210
+ self.conv_q = nn.Conv1d(channels, channels, 1)
211
+ self.conv_k = nn.Conv1d(channels, channels, 1)
212
+ self.conv_v = nn.Conv1d(channels, channels, 1)
213
+ self.conv_o = nn.Conv1d(channels, out_channels, 1)
214
+ self.drop = nn.Dropout(p_dropout)
215
+
216
+ if window_size is not None:
217
+ n_heads_rel = 1 if heads_share else n_heads
218
+ rel_stddev = self.k_channels**-0.5
219
+ self.emb_rel_k = nn.Parameter(
220
+ torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels)
221
+ * rel_stddev
222
+ )
223
+ self.emb_rel_v = nn.Parameter(
224
+ torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels)
225
+ * rel_stddev
226
+ )
227
+
228
+ nn.init.xavier_uniform_(self.conv_q.weight)
229
+ nn.init.xavier_uniform_(self.conv_k.weight)
230
+ nn.init.xavier_uniform_(self.conv_v.weight)
231
+ if proximal_init:
232
+ with torch.no_grad():
233
+ self.conv_k.weight.copy_(self.conv_q.weight)
234
+ self.conv_k.bias.copy_(self.conv_q.bias)
235
+
236
+ def forward(self, x, c, attn_mask=None):
237
+ q = self.conv_q(x)
238
+ k = self.conv_k(c)
239
+ v = self.conv_v(c)
240
+
241
+ x, self.attn = self.attention(q, k, v, mask=attn_mask)
242
+
243
+ x = self.conv_o(x)
244
+ return x
245
+
246
+ def attention(self, query, key, value, mask=None):
247
+ # reshape [b, d, t] -> [b, n_h, t, d_k]
248
+ b, d, t_s, t_t = (*key.size(), query.size(2))
249
+ query = query.view(b, self.n_heads, self.k_channels, t_t).transpose(2, 3)
250
+ key = key.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3)
251
+ value = value.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3)
252
+
253
+ scores = torch.matmul(query / math.sqrt(self.k_channels), key.transpose(-2, -1))
254
+ if self.window_size is not None:
255
+ assert (
256
+ t_s == t_t
257
+ ), "Relative attention is only available for self-attention."
258
+ key_relative_embeddings = self._get_relative_embeddings(self.emb_rel_k, t_s)
259
+ rel_logits = self._matmul_with_relative_keys(
260
+ query / math.sqrt(self.k_channels), key_relative_embeddings
261
+ )
262
+ scores_local = self._relative_position_to_absolute_position(rel_logits)
263
+ scores = scores + scores_local
264
+ if self.proximal_bias:
265
+ assert t_s == t_t, "Proximal bias is only available for self-attention."
266
+ scores = scores + self._attention_bias_proximal(t_s).to(
267
+ device=scores.device, dtype=scores.dtype
268
+ )
269
+ if mask is not None:
270
+ scores = scores.masked_fill(mask == 0, -1e4)
271
+ if self.block_length is not None:
272
+ assert (
273
+ t_s == t_t
274
+ ), "Local attention is only available for self-attention."
275
+ block_mask = (
276
+ torch.ones_like(scores)
277
+ .triu(-self.block_length)
278
+ .tril(self.block_length)
279
+ )
280
+ scores = scores.masked_fill(block_mask == 0, -1e4)
281
+ p_attn = F.softmax(scores, dim=-1) # [b, n_h, t_t, t_s]
282
+ p_attn = self.drop(p_attn)
283
+ output = torch.matmul(p_attn, value)
284
+ if self.window_size is not None:
285
+ relative_weights = self._absolute_position_to_relative_position(p_attn)
286
+ value_relative_embeddings = self._get_relative_embeddings(
287
+ self.emb_rel_v, t_s
288
+ )
289
+ output = output + self._matmul_with_relative_values(
290
+ relative_weights, value_relative_embeddings
291
+ )
292
+ output = (
293
+ output.transpose(2, 3).contiguous().view(b, d, t_t)
294
+ ) # [b, n_h, t_t, d_k] -> [b, d, t_t]
295
+ return output, p_attn
296
+
297
+ def _matmul_with_relative_values(self, x, y):
298
+ """
299
+ x: [b, h, l, m]
300
+ y: [h or 1, m, d]
301
+ ret: [b, h, l, d]
302
+ """
303
+ ret = torch.matmul(x, y.unsqueeze(0))
304
+ return ret
305
+
306
+ def _matmul_with_relative_keys(self, x, y):
307
+ """
308
+ x: [b, h, l, d]
309
+ y: [h or 1, m, d]
310
+ ret: [b, h, l, m]
311
+ """
312
+ ret = torch.matmul(x, y.unsqueeze(0).transpose(-2, -1))
313
+ return ret
314
+
315
+ def _get_relative_embeddings(self, relative_embeddings, length):
316
+ max_relative_position = 2 * self.window_size + 1
317
+ # Pad first before slice to avoid using cond ops.
318
+ pad_length = max(length - (self.window_size + 1), 0)
319
+ slice_start_position = max((self.window_size + 1) - length, 0)
320
+ slice_end_position = slice_start_position + 2 * length - 1
321
+ if pad_length > 0:
322
+ padded_relative_embeddings = F.pad(
323
+ relative_embeddings,
324
+ commons.convert_pad_shape([[0, 0], [pad_length, pad_length], [0, 0]]),
325
+ )
326
+ else:
327
+ padded_relative_embeddings = relative_embeddings
328
+ used_relative_embeddings = padded_relative_embeddings[
329
+ :, slice_start_position:slice_end_position
330
+ ]
331
+ return used_relative_embeddings
332
+
333
+ def _relative_position_to_absolute_position(self, x):
334
+ """
335
+ x: [b, h, l, 2*l-1]
336
+ ret: [b, h, l, l]
337
+ """
338
+ batch, heads, length, _ = x.size()
339
+ # Concat columns of pad to shift from relative to absolute indexing.
340
+ x = F.pad(x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, 1]]))
341
+
342
+ # Concat extra elements so to add up to shape (len+1, 2*len-1).
343
+ x_flat = x.view([batch, heads, length * 2 * length])
344
+ x_flat = F.pad(
345
+ x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [0, length - 1]])
346
+ )
347
+
348
+ # Reshape and slice out the padded elements.
349
+ x_final = x_flat.view([batch, heads, length + 1, 2 * length - 1])[
350
+ :, :, :length, length - 1 :
351
+ ]
352
+ return x_final
353
+
354
+ def _absolute_position_to_relative_position(self, x):
355
+ """
356
+ x: [b, h, l, l]
357
+ ret: [b, h, l, 2*l-1]
358
+ """
359
+ batch, heads, length, _ = x.size()
360
+ # padd along column
361
+ x = F.pad(
362
+ x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, length - 1]])
363
+ )
364
+ x_flat = x.view([batch, heads, length**2 + length * (length - 1)])
365
+ # add 0's in the beginning that will skew the elements after reshape
366
+ x_flat = F.pad(x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [length, 0]]))
367
+ x_final = x_flat.view([batch, heads, length, 2 * length])[:, :, :, 1:]
368
+ return x_final
369
+
370
+ def _attention_bias_proximal(self, length):
371
+ """Bias for self-attention to encourage attention to close positions.
372
+ Args:
373
+ length: an integer scalar.
374
+ Returns:
375
+ a Tensor with shape [1, 1, length, length]
376
+ """
377
+ r = torch.arange(length, dtype=torch.float32)
378
+ diff = torch.unsqueeze(r, 0) - torch.unsqueeze(r, 1)
379
+ return torch.unsqueeze(torch.unsqueeze(-torch.log1p(torch.abs(diff)), 0), 0)
380
+
381
+
382
+ class FFN(nn.Module):
383
+ def __init__(
384
+ self,
385
+ in_channels,
386
+ out_channels,
387
+ filter_channels,
388
+ kernel_size,
389
+ p_dropout=0.0,
390
+ activation=None,
391
+ causal=False,
392
+ ):
393
+ super().__init__()
394
+ self.in_channels = in_channels
395
+ self.out_channels = out_channels
396
+ self.filter_channels = filter_channels
397
+ self.kernel_size = kernel_size
398
+ self.p_dropout = p_dropout
399
+ self.activation = activation
400
+ self.causal = causal
401
+
402
+ if causal:
403
+ self.padding = self._causal_padding
404
+ else:
405
+ self.padding = self._same_padding
406
+
407
+ self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size)
408
+ self.conv_2 = nn.Conv1d(filter_channels, out_channels, kernel_size)
409
+ self.drop = nn.Dropout(p_dropout)
410
+
411
+ def forward(self, x, x_mask):
412
+ x = self.conv_1(self.padding(x * x_mask))
413
+ if self.activation == "gelu":
414
+ x = x * torch.sigmoid(1.702 * x)
415
+ else:
416
+ x = torch.relu(x)
417
+ x = self.drop(x)
418
+ x = self.conv_2(self.padding(x * x_mask))
419
+ return x * x_mask
420
+
421
+ def _causal_padding(self, x):
422
+ if self.kernel_size == 1:
423
+ return x
424
+ pad_l = self.kernel_size - 1
425
+ pad_r = 0
426
+ padding = [[0, 0], [0, 0], [pad_l, pad_r]]
427
+ x = F.pad(x, commons.convert_pad_shape(padding))
428
+ return x
429
+
430
+ def _same_padding(self, x):
431
+ if self.kernel_size == 1:
432
+ return x
433
+ pad_l = (self.kernel_size - 1) // 2
434
+ pad_r = self.kernel_size // 2
435
+ padding = [[0, 0], [0, 0], [pad_l, pad_r]]
436
+ x = F.pad(x, commons.convert_pad_shape(padding))
437
+ return x
438
+
439
+
440
+ class Depthwise_Separable_Conv1D(nn.Module):
441
+ def __init__(
442
+ self,
443
+ in_channels,
444
+ out_channels,
445
+ kernel_size,
446
+ stride=1,
447
+ padding=0,
448
+ dilation=1,
449
+ bias=True,
450
+ padding_mode="zeros", # TODO: refine this type
451
+ device=None,
452
+ dtype=None,
453
+ ):
454
+ super().__init__()
455
+ self.depth_conv = nn.Conv1d(
456
+ in_channels=in_channels,
457
+ out_channels=in_channels,
458
+ kernel_size=kernel_size,
459
+ groups=in_channels,
460
+ stride=stride,
461
+ padding=padding,
462
+ dilation=dilation,
463
+ bias=bias,
464
+ padding_mode=padding_mode,
465
+ device=device,
466
+ dtype=dtype,
467
+ )
468
+ self.point_conv = nn.Conv1d(
469
+ in_channels=in_channels,
470
+ out_channels=out_channels,
471
+ kernel_size=1,
472
+ bias=bias,
473
+ device=device,
474
+ dtype=dtype,
475
+ )
476
+
477
+ def forward(self, input):
478
+ return self.point_conv(self.depth_conv(input))
479
+
480
+ def weight_norm(self):
481
+ self.depth_conv = weight_norm(self.depth_conv, name="weight")
482
+ self.point_conv = weight_norm(self.point_conv, name="weight")
483
+
484
+ def remove_weight_norm(self):
485
+ self.depth_conv = remove_weight_norm(self.depth_conv, name="weight")
486
+ self.point_conv = remove_weight_norm(self.point_conv, name="weight")
487
+
488
+
489
+ class Depthwise_Separable_TransposeConv1D(nn.Module):
490
+ def __init__(
491
+ self,
492
+ in_channels,
493
+ out_channels,
494
+ kernel_size,
495
+ stride=1,
496
+ padding=0,
497
+ output_padding=0,
498
+ bias=True,
499
+ dilation=1,
500
+ padding_mode="zeros", # TODO: refine this type
501
+ device=None,
502
+ dtype=None,
503
+ ):
504
+ super().__init__()
505
+ self.depth_conv = nn.ConvTranspose1d(
506
+ in_channels=in_channels,
507
+ out_channels=in_channels,
508
+ kernel_size=kernel_size,
509
+ groups=in_channels,
510
+ stride=stride,
511
+ output_padding=output_padding,
512
+ padding=padding,
513
+ dilation=dilation,
514
+ bias=bias,
515
+ padding_mode=padding_mode,
516
+ device=device,
517
+ dtype=dtype,
518
+ )
519
+ self.point_conv = nn.Conv1d(
520
+ in_channels=in_channels,
521
+ out_channels=out_channels,
522
+ kernel_size=1,
523
+ bias=bias,
524
+ device=device,
525
+ dtype=dtype,
526
+ )
527
+
528
+ def forward(self, input):
529
+ return self.point_conv(self.depth_conv(input))
530
+
531
+ def weight_norm(self):
532
+ self.depth_conv = weight_norm(self.depth_conv, name="weight")
533
+ self.point_conv = weight_norm(self.point_conv, name="weight")
534
+
535
+ def remove_weight_norm(self):
536
+ remove_weight_norm(self.depth_conv, name="weight")
537
+ remove_weight_norm(self.point_conv, name="weight")
538
+
539
+
540
+ def weight_norm_modules(module, name="weight", dim=0):
541
+ if isinstance(module, Depthwise_Separable_Conv1D) or isinstance(
542
+ module, Depthwise_Separable_TransposeConv1D
543
+ ):
544
+ module.weight_norm()
545
+ return module
546
+ else:
547
+ return weight_norm(module, name, dim)
548
+
549
+
550
+ def remove_weight_norm_modules(module, name="weight"):
551
+ if isinstance(module, Depthwise_Separable_Conv1D) or isinstance(
552
+ module, Depthwise_Separable_TransposeConv1D
553
+ ):
554
+ module.remove_weight_norm()
555
+ else:
556
+ remove_weight_norm(module, name)
557
+
558
+
559
+ class FFT(nn.Module):
560
+ def __init__(
561
+ self,
562
+ hidden_channels,
563
+ filter_channels,
564
+ n_heads,
565
+ n_layers=1,
566
+ kernel_size=1,
567
+ p_dropout=0.0,
568
+ proximal_bias=False,
569
+ proximal_init=True,
570
+ isflow=False,
571
+ **kwargs
572
+ ):
573
+ super().__init__()
574
+ self.hidden_channels = hidden_channels
575
+ self.filter_channels = filter_channels
576
+ self.n_heads = n_heads
577
+ self.n_layers = n_layers
578
+ self.kernel_size = kernel_size
579
+ self.p_dropout = p_dropout
580
+ self.proximal_bias = proximal_bias
581
+ self.proximal_init = proximal_init
582
+ if isflow and "gin_channels" in kwargs and kwargs["gin_channels"] > 0:
583
+ cond_layer = torch.nn.Conv1d(
584
+ kwargs["gin_channels"], 2 * hidden_channels * n_layers, 1
585
+ )
586
+ self.cond_pre = torch.nn.Conv1d(hidden_channels, 2 * hidden_channels, 1)
587
+ self.cond_layer = weight_norm_modules(cond_layer, name="weight")
588
+ self.gin_channels = kwargs["gin_channels"]
589
+ self.drop = nn.Dropout(p_dropout)
590
+ self.self_attn_layers = nn.ModuleList()
591
+ self.norm_layers_0 = nn.ModuleList()
592
+ self.ffn_layers = nn.ModuleList()
593
+ self.norm_layers_1 = nn.ModuleList()
594
+ for i in range(self.n_layers):
595
+ self.self_attn_layers.append(
596
+ MultiHeadAttention(
597
+ hidden_channels,
598
+ hidden_channels,
599
+ n_heads,
600
+ p_dropout=p_dropout,
601
+ proximal_bias=proximal_bias,
602
+ proximal_init=proximal_init,
603
+ )
604
+ )
605
+ self.norm_layers_0.append(LayerNorm(hidden_channels))
606
+ self.ffn_layers.append(
607
+ FFN(
608
+ hidden_channels,
609
+ hidden_channels,
610
+ filter_channels,
611
+ kernel_size,
612
+ p_dropout=p_dropout,
613
+ causal=True,
614
+ )
615
+ )
616
+ self.norm_layers_1.append(LayerNorm(hidden_channels))
617
+
618
+ def forward(self, x, x_mask, g=None):
619
+ """
620
+ x: decoder input
621
+ h: encoder output
622
+ """
623
+ if g is not None:
624
+ g = self.cond_layer(g)
625
+
626
+ self_attn_mask = commons.subsequent_mask(x_mask.size(2)).to(
627
+ device=x.device, dtype=x.dtype
628
+ )
629
+ x = x * x_mask
630
+ for i in range(self.n_layers):
631
+ if g is not None:
632
+ x = self.cond_pre(x)
633
+ cond_offset = i * 2 * self.hidden_channels
634
+ g_l = g[:, cond_offset : cond_offset + 2 * self.hidden_channels, :]
635
+ x = commons.fused_add_tanh_sigmoid_multiply(
636
+ x, g_l, torch.IntTensor([self.hidden_channels])
637
+ )
638
+ y = self.self_attn_layers[i](x, x, self_attn_mask)
639
+ y = self.drop(y)
640
+ x = self.norm_layers_0[i](x + y)
641
+
642
+ y = self.ffn_layers[i](x, x_mask)
643
+ y = self.drop(y)
644
+ x = self.norm_layers_1[i](x + y)
645
+ x = x * x_mask
646
+ return x
commons.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import numpy as np
3
+ import torch
4
+ from torch import nn
5
+ from torch.nn import functional as F
6
+
7
+
8
+ def init_weights(m, mean=0.0, std=0.01):
9
+ classname = m.__class__.__name__
10
+ if classname.find("Conv") != -1:
11
+ m.weight.data.normal_(mean, std)
12
+
13
+
14
+ def get_padding(kernel_size, dilation=1):
15
+ return int((kernel_size * dilation - dilation) / 2)
16
+
17
+
18
+ def convert_pad_shape(pad_shape):
19
+ l = pad_shape[::-1]
20
+ pad_shape = [item for sublist in l for item in sublist]
21
+ return pad_shape
22
+
23
+
24
+ def intersperse(lst, item):
25
+ result = [item] * (len(lst) * 2 + 1)
26
+ result[1::2] = lst
27
+ return result
28
+
29
+
30
+ def kl_divergence(m_p, logs_p, m_q, logs_q):
31
+ """KL(P||Q)"""
32
+ kl = (logs_q - logs_p) - 0.5
33
+ kl += (
34
+ 0.5 * (torch.exp(2.0 * logs_p) + ((m_p - m_q) ** 2)) * torch.exp(-2.0 * logs_q)
35
+ )
36
+ return kl
37
+
38
+
39
+ def rand_gumbel(shape):
40
+ """Sample from the Gumbel distribution, protect from overflows."""
41
+ uniform_samples = torch.rand(shape) * 0.99998 + 0.00001
42
+ return -torch.log(-torch.log(uniform_samples))
43
+
44
+
45
+ def rand_gumbel_like(x):
46
+ g = rand_gumbel(x.size()).to(dtype=x.dtype, device=x.device)
47
+ return g
48
+
49
+
50
+ def slice_segments(x, ids_str, segment_size=4):
51
+ ret = torch.zeros_like(x[:, :, :segment_size])
52
+ for i in range(x.size(0)):
53
+ idx_str = ids_str[i]
54
+ idx_end = idx_str + segment_size
55
+ ret[i] = x[i, :, idx_str:idx_end]
56
+ return ret
57
+
58
+
59
+ def rand_slice_segments(x, x_lengths=None, segment_size=4):
60
+ b, d, t = x.size()
61
+ if x_lengths is None:
62
+ x_lengths = t
63
+ ids_str_max = x_lengths - segment_size + 1
64
+ ids_str = (torch.rand([b]).to(device=x.device) * ids_str_max).to(dtype=torch.long)
65
+ ret = slice_segments(x, ids_str, segment_size)
66
+ return ret, ids_str
67
+
68
+
69
+ def get_timing_signal_1d(length, channels, min_timescale=1.0, max_timescale=1.0e4):
70
+ position = torch.arange(length, dtype=torch.float)
71
+ num_timescales = channels // 2
72
+ log_timescale_increment = math.log(float(max_timescale) / float(min_timescale)) / (
73
+ num_timescales - 1
74
+ )
75
+ inv_timescales = min_timescale * torch.exp(
76
+ torch.arange(num_timescales, dtype=torch.float) * -log_timescale_increment
77
+ )
78
+ scaled_time = position.unsqueeze(0) * inv_timescales.unsqueeze(1)
79
+ signal = torch.cat([torch.sin(scaled_time), torch.cos(scaled_time)], 0)
80
+ signal = F.pad(signal, [0, 0, 0, channels % 2])
81
+ signal = signal.view(1, channels, length)
82
+ return signal
83
+
84
+
85
+ def add_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4):
86
+ b, channels, length = x.size()
87
+ signal = get_timing_signal_1d(length, channels, min_timescale, max_timescale)
88
+ return x + signal.to(dtype=x.dtype, device=x.device)
89
+
90
+
91
+ def cat_timing_signal_1d(x, min_timescale=1.0, max_timescale=1.0e4, axis=1):
92
+ b, channels, length = x.size()
93
+ signal = get_timing_signal_1d(length, channels, min_timescale, max_timescale)
94
+ return torch.cat([x, signal.to(dtype=x.dtype, device=x.device)], axis)
95
+
96
+
97
+ def subsequent_mask(length):
98
+ mask = torch.tril(torch.ones(length, length)).unsqueeze(0).unsqueeze(0)
99
+ return mask
100
+
101
+
102
+ @torch.jit.script
103
+ def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels):
104
+ n_channels_int = n_channels[0]
105
+ in_act = input_a + input_b
106
+ t_act = torch.tanh(in_act[:, :n_channels_int, :])
107
+ s_act = torch.sigmoid(in_act[:, n_channels_int:, :])
108
+ acts = t_act * s_act
109
+ return acts
110
+
111
+
112
+ def convert_pad_shape(pad_shape):
113
+ l = pad_shape[::-1]
114
+ pad_shape = [item for sublist in l for item in sublist]
115
+ return pad_shape
116
+
117
+
118
+ def shift_1d(x):
119
+ x = F.pad(x, convert_pad_shape([[0, 0], [0, 0], [1, 0]]))[:, :, :-1]
120
+ return x
121
+
122
+
123
+ def sequence_mask(length, max_length=None):
124
+ if max_length is None:
125
+ max_length = length.max()
126
+ x = torch.arange(max_length, dtype=length.dtype, device=length.device)
127
+ return x.unsqueeze(0) < length.unsqueeze(1)
128
+
129
+
130
+ def generate_path(duration, mask):
131
+ """
132
+ duration: [b, 1, t_x]
133
+ mask: [b, 1, t_y, t_x]
134
+ """
135
+ device = duration.device
136
+
137
+ b, _, t_y, t_x = mask.shape
138
+ cum_duration = torch.cumsum(duration, -1)
139
+
140
+ cum_duration_flat = cum_duration.view(b * t_x)
141
+ path = sequence_mask(cum_duration_flat, t_y).to(mask.dtype)
142
+ path = path.view(b, t_x, t_y)
143
+ path = path - F.pad(path, convert_pad_shape([[0, 0], [1, 0], [0, 0]]))[:, :-1]
144
+ path = path.unsqueeze(1).transpose(2, 3) * mask
145
+ return path
146
+
147
+
148
+ def clip_grad_value_(parameters, clip_value, norm_type=2):
149
+ if isinstance(parameters, torch.Tensor):
150
+ parameters = [parameters]
151
+ parameters = list(filter(lambda p: p.grad is not None, parameters))
152
+ norm_type = float(norm_type)
153
+ if clip_value is not None:
154
+ clip_value = float(clip_value)
155
+
156
+ total_norm = 0
157
+ for p in parameters:
158
+ param_norm = p.grad.data.norm(norm_type)
159
+ total_norm += param_norm.item() ** norm_type
160
+ if clip_value is not None:
161
+ p.grad.data.clamp_(min=-clip_value, max=clip_value)
162
+ total_norm = total_norm ** (1.0 / norm_type)
163
+ return total_norm
configs/config.json ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train": {
3
+ "log_interval": 10,
4
+ "eval_interval": 100,
5
+ "seed": 1234,
6
+ "epochs": 1000,
7
+ "learning_rate": 0.0002,
8
+ "betas": [0.8, 0.99],
9
+ "eps": 1e-9,
10
+ "batch_size": 12,
11
+ "fp16_run": false,
12
+ "lr_decay": 0.999875,
13
+ "segment_size": 8192,
14
+ "init_lr_ratio": 1,
15
+ "warmup_epochs": 0,
16
+ "c_mel": 45,
17
+ "c_kl": 1.0
18
+ },
19
+ "data": {
20
+ "use_mel_posterior_encoder": true,
21
+ "training_files":"filelists/final_annotation_train.txt",
22
+ "validation_files":"filelists/final_annotation_val.txt",
23
+ "text_cleaners":["chinese_cleaners"],
24
+ "max_wav_value": 32768.0,
25
+ "sampling_rate": 22050,
26
+ "filter_length": 1024,
27
+ "hop_length": 256,
28
+ "win_length": 1024,
29
+ "n_mel_channels": 80,
30
+ "mel_fmin": 0.0,
31
+ "mel_fmax": null,
32
+ "add_blank": false,
33
+ "n_speakers": 0,
34
+ "cleaned_text": true
35
+ },
36
+ "model": {
37
+ "use_mel_posterior_encoder": true,
38
+ "use_transformer_flows": true,
39
+ "transformer_flow_type": "pre_conv",
40
+ "use_spk_conditioned_encoder": false,
41
+ "use_noise_scaled_mas": true,
42
+ "use_duration_discriminator": true,
43
+ "inter_channels": 192,
44
+ "hidden_channels": 192,
45
+ "filter_channels": 768,
46
+ "n_heads": 2,
47
+ "n_layers": 6,
48
+ "kernel_size": 3,
49
+ "p_dropout": 0.1,
50
+ "resblock": "1",
51
+ "resblock_kernel_sizes": [3,7,11],
52
+ "resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]],
53
+ "upsample_rates": [8,8,2,2],
54
+ "upsample_initial_channel": 512,
55
+ "upsample_kernel_sizes": [16,16,4,4],
56
+ "n_layers_q": 3,
57
+ "use_spectral_norm": false
58
+ }
59
+ }
60
+
configs/finetune_speaker.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train": {
3
+ "log_interval": 200,
4
+ "eval_interval": 1000,
5
+ "seed": 1234,
6
+ "epochs": 10000,
7
+ "learning_rate": 2e-4,
8
+ "betas": [0.8, 0.99],
9
+ "eps": 1e-9,
10
+ "batch_size": 64,
11
+ "fp16_run": true,
12
+ "lr_decay": 0.999875,
13
+ "segment_size": 8192,
14
+ "init_lr_ratio": 1,
15
+ "warmup_epochs": 0,
16
+ "c_mel": 45,
17
+ "c_kl": 1.0
18
+ },
19
+ "data": {
20
+ "training_files":"filelists/uma_genshin_genshinjp_bh3_train.txt.cleaned",
21
+ "validation_files":"filelists/uma_genshin_genshinjp_bh3_val.txt.cleaned",
22
+ "text_cleaners":["chinese_cleaners"],
23
+ "max_wav_value": 32768.0,
24
+ "sampling_rate": 22050,
25
+ "filter_length": 1024,
26
+ "hop_length": 256,
27
+ "win_length": 1024,
28
+ "n_mel_channels": 80,
29
+ "mel_fmin": 0.0,
30
+ "mel_fmax": null,
31
+ "add_blank": true,
32
+ "n_speakers": 804,
33
+ "cleaned_text": true
34
+ },
35
+ "model": {
36
+ "inter_channels": 192,
37
+ "hidden_channels": 192,
38
+ "filter_channels": 768,
39
+ "n_heads": 2,
40
+ "n_layers": 6,
41
+ "kernel_size": 3,
42
+ "p_dropout": 0.1,
43
+ "resblock": "1",
44
+ "resblock_kernel_sizes": [3,7,11],
45
+ "resblock_dilation_sizes": [[1,3,5], [1,3,5], [1,3,5]],
46
+ "upsample_rates": [8,8,2,2],
47
+ "upsample_initial_channel": 512,
48
+ "upsample_kernel_sizes": [16,16,4,4],
49
+ "n_layers_q": 3,
50
+ "use_spectral_norm": false,
51
+ "gin_channels": 256
52
+ },
53
+ "speakers": ["\u7279\u522b\u5468", "\u65e0\u58f0\u94c3\u9e7f", "\u4e1c\u6d77\u5e1d\u7687\uff08\u5e1d\u5b9d\uff0c\u5e1d\u738b\uff09", "\u4e38\u5584\u65af\u57fa", "\u5bcc\u58eb\u5947\u8ff9", "\u5c0f\u6817\u5e3d", "\u9ec4\u91d1\u8239", "\u4f0f\u7279\u52a0", "\u5927\u548c\u8d64\u9aa5", "\u5927\u6811\u5feb\u8f66", "\u8349\u4e0a\u98de", "\u83f1\u4e9a\u9a6c\u900a", "\u76ee\u767d\u9ea6\u6606", "\u795e\u9e70", "\u597d\u6b4c\u5267", "\u6210\u7530\u767d\u4ec1", "\u9c81\u9053\u592b\u8c61\u5f81\uff08\u7687\u5e1d\uff09", "\u6c14\u69fd", "\u7231\u4e3d\u6570\u7801", "\u661f\u4e91\u5929\u7a7a", "\u7389\u85fb\u5341\u5b57", "\u7f8e\u5999\u59ff\u52bf", "\u7435\u7436\u6668\u5149", "\u6469\u8036\u91cd\u70ae", "\u66fc\u57ce\u8336\u5ea7", "\u7f8e\u6d66\u6ce2\u65c1", "\u76ee\u767d\u8d56\u6069", "\u83f1\u66d9", "\u96ea\u4e2d\u7f8e\u4eba", "\u7c73\u6d74", "\u827e\u5c3c\u65af\u98ce\u795e", "\u7231\u4e3d\u901f\u5b50\uff08\u7231\u4e3d\u5feb\u5b50\uff09", "\u7231\u6155\u7ec7\u59ec", "\u7a3b\u8377\u4e00", "\u80dc\u5229\u5956\u5238", "\u7a7a\u4e2d\u795e\u5bab", "\u8363\u8fdb\u95ea\u8000", "\u771f\u673a\u4f36", "\u5ddd\u4e0a\u516c\u4e3b", "\u9ec4\u91d1\u57ce\uff08\u9ec4\u91d1\u57ce\u5e02\uff09", "\u6a31\u82b1\u8fdb\u738b", "\u91c7\u73e0", "\u65b0\u5149\u98ce", "\u4e1c\u5546\u53d8\u9769", "\u8d85\u7ea7\u5c0f\u6d77\u6e7e", "\u9192\u76ee\u98de\u9e70\uff08\u5bc4\u5bc4\u5b50\uff09", "\u8352\u6f20\u82f1\u96c4", "\u4e1c\u701b\u4f50\u6566", "\u4e2d\u5c71\u5e86\u5178", "\u6210\u7530\u5927\u8fdb", "\u897f\u91ce\u82b1", "\u6625\u4e3d\uff08\u4e4c\u62c9\u62c9\uff09", "\u9752\u7af9\u56de\u5fc6", "\u5fae\u5149\u98de\u9a79", "\u7f8e\u4e3d\u5468\u65e5", "\u5f85\u517c\u798f\u6765", "mr cb\uff08cb\u5148\u751f\uff09", "\u540d\u5c06\u6012\u6d9b\uff08\u540d\u5c06\u6237\u4ec1\uff09", "\u76ee\u767d\u591a\u4f2f", "\u4f18\u79c0\u7d20\u8d28", "\u5e1d\u738b\u5149\u8f89", "\u5f85\u517c\u8bd7\u6b4c\u5267", "\u751f\u91ce\u72c4\u675c\u65af", "\u76ee\u767d\u5584\u4fe1", "\u5927\u62d3\u592a\u9633\u795e", "\u53cc\u6da1\u8f6e\uff08\u4e24\u7acb\u76f4\uff0c\u4e24\u55b7\u5c04\uff0c\u4e8c\u9505\u5934\uff0c\u9006\u55b7\u5c04\uff09", "\u91cc\u89c1\u5149\u94bb\uff08\u8428\u6258\u8bfa\u91d1\u521a\u77f3\uff09", "\u5317\u90e8\u7384\u9a79", "\u6a31\u82b1\u5343\u4ee3\u738b", "\u5929\u72fc\u661f\u8c61\u5f81", "\u76ee\u767d\u963f\u5c14\u4e39", "\u516b\u91cd\u65e0\u654c", "\u9e64\u4e38\u521a\u5fd7", "\u76ee\u767d\u5149\u660e", "\u6210\u7530\u62dc\u4ec1\uff08\u6210\u7530\u8def\uff09", "\u4e5f\u6587\u6444\u8f89", "\u5c0f\u6797\u5386\u5947", "\u5317\u6e2f\u706b\u5c71", "\u5947\u9510\u9a8f", "\u82e6\u6da9\u7cd6\u971c", "\u5c0f\u5c0f\u8695\u8327", "\u9a8f\u5ddd\u624b\u7eb2\uff08\u7eff\u5e3d\u6076\u9b54\uff09", "\u79cb\u5ddd\u5f25\u751f\uff08\u5c0f\u5c0f\u7406\u4e8b\u957f\uff09", "\u4e59\u540d\u53f2\u60a6\u5b50\uff08\u4e59\u540d\u8bb0\u8005\uff09", "\u6850\u751f\u9662\u8475", "\u5b89\u5fc3\u6cfd\u523a\u523a\u7f8e", "\u6a2b\u672c\u7406\u5b50", "\u795e\u91cc\u7eeb\u534e\uff08\u9f9f\u9f9f\uff09", "\u7434", "\u7a7a\uff08\u7a7a\u54e5\uff09", "\u4e3d\u838e", "\u8367\uff08\u8367\u59b9\uff09", "\u82ad\u82ad\u62c9", "\u51ef\u4e9a", "\u8fea\u5362\u514b", "\u96f7\u6cfd", "\u5b89\u67cf", "\u6e29\u8fea", "\u9999\u83f1", "\u5317\u6597", "\u884c\u79cb", "\u9b48", "\u51dd\u5149", "\u53ef\u8389", "\u949f\u79bb", "\u83f2\u8c22\u5c14\uff08\u7687\u5973\uff09", "\u73ed\u5c3c\u7279", "\u8fbe\u8fbe\u5229\u4e9a\uff08\u516c\u5b50\uff09", "\u8bfa\u827e\u5c14\uff08\u5973\u4ec6\uff09", "\u4e03\u4e03", "\u91cd\u4e91", "\u7518\u96e8\uff08\u6930\u7f8a\uff09", "\u963f\u8d1d\u591a", "\u8fea\u5965\u5a1c\uff08\u732b\u732b\uff09", "\u83ab\u5a1c", "\u523b\u6674", "\u7802\u7cd6", "\u8f9b\u7131", "\u7f57\u838e\u8389\u4e9a", "\u80e1\u6843", "\u67ab\u539f\u4e07\u53f6\uff08\u4e07\u53f6\uff09", "\u70df\u7eef", "\u5bb5\u5bab", "\u6258\u9a6c", "\u4f18\u83c8", "\u96f7\u7535\u5c06\u519b\uff08\u96f7\u795e\uff09", "\u65e9\u67da", "\u73ca\u745a\u5bab\u5fc3\u6d77\uff08\u5fc3\u6d77\uff0c\u6263\u6263\u7c73\uff09", "\u4e94\u90ce", "\u4e5d\u6761\u88df\u7f57", "\u8352\u6cf7\u4e00\u6597\uff08\u4e00\u6597\uff09", "\u57c3\u6d1b\u4f0a", "\u7533\u9e64", "\u516b\u91cd\u795e\u5b50\uff08\u795e\u5b50\uff09", "\u795e\u91cc\u7eeb\u4eba\uff08\u7eeb\u4eba\uff09", "\u591c\u5170", "\u4e45\u5c90\u5fcd", "\u9e7f\u91ce\u82d1\u5e73\u85cf", "\u63d0\u7eb3\u91cc", "\u67ef\u83b1", "\u591a\u8389", "\u4e91\u5807", "\u7eb3\u897f\u59b2\uff08\u8349\u795e\uff09", "\u6df1\u6e0a\u4f7f\u5f92", "\u59ae\u9732", "\u8d5b\u8bfa", "\u503a\u52a1\u5904\u7406\u4eba", "\u574e\u8482\u4e1d", "\u771f\u5f13\u5feb\u8f66", "\u79cb\u4eba", "\u671b\u65cf", "\u827e\u5c14\u83f2", "\u827e\u8389\u4e1d", "\u827e\u4f26", "\u963f\u6d1b\u74e6", "\u5929\u91ce", "\u5929\u76ee\u5341\u4e94", "\u611a\u4eba\u4f17-\u5b89\u5fb7\u70c8", "\u5b89\u987a", "\u5b89\u897f", "\u8475", "\u9752\u6728", "\u8352\u5ddd\u5e78\u6b21", "\u8352\u8c37", "\u6709\u6cfd", "\u6d45\u5ddd", "\u9ebb\u7f8e", "\u51dd\u5149\u52a9\u624b", "\u963f\u6258", "\u7afa\u5b50", "\u767e\u8bc6", "\u767e\u95fb", "\u767e\u6653", "\u767d\u672f", "\u8d1d\u96c5\u7279\u4e3d\u5947", "\u4e3d\u5854", "\u5931\u843d\u8ff7\u8fed", "\u7f2d\u4e71\u661f\u68d8", "\u4f0a\u7538", "\u4f0f\u7279\u52a0\u5973\u5b69", "\u72c2\u70ed\u84dd\u8c03", "\u8389\u8389\u5a05", "\u841d\u838e\u8389\u5a05", "\u516b\u91cd\u6a31", "\u516b\u91cd\u971e", "\u5361\u83b2", "\u7b2c\u516d\u591c\u60f3\u66f2", "\u5361\u841d\u5c14", "\u59ec\u5b50", "\u6781\u5730\u6218\u5203", "\u5e03\u6d1b\u59ae\u5a05", "\u6b21\u751f\u94f6\u7ffc", "\u7406\u4e4b\u5f8b\u8005%26\u5e0c\u513f", "\u7406\u4e4b\u5f8b\u8005", "\u8ff7\u57ce\u9a87\u5154", "\u5e0c\u513f", "\u9b47\u591c\u661f\u6e0a", "\u9ed1\u5e0c\u513f", "\u5e15\u6735\u83f2\u8389\u4e1d", "\u4e0d\u706d\u661f\u951a", "\u5929\u5143\u9a91\u82f1", "\u5e7d\u5170\u9edb\u5c14", "\u6d3e\u8499bh3", "\u7231\u9171", "\u7eef\u7389\u4e38", "\u5fb7\u4e3d\u838e", "\u6708\u4e0b\u521d\u62e5", "\u6714\u591c\u89c2\u661f", "\u66ae\u5149\u9a91\u58eb", "\u683c\u857e\u4fee", "\u7559\u4e91\u501f\u98ce\u771f\u541b", "\u6885\u6bd4\u4e4c\u65af", "\u4eff\u72b9\u5927", "\u514b\u83b1\u56e0", "\u5723\u5251\u5e7d\u5170\u9edb\u5c14", "\u5996\u7cbe\u7231\u8389", "\u7279\u65af\u62c9zero", "\u82cd\u7384", "\u82e5\u6c34", "\u897f\u7433", "\u6234\u56e0\u65af\u96f7\u5e03", "\u8d1d\u62c9", "\u8d64\u9e22", "\u9547\u9b42\u6b4c", "\u6e21\u9e26", "\u4eba\u4e4b\u5f8b\u8005", "\u7231\u8389\u5e0c\u96c5", "\u5929\u7a79\u6e38\u4fa0", "\u742a\u4e9a\u5a1c", "\u7a7a\u4e4b\u5f8b\u8005", "\u85aa\u708e\u4e4b\u5f8b\u8005", "\u4e91\u58a8\u4e39\u5fc3", "\u7b26\u534e", "\u8bc6\u4e4b\u5f8b\u8005", "\u7279\u74e6\u6797", "\u7ef4\u5c14\u8587", "\u82bd\u8863", "\u96f7\u4e4b\u5f8b\u8005", "\u65ad\u7f6a\u5f71\u821e", "\u963f\u6ce2\u5c3c\u4e9a", "\u698e\u672c", "\u5384\u5c3c\u65af\u7279", "\u6076\u9f99", "\u8303\u4e8c\u7237", "\u6cd5\u62c9", "\u611a\u4eba\u4f17\u58eb\u5175", "\u611a\u4eba\u4f17\u58eb\u5175a", "\u611a\u4eba\u4f17\u58eb\u5175b", "\u611a\u4eba\u4f17\u58eb\u5175c", "\u611a\u4eba\u4f17a", "\u611a\u4eba\u4f17b", "\u98de\u98de", "\u83f2\u5229\u514b\u65af", "\u5973\u6027\u8ddf\u968f\u8005", "\u9022\u5ca9", "\u6446\u6e21\u4eba", "\u72c2\u8e81\u7684\u7537\u4eba", "\u5965\u5179", "\u8299\u841d\u62c9", "\u8ddf\u968f\u8005", "\u871c\u6c41\u751f\u7269", "\u9ec4\u9ebb\u5b50", "\u6e0a\u4e0a", "\u85e4\u6728", "\u6df1\u89c1", "\u798f\u672c", "\u8299\u84c9", "\u53e4\u6cfd", "\u53e4\u7530", "\u53e4\u5c71", "\u53e4\u8c37\u6607", "\u5085\u4e09\u513f", "\u9ad8\u8001\u516d", "\u77ff\u5de5\u5192", "\u5143\u592a", "\u5fb7\u5b89\u516c", "\u8302\u624d\u516c", "\u6770\u62c9\u5fb7", "\u845b\u7f57\u4e3d", "\u91d1\u5ffd\u5f8b", "\u516c\u4fca", "\u9505\u5df4", "\u6b4c\u5fb7", "\u963f\u8c6a", "\u72d7\u4e09\u513f", "\u845b\u745e\u4e1d", "\u82e5\u5fc3", "\u963f\u5c71\u5a46", "\u602a\u9e1f", "\u5e7f\u7af9", "\u89c2\u6d77", "\u5173\u5b8f", "\u871c\u6c41\u536b\u5175", "\u5b88\u536b1", "\u50b2\u6162\u7684\u5b88\u536b", "\u5bb3\u6015\u7684\u5b88\u536b", "\u8d35\u5b89", "\u76d6\u4f0a", "\u963f\u521b", "\u54c8\u592b\u4e39", "\u65e5\u8bed\u963f\u8d1d\u591a\uff08\u91ce\u5c9b\u5065\u513f\uff09", "\u65e5\u8bed\u57c3\u6d1b\u4f0a\uff08\u9ad8\u57a3\u5f69\u9633\uff09", "\u65e5\u8bed\u5b89\u67cf\uff08\u77f3\u89c1\u821e\u83dc\u9999\uff09", "\u65e5\u8bed\u795e\u91cc\u7eeb\u534e\uff08\u65e9\u89c1\u6c99\u7ec7\uff09", "\u65e5\u8bed\u795e\u91cc\u7eeb\u4eba\uff08\u77f3\u7530\u5f70\uff09", "\u65e5\u8bed\u767d\u672f\uff08\u6e38\u4f50\u6d69\u4e8c\uff09", "\u65e5\u8bed\u82ad\u82ad\u62c9\uff08\u9b3c\u5934\u660e\u91cc\uff09", "\u65e5\u8bed\u5317\u6597\uff08\u5c0f\u6e05\u6c34\u4e9a\u7f8e\uff09", "\u65e5\u8bed\u73ed\u5c3c\u7279\uff08\u9022\u5742\u826f\u592a\uff09", "\u65e5\u8bed\u574e\u8482\u4e1d\uff08\u67da\u6728\u51c9\u9999\uff09", "\u65e5\u8bed\u91cd\u4e91\uff08\u9f50\u85e4\u58ee\u9a6c\uff09", "\u65e5\u8bed\u67ef\u83b1\uff08\u524d\u5ddd\u51c9\u5b50\uff09", "\u65e5\u8bed\u8d5b\u8bfa\uff08\u5165\u91ce\u81ea\u7531\uff09", "\u65e5\u8bed\u6234\u56e0\u65af\u96f7\u5e03\uff08\u6d25\u7530\u5065\u6b21\u90ce\uff09", "\u65e5\u8bed\u8fea\u5362\u514b\uff08\u5c0f\u91ce\u8d24\u7ae0\uff09", "\u65e5\u8bed\u8fea\u5965\u5a1c\uff08\u4e95\u6cfd\u8bd7\u7ec7\uff09", "\u65e5\u8bed\u591a\u8389\uff08\u91d1\u7530\u670b\u5b50\uff09", "\u65e5\u8bed\u4f18\u83c8\uff08\u4f50\u85e4\u5229\u5948\uff09", "\u65e5\u8bed\u83f2\u8c22\u5c14\uff08\u5185\u7530\u771f\u793c\uff09", "\u65e5\u8bed\u7518\u96e8\uff08\u4e0a\u7530\u4e3d\u5948\uff09", "\u65e5\u8bed\uff08\u7560\u4e2d\u7950\uff09", "\u65e5\u8bed\u9e7f\u91ce\u9662\u5e73\u85cf\uff08\u4e95\u53e3\u7950\u4e00\uff09", "\u65e5\u8bed\u7a7a\uff08\u5800\u6c5f\u77ac\uff09", "\u65e5\u8bed\u8367\uff08\u60a0\u6728\u78a7\uff09", "\u65e5\u8bed\u80e1\u6843\uff08\u9ad8\u6865\u674e\u4f9d\uff09", "\u65e5\u8bed\u4e00\u6597\uff08\u897f\u5ddd\u8d35\u6559\uff09", "\u65e5\u8bed\u51ef\u4e9a\uff08\u9e1f\u6d77\u6d69\u8f85\uff09", "\u65e5\u8bed\u4e07\u53f6\uff08\u5c9b\u5d0e\u4fe1\u957f\uff09", "\u65e5\u8bed\u523b\u6674\uff08\u559c\u591a\u6751\u82f1\u68a8\uff09", "\u65e5\u8bed\u53ef\u8389\uff08\u4e45\u91ce\u7f8e\u54b2\uff09", "\u65e5\u8bed\u5fc3\u6d77\uff08\u4e09\u68ee\u94c3\u5b50\uff09", "\u65e5\u8bed\u4e5d\u6761\u88df\u7f57\uff08\u6fd1\u6237\u9ebb\u6c99\u7f8e\uff09", "\u65e5\u8bed\u4e3d\u838e\uff08\u7530\u4e2d\u7406\u60e0\uff09", "\u65e5\u8bed\u83ab\u5a1c\uff08\u5c0f\u539f\u597d\u7f8e\uff09", "\u65e5\u8bed\u7eb3\u897f\u59b2\uff08\u7530\u6751\u7531\u52a0\u8389\uff09", "\u65e5\u8bed\u59ae\u9732\uff08\u91d1\u5143\u5bff\u5b50\uff09", "\u65e5\u8bed\u51dd\u5149\uff08\u5927\u539f\u6c99\u8036\u9999\uff09", "\u65e5\u8bed\u8bfa\u827e\u5c14\uff08\u9ad8\u5c3e\u594f\u97f3\uff09", "\u65e5\u8bed\u5965\u5179\uff08\u589e\u8c37\u5eb7\u7eaa\uff09", "\u65e5\u8bed\u6d3e\u8499\uff08\u53e4\u8d3a\u8475\uff09", "\u65e5\u8bed\u7434\uff08\u658b\u85e4\u5343\u548c\uff09", "\u65e5\u8bed\u4e03\u4e03\uff08\u7530\u6751\u7531\u52a0\u8389\uff09", "\u65e5\u8bed\u96f7\u7535\u5c06\u519b\uff08\u6cfd\u57ce\u7f8e\u96ea\uff09", "\u65e5\u8bed\u96f7\u6cfd\uff08\u5185\u5c71\u6602\u8f89\uff09", "\u65e5\u8bed\u7f57\u838e\u8389\u4e9a\uff08\u52a0\u9688\u4e9a\u8863\uff09", "\u65e5\u8bed\u65e9\u67da\uff08\u6d32\u5d0e\u7eeb\uff09", "\u65e5\u8bed\u6563\u5175\uff08\u67ff\u539f\u5f7b\u4e5f\uff09", "\u65e5\u8bed\u7533\u9e64\uff08\u5ddd\u6f84\u7eeb\u5b50\uff09", "\u65e5\u8bed\u4e45\u5c90\u5fcd\uff08\u6c34\u6865\u9999\u7ec7\uff09", "\u65e5\u8bed\u5973\u58eb\uff08\u5e84\u5b50\u88d5\u8863\uff09", "\u65e5\u8bed\u7802\u7cd6\uff08\u85e4\u7530\u831c\uff09", "\u65e5\u8bed\u8fbe\u8fbe\u5229\u4e9a\uff08\u6728\u6751\u826f\u5e73\uff09", "\u65e5\u8bed\u6258\u9a6c\uff08\u68ee\u7530\u6210\u4e00\uff09", "\u65e5\u8bed\u63d0\u7eb3\u91cc\uff08\u5c0f\u6797\u6c99\u82d7\uff09", "\u65e5\u8bed\u6e29\u8fea\uff08\u6751\u6fd1\u6b65\uff09", "\u65e5\u8bed\u9999\u83f1\uff08\u5c0f\u6cfd\u4e9a\u674e\uff09", "\u65e5\u8bed\u9b48\uff08\u677e\u5188\u796f\u4e1e\uff09", "\u65e5\u8bed\u884c\u79cb\uff08\u7686\u5ddd\u7eaf\u5b50\uff09", "\u65e5\u8bed\u8f9b\u7131\uff08\u9ad8\u6865\u667a\u79cb\uff09", "\u65e5\u8bed\u516b\u91cd\u795e\u5b50\uff08\u4f50\u4ed3\u7eeb\u97f3\uff09", "\u65e5\u8bed\u70df\u7eef\uff08\u82b1\u5b88\u7531\u7f8e\u91cc\uff09", "\u65e5\u8bed\u591c\u5170\uff08\u8fdc\u85e4\u7eeb\uff09", "\u65e5\u8bed\u5bb5\u5bab\uff08\u690d\u7530\u4f73\u5948\uff09", "\u65e5\u8bed\u4e91\u5807\uff08\u5c0f\u5ca9\u4e95\u5c0f\u9e1f\uff09", "\u65e5\u8bed\u949f\u79bb\uff08\u524d\u91ce\u667a\u662d\uff09", "\u6770\u514b", "\u963f\u5409", "\u6c5f\u821f", "\u9274\u79cb", "\u5609\u4e49", "\u7eaa\u82b3", "\u666f\u6f84", "\u7ecf\u7eb6", "\u666f\u660e", "\u664b\u4f18", "\u963f\u9e20", "\u9152\u5ba2", "\u4e54\u5c14", "\u4e54\u745f\u592b", "\u7ea6\u987f", "\u4e54\u4f0a\u65af", "\u5c45\u5b89", "\u541b\u541b", "\u987a\u5409", "\u7eaf\u4e5f", "\u91cd\u4f50", "\u5927\u5c9b\u7eaf\u5e73", "\u84b2\u6cfd", "\u52d8\u89e3\u7531\u5c0f\u8def\u5065\u4e09\u90ce", "\u67ab", "\u67ab\u539f\u4e49\u5e86", "\u836b\u5c71", "\u7532\u6590\u7530\u9f8d\u99ac", "\u6d77\u6597", "\u60df\u795e\u6674\u4e4b\u4ecb", "\u9e7f\u91ce\u5948\u5948", "\u5361\u7435\u8389\u4e9a", "\u51ef\u745f\u7433", "\u52a0\u85e4\u4fe1\u609f", "\u52a0\u85e4\u6d0b\u5e73", "\u80dc\u5bb6", "\u8305\u847a\u4e00\u5e86", "\u548c\u662d", "\u4e00\u6b63", "\u4e00\u9053", "\u6842\u4e00", "\u5e86\u6b21\u90ce", "\u963f\u8d24", "\u5065\u53f8", "\u5065\u6b21\u90ce", "\u5065\u4e09\u90ce", "\u5929\u7406", "\u6740\u624ba", "\u6740\u624bb", "\u6728\u5357\u674f\u5948", "\u6728\u6751", "\u56fd\u738b", "\u6728\u4e0b", "\u5317\u6751", "\u6e05\u60e0", "\u6e05\u4eba", "\u514b\u5217\u95e8\u7279", "\u9a91\u58eb", "\u5c0f\u6797", "\u5c0f\u6625", "\u5eb7\u62c9\u5fb7", "\u5927\u8089\u4e38", "\u7434\u7f8e", "\u5b8f\u4e00", "\u5eb7\u4ecb", "\u5e78\u5fb7", "\u9ad8\u5584", "\u68a2", "\u514b\u7f57\u7d22", "\u4e45\u4fdd", "\u4e5d\u6761\u9570\u6cbb", "\u4e45\u6728\u7530", "\u6606\u94a7", "\u83ca\u5730\u541b", "\u4e45\u5229\u987b", "\u9ed1\u7530", "\u9ed1\u6cfd\u4eac\u4e4b\u4ecb", "\u54cd\u592a", "\u5c9a\u59d0", "\u5170\u6eaa", "\u6f9c\u9633", "\u52b3\u4f26\u65af", "\u4e50\u660e", "\u83b1\u8bfa", "\u83b2", "\u826f\u5b50", "\u674e\u5f53", "\u674e\u4e01", "\u5c0f\u4e50", "\u7075", "\u5c0f\u73b2", "\u7433\u7405a", "\u7433\u7405b", "\u5c0f\u5f6c", "\u5c0f\u5fb7", "\u5c0f\u697d", "\u5c0f\u9f99", "\u5c0f\u5434", "\u5c0f\u5434\u7684\u8bb0\u5fc6", "\u7406\u6b63", "\u963f\u9f99", "\u5362\u5361", "\u6d1b\u6210", "\u7f57\u5de7", "\u5317\u98ce\u72fc", "\u5362\u6b63", "\u840d\u59e5\u59e5", "\u524d\u7530", "\u771f\u663c", "\u9ebb\u7eaa", "\u771f", "\u611a\u4eba\u4f17-\u9a6c\u514b\u897f\u59c6", "\u5973\u6027a", "\u5973\u6027b", "\u5973\u6027a\u7684\u8ddf\u968f\u8005", "\u963f\u5b88", "\u739b\u683c\u4e3d\u7279", "\u771f\u7406", "\u739b\u4e54\u4e3d", "\u739b\u6587", "\u6b63\u80dc", "\u660c\u4fe1", "\u5c06\u53f8", "\u6b63\u4eba", "\u8def\u7237", "\u8001\u7ae0", "\u677e\u7530", "\u677e\u672c", "\u677e\u6d66", "\u677e\u5742", "\u8001\u5b5f", "\u5b5f\u4e39", "\u5546\u4eba\u968f\u4ece", "\u4f20\u4ee4\u5175", "\u7c73\u6b47\u5c14", "\u5fa1\u8206\u6e90\u4e00\u90ce", "\u5fa1\u8206\u6e90\u6b21\u90ce", "\u5343\u5ca9\u519b\u6559\u5934", "\u5343\u5ca9\u519b\u58eb\u5175", "\u660e\u535a", "\u660e\u4fca", "\u7f8e\u94c3", "\u7f8e\u548c", "\u963f\u5e78", "\u524a\u6708\u7b51\u9633\u771f\u541b", "\u94b1\u773c\u513f", "\u68ee\u5f66", "\u5143\u52a9", "\u7406\u6c34\u53e0\u5c71\u771f\u541b", "\u7406\u6c34\u758a\u5c71\u771f\u541b", "\u6731\u8001\u677f", "\u6728\u6728", "\u6751\u4e0a", "\u6751\u7530", "\u6c38\u91ce", "\u957f\u91ce\u539f\u9f99\u4e4b\u4ecb", "\u957f\u6fd1", "\u4e2d\u91ce\u5fd7\u4e43", "\u83dc\u83dc\u5b50", "\u6960\u6960", "\u6210\u6fd1", "\u963f\u5185", "\u5b81\u7984", "\u725b\u5fd7", "\u4fe1\u535a", "\u4f38\u592b", "\u91ce\u65b9", "\u8bfa\u62c9", "\u7eaa\u9999", "\u8bfa\u66fc", "\u4fee\u5973", "\u7eaf\u6c34\u7cbe\u7075", "\u5c0f\u5ddd", "\u5c0f\u4ed3\u6faa", "\u5188\u6797", "\u5188\u5d0e\u7ed8\u91cc\u9999", "\u5188\u5d0e\u9646\u6597", "\u5965\u62c9\u592b", "\u8001\u79d1", "\u9b3c\u5a46\u5a46", "\u5c0f\u91ce\u5bfa", "\u5927\u6cb3\u539f\u4e94\u53f3\u536b\u95e8", "\u5927\u4e45\u4fdd\u5927\u4ecb", "\u5927\u68ee", "\u5927\u52a9", "\u5965\u7279", "\u6d3e\u8499", "\u6d3e\u84992", "\u75c5\u4ebaa", "\u75c5\u4ebab", "\u5df4\u987f", "\u6d3e\u6069", "\u670b\u4e49", "\u56f4\u89c2\u7fa4\u4f17", "\u56f4\u89c2\u7fa4\u4f17a", "\u56f4\u89c2\u7fa4\u4f17b", "\u56f4\u89c2\u7fa4\u4f17c", "\u56f4\u89c2\u7fa4\u4f17d", "\u56f4\u89c2\u7fa4\u4f17e", "\u94dc\u96c0", "\u963f\u80a5", "\u5174\u53d4", "\u8001\u5468\u53d4", "\u516c\u4e3b", "\u5f7c\u5f97", "\u4e7e\u5b50", "\u828a\u828a", "\u4e7e\u73ae", "\u7eee\u547d", "\u675e\u5e73", "\u79cb\u6708", "\u6606\u6069", "\u96f7\u7535\u5f71", "\u5170\u9053\u5c14", "\u96f7\u8499\u5fb7", "\u5192\u5931\u7684\u5e15\u62c9\u5fb7", "\u4f36\u4e00", "\u73b2\u82b1", "\u963f\u4ec1", "\u5bb6\u81e3\u4eec", "\u68a8\u7ed8", "\u8363\u6c5f", "\u620e\u4e16", "\u6d6a\u4eba", "\u7f57\u4f0a\u65af", "\u5982\u610f", "\u51c9\u5b50", "\u5f69\u9999", "\u9152\u4e95", "\u5742\u672c", "\u6714\u6b21\u90ce", "\u6b66\u58eba", "\u6b66\u58ebb", "\u6b66\u58ebc", "\u6b66\u58ebd", "\u73ca\u745a", "\u4e09\u7530", "\u838e\u62c9", "\u7b39\u91ce", "\u806a\u7f8e", "\u806a", "\u5c0f\u767e\u5408", "\u6563\u5175", "\u5bb3\u6015\u7684\u5c0f\u5218", "\u8212\u4f2f\u7279", "\u8212\u8328", "\u6d77\u9f99", "\u4e16\u5b50", "\u8c22\u5c14\u76d6", "\u5bb6\u4e01", "\u5546\u534e", "\u6c99\u5bc5", "\u963f\u5347", "\u67f4\u7530", "\u963f\u8302", "\u5f0f\u5927\u5c06", "\u6e05\u6c34", "\u5fd7\u6751\u52d8\u5175\u536b", "\u65b0\u4e4b\u4e1e", "\u5fd7\u7ec7", "\u77f3\u5934", "\u8bd7\u7fbd", "\u8bd7\u7b60", "\u77f3\u58ee", "\u7fd4\u592a", "\u6b63\u4e8c", "\u5468\u5e73", "\u8212\u6768", "\u9f50\u683c\u8299\u4e3d\u96c5", "\u5973\u58eb", "\u601d\u52e4", "\u516d\u6307\u4e54\u745f", "\u611a\u4eba\u4f17\u5c0f\u5175d", "\u611a\u4eba\u4f17\u5c0f\u5175a", "\u611a\u4eba\u4f17\u5c0f\u5175b", "\u611a\u4eba\u4f17\u5c0f\u5175c", "\u5434\u8001\u4e94", "\u5434\u8001\u4e8c", "\u6ed1\u5934\u9b3c", "\u8a00\u7b11", "\u5434\u8001\u4e03", "\u58eb\u5175h", "\u58eb\u5175i", "\u58eb\u5175a", "\u58eb\u5175b", "\u58eb\u5175c", "\u58eb\u5175d", "\u58eb\u5175e", "\u58eb\u5175f", "\u58eb\u5175g", "\u594f\u592a", "\u65af\u5766\u5229", "\u6387\u661f\u652b\u8fb0\u5929\u541b", "\u5c0f\u5934", "\u5927\u6b66", "\u9676\u4e49\u9686", "\u6749\u672c", "\u82cf\u897f", "\u5acc\u7591\u4ebaa", "\u5acc\u7591\u4ebab", "\u5acc\u7591\u4ebac", "\u5acc\u7591\u4ebad", "\u65af\u4e07", "\u5251\u5ba2a", "\u5251\u5ba2b", "\u963f\u4e8c", "\u5fe0\u80dc", "\u5fe0\u592b", "\u963f\u656c", "\u5b5d\u5229", "\u9e70\u53f8\u8fdb", "\u9ad8\u5c71", "\u4e5d\u6761\u5b5d\u884c", "\u6bc5", "\u7af9\u5185", "\u62d3\u771f", "\u5353\u4e5f", "\u592a\u90ce\u4e38", "\u6cf0\u52d2", "\u624b\u5c9b", "\u54f2\u5e73", "\u54f2\u592b", "\u6258\u514b", "\u5927boss", "\u963f\u5f3a", "\u6258\u5c14\u5fb7\u62c9", "\u65c1\u89c2\u8005", "\u5929\u6210", "\u963f\u5927", "\u8482\u739b\u4e4c\u65af", "\u63d0\u7c73", "\u6237\u7530", "\u963f\u4e09", "\u4e00\u8d77\u7684\u4eba", "\u5fb7\u7530", "\u5fb7\u957f", "\u667a\u6811", "\u5229\u5f66", "\u80d6\u4e4e\u4e4e\u7684\u65c5\u884c\u8005", "\u85cf\u5b9d\u4ebaa", "\u85cf\u5b9d\u4ebab", "\u85cf\u5b9d\u4ebac", "\u85cf\u5b9d\u4ebad", "\u963f\u7947", "\u6052\u96c4", "\u9732\u5b50", "\u8bdd\u5267\u56e2\u56e2\u957f", "\u5185\u6751", "\u4e0a\u91ce", "\u4e0a\u6749", "\u8001\u6234", "\u8001\u9ad8", "\u8001\u8d3e", "\u8001\u58a8", "\u8001\u5b59", "\u5929\u67a2\u661f", "\u8001\u4e91", "\u6709\u4e50\u658b", "\u4e11\u96c4", "\u4e4c\u7ef4", "\u74e6\u4eac", "\u83f2\u5c14\u6208\u9edb\u7279", "\u7ef4\u591a\u5229\u4e9a", "\u8587\u5c14", "\u74e6\u683c\u7eb3", "\u963f\u5916", "\u4f8d\u5973", "\u74e6\u62c9", "\u671b\u96c5", "\u5b9b\u70df", "\u742c\u7389", "\u6218\u58eba", "\u6218\u58ebb", "\u6e21\u8fba", "\u6e21\u90e8", "\u963f\u4f1f", "\u6587\u749f", "\u6587\u6e0a", "\u97e6\u5c14\u7eb3", "\u738b\u6273\u624b", "\u6b66\u6c9b", "\u6653\u98de", "\u8f9b\u7a0b", "\u661f\u706b", "\u661f\u7a00", "\u8f9b\u79c0", "\u79c0\u534e", "\u963f\u65ed", "\u5f90\u5218\u5e08", "\u77e2\u90e8", "\u516b\u6728", "\u5c71\u4e0a", "\u963f\u9633", "\u989c\u7b11", "\u5eb7\u660e", "\u6cf0\u4e45", "\u5b89\u6b66", "\u77e2\u7530\u5e78\u559c", "\u77e2\u7530\u8f9b\u559c", "\u4e49\u575a", "\u83ba\u513f", "\u76c8\u4e30", "\u5b9c\u5e74", "\u94f6\u674f", "\u9038\u8f69", "\u6a2a\u5c71", "\u6c38\u8d35", "\u6c38\u4e1a", "\u5609\u4e45", "\u5409\u5ddd", "\u4e49\u9ad8", "\u7528\u9ad8", "\u9633\u592a", "\u5143\u84c9", "\u73a5\u8f89", "\u6bd3\u534e", "\u6709\u9999", "\u5e78\u4e5f", "\u7531\u771f", "\u7ed3\u83dc", "\u97f5\u5b81", "\u767e\u5408", "\u767e\u5408\u534e", "\u5c24\u82cf\u6ce2\u592b", "\u88d5\u5b50", "\u60a0\u7b56", "\u60a0\u4e5f", "\u4e8e\u5ae3", "\u67da\u5b50", "\u8001\u90d1", "\u6b63\u8302", "\u5fd7\u6210", "\u82b7\u5de7", "\u77e5\u6613", "\u652f\u652f", "\u5468\u826f", "\u73e0\u51fd", "\u795d\u660e", "\u795d\u6d9b"],
54
+ "symbols": ["_", ",", ".", "!", "?", "-", "~", "\u2026", "A", "E", "I", "N", "O", "Q", "U", "a", "b", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "v", "w", "y", "z", "\u0283", "\u02a7", "\u02a6", "\u026f", "\u0279", "\u0259", "\u0265", "\u207c", "\u02b0", "`", "\u2192", "\u2193", "\u2191", " "]
55
+ }
configs/modified_finetune_speaker.json ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train": {
3
+ "log_interval": 10,
4
+ "eval_interval": 100,
5
+ "seed": 1234,
6
+ "epochs": 10000,
7
+ "learning_rate": 0.0002,
8
+ "betas": [
9
+ 0.8,
10
+ 0.99
11
+ ],
12
+ "eps": 1e-09,
13
+ "batch_size": 16,
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": "final_annotation_train.txt",
24
+ "validation_files": "final_annotation_val.txt",
25
+ "text_cleaners": [
26
+ "chinese_cleaners"
27
+ ],
28
+ "max_wav_value": 32768.0,
29
+ "sampling_rate": 22050,
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": 2,
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
+ "gin_channels": 256
87
+ },
88
+ "symbols": [
89
+ "_",
90
+ "\uff1b",
91
+ "\uff1a",
92
+ "\uff0c",
93
+ "\u3002",
94
+ "\uff01",
95
+ "\uff1f",
96
+ "-",
97
+ "\u201c",
98
+ "\u201d",
99
+ "\u300a",
100
+ "\u300b",
101
+ "\u3001",
102
+ "\uff08",
103
+ "\uff09",
104
+ "\u2026",
105
+ "\u2014",
106
+ " ",
107
+ "A",
108
+ "B",
109
+ "C",
110
+ "D",
111
+ "E",
112
+ "F",
113
+ "G",
114
+ "H",
115
+ "I",
116
+ "J",
117
+ "K",
118
+ "L",
119
+ "M",
120
+ "N",
121
+ "O",
122
+ "P",
123
+ "Q",
124
+ "R",
125
+ "S",
126
+ "T",
127
+ "U",
128
+ "V",
129
+ "W",
130
+ "X",
131
+ "Y",
132
+ "Z",
133
+ "a",
134
+ "b",
135
+ "c",
136
+ "d",
137
+ "e",
138
+ "f",
139
+ "g",
140
+ "h",
141
+ "i",
142
+ "j",
143
+ "k",
144
+ "l",
145
+ "m",
146
+ "n",
147
+ "o",
148
+ "p",
149
+ "q",
150
+ "r",
151
+ "s",
152
+ "t",
153
+ "u",
154
+ "v",
155
+ "w",
156
+ "x",
157
+ "y",
158
+ "z",
159
+ "1",
160
+ "2",
161
+ "3",
162
+ "4",
163
+ "5",
164
+ "0",
165
+ "\uff22",
166
+ "\uff30"
167
+ ],
168
+ "speakers": {
169
+ "dingzhen": 0,
170
+ "taffy": 1
171
+ }
172
+ }
custom_character_voice/22050.txt ADDED
@@ -0,0 +1 @@
 
 
1
+
data_utils.py ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import os
3
+ import random
4
+ import numpy as np
5
+ import torch
6
+ import torch.utils.data
7
+
8
+ import commons
9
+ from mel_processing import spectrogram_torch, mel_spectrogram_torch, spec_to_mel_torch
10
+ from utils import load_wav_to_torch, load_filepaths_and_text
11
+ from text import text_to_sequence, cleaned_text_to_sequence
12
+
13
+
14
+ class TextAudioLoader(torch.utils.data.Dataset):
15
+ """
16
+ 1) loads audio, text pairs
17
+ 2) normalizes text and converts them to sequences of integers
18
+ 3) computes spectrograms from audio files.
19
+ """
20
+
21
+ def __init__(self, audiopaths_and_text, hparams):
22
+ self.hparams = hparams
23
+ self.audiopaths_and_text = load_filepaths_and_text(audiopaths_and_text)
24
+ self.text_cleaners = hparams.text_cleaners
25
+ self.max_wav_value = hparams.max_wav_value
26
+ self.sampling_rate = hparams.sampling_rate
27
+ self.filter_length = hparams.filter_length
28
+ self.hop_length = hparams.hop_length
29
+ self.win_length = hparams.win_length
30
+ self.sampling_rate = hparams.sampling_rate
31
+
32
+ self.use_mel_spec_posterior = getattr(
33
+ hparams, "use_mel_posterior_encoder", False
34
+ )
35
+ if self.use_mel_spec_posterior:
36
+ self.n_mel_channels = getattr(hparams, "n_mel_channels", 80)
37
+ self.cleaned_text = getattr(hparams, "cleaned_text", False)
38
+
39
+ self.add_blank = hparams.add_blank
40
+ self.min_text_len = getattr(hparams, "min_text_len", 1)
41
+ self.max_text_len = getattr(hparams, "max_text_len", 190)
42
+
43
+ random.seed(1234)
44
+ random.shuffle(self.audiopaths_and_text)
45
+ self._filter()
46
+
47
+ def _filter(self):
48
+ """
49
+ Filter text & store spec lengths
50
+ """
51
+ # Store spectrogram lengths for Bucketing
52
+ # wav_length ~= file_size / (wav_channels * Bytes per dim) = file_size / (1 * 2)
53
+ # spec_length = wav_length // hop_length
54
+
55
+ audiopaths_and_text_new = []
56
+ lengths = []
57
+ for audiopath, text in self.audiopaths_and_text:
58
+ if self.min_text_len <= len(text) and len(text) <= self.max_text_len:
59
+ audiopaths_and_text_new.append([audiopath, text])
60
+ lengths.append(os.path.getsize(audiopath) // (2 * self.hop_length))
61
+ self.audiopaths_and_text = audiopaths_and_text_new
62
+ self.lengths = lengths
63
+
64
+ def get_audio_text_pair(self, audiopath_and_text):
65
+ # separate filename and text
66
+ audiopath, text = audiopath_and_text[0], audiopath_and_text[1]
67
+ text = self.get_text(text)
68
+ spec, wav = self.get_audio(audiopath)
69
+ return (text, spec, wav)
70
+
71
+ def get_audio(self, filename):
72
+ # TODO : if linear spec exists convert to mel from existing linear spec
73
+ audio, sampling_rate = load_wav_to_torch(filename)
74
+ if sampling_rate != self.sampling_rate:
75
+ raise ValueError(
76
+ "{} {} SR doesn't match target {} SR".format(
77
+ sampling_rate, self.sampling_rate
78
+ )
79
+ )
80
+ audio_norm = audio / self.max_wav_value
81
+ audio_norm = audio_norm.unsqueeze(0)
82
+ spec_filename = filename.replace(".wav", ".spec.pt")
83
+ if self.use_mel_spec_posterior:
84
+ spec_filename = spec_filename.replace(".spec.pt", ".mel.pt")
85
+ if os.path.exists(spec_filename):
86
+ spec = torch.load(spec_filename)
87
+ else:
88
+ if self.use_mel_spec_posterior:
89
+ """TODO : (need verification)
90
+ if linear spec exists convert to
91
+ mel from existing linear spec (uncomment below lines)"""
92
+ # if os.path.exists(filename.replace(".wav", ".spec.pt")):
93
+ # # spec, n_fft, num_mels, sampling_rate, fmin, fmax
94
+ # spec = spec_to_mel_torch(
95
+ # torch.load(filename.replace(".wav", ".spec.pt")),
96
+ # self.filter_length, self.n_mel_channels, self.sampling_rate,
97
+ # self.hparams.mel_fmin, self.hparams.mel_fmax)
98
+ spec = mel_spectrogram_torch(
99
+ audio_norm,
100
+ self.filter_length,
101
+ self.n_mel_channels,
102
+ self.sampling_rate,
103
+ self.hop_length,
104
+ self.win_length,
105
+ self.hparams.mel_fmin,
106
+ self.hparams.mel_fmax,
107
+ center=False,
108
+ )
109
+ else:
110
+ spec = spectrogram_torch(
111
+ audio_norm,
112
+ self.filter_length,
113
+ self.sampling_rate,
114
+ self.hop_length,
115
+ self.win_length,
116
+ center=False,
117
+ )
118
+ spec = torch.squeeze(spec, 0)
119
+ torch.save(spec, spec_filename)
120
+ return spec, audio_norm
121
+
122
+ def get_text(self, text):
123
+ if self.cleaned_text:
124
+ text_norm = cleaned_text_to_sequence(text)
125
+ else:
126
+ text_norm = text_to_sequence(text, self.text_cleaners)
127
+ if self.add_blank:
128
+ text_norm = commons.intersperse(text_norm, 0)
129
+ text_norm = torch.LongTensor(text_norm)
130
+ return text_norm
131
+
132
+ def __getitem__(self, index):
133
+ return self.get_audio_text_pair(self.audiopaths_and_text[index])
134
+
135
+ def __len__(self):
136
+ return len(self.audiopaths_and_text)
137
+
138
+
139
+ class TextAudioCollate:
140
+ """Zero-pads model inputs and targets"""
141
+
142
+ def __init__(self, return_ids=False):
143
+ self.return_ids = return_ids
144
+
145
+ def __call__(self, batch):
146
+ """Collate's training batch from normalized text and aduio
147
+ PARAMS
148
+ ------
149
+ batch: [text_normalized, spec_normalized, wav_normalized]
150
+ """
151
+ # Right zero-pad all one-hot text sequences to max input length
152
+ _, ids_sorted_decreasing = torch.sort(
153
+ torch.LongTensor([x[1].size(1) for x in batch]), dim=0, descending=True
154
+ )
155
+
156
+ max_text_len = max([len(x[0]) for x in batch])
157
+ max_spec_len = max([x[1].size(1) for x in batch])
158
+ max_wav_len = max([x[2].size(1) for x in batch])
159
+
160
+ text_lengths = torch.LongTensor(len(batch))
161
+ spec_lengths = torch.LongTensor(len(batch))
162
+ wav_lengths = torch.LongTensor(len(batch))
163
+
164
+ text_padded = torch.LongTensor(len(batch), max_text_len)
165
+ spec_padded = torch.FloatTensor(len(batch), batch[0][1].size(0), max_spec_len)
166
+ wav_padded = torch.FloatTensor(len(batch), 1, max_wav_len)
167
+ text_padded.zero_()
168
+ spec_padded.zero_()
169
+ wav_padded.zero_()
170
+ for i in range(len(ids_sorted_decreasing)):
171
+ row = batch[ids_sorted_decreasing[i]]
172
+
173
+ text = row[0]
174
+ text_padded[i, : text.size(0)] = text
175
+ text_lengths[i] = text.size(0)
176
+
177
+ spec = row[1]
178
+ spec_padded[i, :, : spec.size(1)] = spec
179
+ spec_lengths[i] = spec.size(1)
180
+
181
+ wav = row[2]
182
+ wav_padded[i, :, : wav.size(1)] = wav
183
+ wav_lengths[i] = wav.size(1)
184
+
185
+ if self.return_ids:
186
+ return (
187
+ text_padded,
188
+ text_lengths,
189
+ spec_padded,
190
+ spec_lengths,
191
+ wav_padded,
192
+ wav_lengths,
193
+ ids_sorted_decreasing,
194
+ )
195
+ return (
196
+ text_padded,
197
+ text_lengths,
198
+ spec_padded,
199
+ spec_lengths,
200
+ wav_padded,
201
+ wav_lengths,
202
+ )
203
+
204
+
205
+ """Multi speaker version"""
206
+
207
+
208
+ class TextAudioSpeakerLoader(torch.utils.data.Dataset):
209
+ """
210
+ 1) loads audio, speaker_id, text pairs
211
+ 2) normalizes text and converts them to sequences of integers
212
+ 3) computes spectrograms from audio files.
213
+ """
214
+
215
+ def __init__(self, audiopaths_sid_text, hparams):
216
+ self.hparams = hparams
217
+ self.audiopaths_sid_text = load_filepaths_and_text(audiopaths_sid_text)
218
+ self.text_cleaners = hparams.text_cleaners
219
+ self.max_wav_value = hparams.max_wav_value
220
+ self.sampling_rate = hparams.sampling_rate
221
+ self.filter_length = hparams.filter_length
222
+ self.hop_length = hparams.hop_length
223
+ self.win_length = hparams.win_length
224
+ self.sampling_rate = hparams.sampling_rate
225
+
226
+ self.use_mel_spec_posterior = getattr(
227
+ hparams, "use_mel_posterior_encoder", False
228
+ )
229
+ if self.use_mel_spec_posterior:
230
+ self.n_mel_channels = getattr(hparams, "n_mel_channels", 80)
231
+ self.cleaned_text = getattr(hparams, "cleaned_text", False)
232
+
233
+ self.add_blank = hparams.add_blank
234
+ self.min_text_len = getattr(hparams, "min_text_len", 1)
235
+ self.max_text_len = getattr(hparams, "max_text_len", 190)
236
+
237
+ random.seed(1234)
238
+ random.shuffle(self.audiopaths_sid_text)
239
+ self._filter()
240
+
241
+ def _filter(self):
242
+ """
243
+ Filter text & store spec lengths
244
+ """
245
+ # Store spectrogram lengths for Bucketing
246
+ # wav_length ~= file_size / (wav_channels * Bytes per dim) = file_size / (1 * 2)
247
+ # spec_length = wav_length // hop_length
248
+
249
+ audiopaths_sid_text_new = []
250
+ lengths = []
251
+ for audiopath, sid, text in self.audiopaths_sid_text:
252
+ if self.min_text_len <= len(text) and len(text) <= self.max_text_len:
253
+ audiopaths_sid_text_new.append([audiopath, sid, text])
254
+ lengths.append(os.path.getsize(audiopath) // (2 * self.hop_length))
255
+ self.audiopaths_sid_text = audiopaths_sid_text_new
256
+ self.lengths = lengths
257
+
258
+ def get_audio_text_speaker_pair(self, audiopath_sid_text):
259
+ # separate filename, speaker_id and text
260
+ audiopath, sid, text = (
261
+ audiopath_sid_text[0],
262
+ audiopath_sid_text[1],
263
+ audiopath_sid_text[2],
264
+ )
265
+ text = self.get_text(text)
266
+ spec, wav = self.get_audio(audiopath)
267
+ sid = self.get_sid(sid)
268
+ return (text, spec, wav, sid)
269
+
270
+ def get_audio(self, filename):
271
+ # TODO : if linear spec exists convert to mel from existing linear spec
272
+ audio, sampling_rate = load_wav_to_torch(filename)
273
+ if sampling_rate != self.sampling_rate:
274
+ raise ValueError(
275
+ "{} {} SR doesn't match target {} SR".format(
276
+ sampling_rate, self.sampling_rate
277
+ )
278
+ )
279
+ audio_norm = audio / self.max_wav_value
280
+ audio_norm = audio_norm.unsqueeze(0)
281
+ spec_filename = filename.replace(".wav", ".spec.pt")
282
+ if self.use_mel_spec_posterior:
283
+ spec_filename = spec_filename.replace(".spec.pt", ".mel.pt")
284
+ if os.path.exists(spec_filename):
285
+ spec = torch.load(spec_filename)
286
+ else:
287
+ if self.use_mel_spec_posterior:
288
+ """TODO : (need verification)
289
+ if linear spec exists convert to
290
+ mel from existing linear spec (uncomment below lines)"""
291
+ # if os.path.exists(filename.replace(".wav", ".spec.pt")):
292
+ # # spec, n_fft, num_mels, sampling_rate, fmin, fmax
293
+ # spec = spec_to_mel_torch(
294
+ # torch.load(filename.replace(".wav", ".spec.pt")),
295
+ # self.filter_length, self.n_mel_channels, self.sampling_rate,
296
+ # self.hparams.mel_fmin, self.hparams.mel_fmax)
297
+ spec = mel_spectrogram_torch(
298
+ audio_norm,
299
+ self.filter_length,
300
+ self.n_mel_channels,
301
+ self.sampling_rate,
302
+ self.hop_length,
303
+ self.win_length,
304
+ self.hparams.mel_fmin,
305
+ self.hparams.mel_fmax,
306
+ center=False,
307
+ )
308
+ else:
309
+ spec = spectrogram_torch(
310
+ audio_norm,
311
+ self.filter_length,
312
+ self.sampling_rate,
313
+ self.hop_length,
314
+ self.win_length,
315
+ center=False,
316
+ )
317
+ spec = torch.squeeze(spec, 0)
318
+ torch.save(spec, spec_filename)
319
+ return spec, audio_norm
320
+
321
+ def get_text(self, text):
322
+ if self.cleaned_text:
323
+ text_norm = cleaned_text_to_sequence(text)
324
+ else:
325
+ text_norm = text_to_sequence(text, self.text_cleaners)
326
+ if self.add_blank:
327
+ text_norm = commons.intersperse(text_norm, 0)
328
+ text_norm = torch.LongTensor(text_norm)
329
+ return text_norm
330
+
331
+ def get_sid(self, sid):
332
+ sid = torch.LongTensor([int(sid)])
333
+ return sid
334
+
335
+ def __getitem__(self, index):
336
+ return self.get_audio_text_speaker_pair(self.audiopaths_sid_text[index])
337
+
338
+ def __len__(self):
339
+ return len(self.audiopaths_sid_text)
340
+
341
+
342
+ class TextAudioSpeakerCollate:
343
+ """Zero-pads model inputs and targets"""
344
+
345
+ def __init__(self, return_ids=False):
346
+ self.return_ids = return_ids
347
+
348
+ def __call__(self, batch):
349
+ """Collate's training batch from normalized text, audio and speaker identities
350
+ PARAMS
351
+ ------
352
+ batch: [text_normalized, spec_normalized, wav_normalized, sid]
353
+ """
354
+ # Right zero-pad all one-hot text sequences to max input length
355
+ _, ids_sorted_decreasing = torch.sort(
356
+ torch.LongTensor([x[1].size(1) for x in batch]), dim=0, descending=True
357
+ )
358
+
359
+ max_text_len = max([len(x[0]) for x in batch])
360
+ max_spec_len = max([x[1].size(1) for x in batch])
361
+ max_wav_len = max([x[2].size(1) for x in batch])
362
+
363
+ text_lengths = torch.LongTensor(len(batch))
364
+ spec_lengths = torch.LongTensor(len(batch))
365
+ wav_lengths = torch.LongTensor(len(batch))
366
+ sid = torch.LongTensor(len(batch))
367
+
368
+ text_padded = torch.LongTensor(len(batch), max_text_len)
369
+ spec_padded = torch.FloatTensor(len(batch), batch[0][1].size(0), max_spec_len)
370
+ wav_padded = torch.FloatTensor(len(batch), 1, max_wav_len)
371
+ text_padded.zero_()
372
+ spec_padded.zero_()
373
+ wav_padded.zero_()
374
+ for i in range(len(ids_sorted_decreasing)):
375
+ row = batch[ids_sorted_decreasing[i]]
376
+
377
+ text = row[0]
378
+ text_padded[i, : text.size(0)] = text
379
+ text_lengths[i] = text.size(0)
380
+
381
+ spec = row[1]
382
+ spec_padded[i, :, : spec.size(1)] = spec
383
+ spec_lengths[i] = spec.size(1)
384
+
385
+ wav = row[2]
386
+ wav_padded[i, :, : wav.size(1)] = wav
387
+ wav_lengths[i] = wav.size(1)
388
+
389
+ sid[i] = row[3]
390
+
391
+ if self.return_ids:
392
+ return (
393
+ text_padded,
394
+ text_lengths,
395
+ spec_padded,
396
+ spec_lengths,
397
+ wav_padded,
398
+ wav_lengths,
399
+ sid,
400
+ ids_sorted_decreasing,
401
+ )
402
+ return (
403
+ text_padded,
404
+ text_lengths,
405
+ spec_padded,
406
+ spec_lengths,
407
+ wav_padded,
408
+ wav_lengths,
409
+ sid,
410
+ )
411
+
412
+
413
+ class DistributedBucketSampler(torch.utils.data.distributed.DistributedSampler):
414
+ """
415
+ Maintain similar input lengths in a batch.
416
+ Length groups are specified by boundaries.
417
+ Ex) boundaries = [b1, b2, b3] -> any batch is included either {x | b1 < length(x) <=b2} or {x | b2 < length(x) <= b3}.
418
+
419
+ It removes samples which are not included in the boundaries.
420
+ Ex) boundaries = [b1, b2, b3] -> any x s.t. length(x) <= b1 or length(x) > b3 are discarded.
421
+ """
422
+
423
+ def __init__(
424
+ self,
425
+ dataset,
426
+ batch_size,
427
+ boundaries,
428
+ num_replicas=None,
429
+ rank=None,
430
+ shuffle=True,
431
+ ):
432
+ super().__init__(dataset, num_replicas=num_replicas, rank=rank, shuffle=shuffle)
433
+ self.lengths = dataset.lengths
434
+ self.batch_size = batch_size
435
+ self.boundaries = boundaries
436
+
437
+ self.buckets, self.num_samples_per_bucket = self._create_buckets()
438
+ self.total_size = sum(self.num_samples_per_bucket)
439
+ self.num_samples = self.total_size // self.num_replicas
440
+
441
+ def _create_buckets(self):
442
+ buckets = [[] for _ in range(len(self.boundaries) - 1)]
443
+ for i in range(len(self.lengths)):
444
+ length = self.lengths[i]
445
+ idx_bucket = self._bisect(length)
446
+ if idx_bucket != -1:
447
+ buckets[idx_bucket].append(i)
448
+
449
+ for i in range(len(buckets) - 1, 0, -1):
450
+ if len(buckets[i]) == 0:
451
+ buckets.pop(i)
452
+ self.boundaries.pop(i + 1)
453
+
454
+ num_samples_per_bucket = []
455
+ for i in range(len(buckets)):
456
+ len_bucket = len(buckets[i])
457
+ total_batch_size = self.num_replicas * self.batch_size
458
+ rem = (
459
+ total_batch_size - (len_bucket % total_batch_size)
460
+ ) % total_batch_size
461
+ num_samples_per_bucket.append(len_bucket + rem)
462
+ return buckets, num_samples_per_bucket
463
+
464
+ def __iter__(self):
465
+ # deterministically shuffle based on epoch
466
+ g = torch.Generator()
467
+ g.manual_seed(self.epoch)
468
+
469
+ indices = []
470
+ if self.shuffle:
471
+ for bucket in self.buckets:
472
+ indices.append(torch.randperm(len(bucket), generator=g).tolist())
473
+ else:
474
+ for bucket in self.buckets:
475
+ indices.append(list(range(len(bucket))))
476
+
477
+ batches = []
478
+ for i in range(len(self.buckets)):
479
+ bucket = self.buckets[i]
480
+ len_bucket = len(bucket)
481
+ ids_bucket = indices[i]
482
+ num_samples_bucket = self.num_samples_per_bucket[i]
483
+
484
+ # add extra samples to make it evenly divisible
485
+ rem = num_samples_bucket - len_bucket
486
+ ids_bucket = (
487
+ ids_bucket
488
+ + ids_bucket * (rem // len_bucket)
489
+ + ids_bucket[: (rem % len_bucket)]
490
+ )
491
+
492
+ # subsample
493
+ ids_bucket = ids_bucket[self.rank :: self.num_replicas]
494
+
495
+ # batching
496
+ for j in range(len(ids_bucket) // self.batch_size):
497
+ batch = [
498
+ bucket[idx]
499
+ for idx in ids_bucket[
500
+ j * self.batch_size : (j + 1) * self.batch_size
501
+ ]
502
+ ]
503
+ batches.append(batch)
504
+
505
+ if self.shuffle:
506
+ batch_ids = torch.randperm(len(batches), generator=g).tolist()
507
+ batches = [batches[i] for i in batch_ids]
508
+ self.batches = batches
509
+
510
+ assert len(self.batches) * self.batch_size == self.num_samples
511
+ return iter(self.batches)
512
+
513
+ def _bisect(self, x, lo=0, hi=None):
514
+ if hi is None:
515
+ hi = len(self.boundaries) - 1
516
+
517
+ if hi > lo:
518
+ mid = (hi + lo) // 2
519
+ if self.boundaries[mid] < x and x <= self.boundaries[mid + 1]:
520
+ return mid
521
+ elif x <= self.boundaries[mid]:
522
+ return self._bisect(x, lo, mid)
523
+ else:
524
+ return self._bisect(x, mid + 1, hi)
525
+ else:
526
+ return -1
527
+
528
+ def __len__(self):
529
+ return self.num_samples // self.batch_size
export_onnx.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ from pathlib import Path
3
+ from typing import Optional
4
+
5
+ import torch
6
+
7
+ import utils
8
+ from models import SynthesizerTrn
9
+ from text.symbols import symbols
10
+
11
+ OPSET_VERSION = 15
12
+
13
+
14
+ def main() -> None:
15
+ torch.manual_seed(1234)
16
+
17
+ parser = argparse.ArgumentParser()
18
+ parser.add_argument(
19
+ "--model-path", required=True, help="Path to model weights (.pth)"
20
+ )
21
+ parser.add_argument(
22
+ "--config-path", required=True, help="Path to model config (.json)"
23
+ )
24
+ parser.add_argument("--output", required=True, help="Path to output model (.onnx)")
25
+
26
+ args = parser.parse_args()
27
+
28
+ args.model_path = Path(args.model_path)
29
+ args.config_path = Path(args.config_path)
30
+ args.output = Path(args.output)
31
+ args.output.parent.mkdir(parents=True, exist_ok=True)
32
+
33
+ hps = utils.get_hparams_from_file(args.config_path)
34
+
35
+ if (
36
+ "use_mel_posterior_encoder" in hps.model.keys()
37
+ and hps.model.use_mel_posterior_encoder == True
38
+ ):
39
+ print("Using mel posterior encoder for VITS2")
40
+ posterior_channels = 80 # vits2
41
+ hps.data.use_mel_posterior_encoder = True
42
+ else:
43
+ print("Using lin posterior encoder for VITS1")
44
+ posterior_channels = hps.data.filter_length // 2 + 1
45
+ hps.data.use_mel_posterior_encoder = False
46
+
47
+ model_g = SynthesizerTrn(
48
+ len(symbols),
49
+ posterior_channels,
50
+ hps.train.segment_size // hps.data.hop_length,
51
+ n_speakers=hps.data.n_speakers,
52
+ **hps.model,
53
+ )
54
+
55
+ _ = model_g.eval()
56
+
57
+ _ = utils.load_checkpoint(args.model_path, model_g, None)
58
+
59
+ def infer_forward(text, text_lengths, scales, sid=None):
60
+ noise_scale = scales[0]
61
+ length_scale = scales[1]
62
+ noise_scale_w = scales[2]
63
+ audio = model_g.infer(
64
+ text,
65
+ text_lengths,
66
+ noise_scale=noise_scale,
67
+ length_scale=length_scale,
68
+ noise_scale_w=noise_scale_w,
69
+ sid=sid,
70
+ )[0]
71
+
72
+ return audio
73
+
74
+ model_g.forward = infer_forward
75
+
76
+ dummy_input_length = 50
77
+ sequences = torch.randint(
78
+ low=0, high=len(symbols), size=(1, dummy_input_length), dtype=torch.long
79
+ )
80
+ sequence_lengths = torch.LongTensor([sequences.size(1)])
81
+
82
+ sid: Optional[torch.LongTensor] = None
83
+ if hps.data.n_speakers > 1:
84
+ sid = torch.LongTensor([0])
85
+
86
+ # noise, length, noise_w
87
+ scales = torch.FloatTensor([0.667, 1.0, 0.8])
88
+ dummy_input = (sequences, sequence_lengths, scales, sid)
89
+
90
+ # Export
91
+ torch.onnx.export(
92
+ model=model_g,
93
+ args=dummy_input,
94
+ f=str(args.output),
95
+ verbose=False,
96
+ opset_version=OPSET_VERSION,
97
+ input_names=["input", "input_lengths", "scales", "sid"],
98
+ output_names=["output"],
99
+ dynamic_axes={
100
+ "input": {0: "batch_size", 1: "phonemes"},
101
+ "input_lengths": {0: "batch_size"},
102
+ "output": {0: "batch_size", 1: "time1", 2: "time2"},
103
+ },
104
+ )
105
+
106
+ print(f"Exported model to {args.output}")
107
+
108
+
109
+ if __name__ == "__main__":
110
+ main()
filelists/final_annotation_train.txt ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ./custom_character_voice/linghua/processed_0.wav|ㄉㄠˋㄑㄧˉ ㄕㄣˊㄌㄧˇ ㄌㄧㄡˊㄊㄞˋ ㄉㄠˉㄕㄨˋ ㄐㄧㄝˉ ㄔㄨㄢˊㄕㄣˊ ㄌㄧˇㄌㄧㄥˊㄏㄨㄚˊ ㄘㄢˉㄕㄤˋ。
2
+ ./custom_character_voice/linghua/processed_1.wav|ㄑㄧㄥˇ ㄉㄨㄛˉ ㄓˇㄐㄧㄠˋ ㄚ˙。
3
+ ./custom_character_voice/linghua/processed_2.wav|ㄓㄜˋㄧㄤˋ ㄧㄡˉㄒㄧㄢˊㄢˉㄨㄣˇ ㄉㄜ˙ ㄕˊㄍㄨㄤˉ, ㄖㄨˊㄍㄨㄛˇ ㄗㄞˋ ㄉㄨㄛˉ ㄧˉㄉㄧㄢˇ ㄐㄧㄡˋ ㄏㄠˇ ㄌㄜ˙。
4
+ ./custom_character_voice/linghua/processed_3.wav|ㄨㄛˇ ㄓㄣˉ ㄊㄢˉㄒㄧㄣˉ ㄚ˙。
5
+ ./custom_character_voice/linghua/processed_4.wav|ㄐㄧㄡˋ ㄏㄜˊ ㄔㄚˊ ㄧˉㄧㄤˋ, ㄒㄧˋㄒㄧˋㄆㄧㄣˇㄨㄟˋ, ㄘㄞˊㄋㄥˊ ㄌㄧˇㄐㄧㄝˇ ㄑㄧˊㄓㄨㄥˉ ㄈㄥˉㄧㄚˇ。
6
+ ./custom_character_voice/linghua/processed_5.wav|ㄉㄡˉ ㄕˋ ㄌㄩˇㄒㄧㄥˊㄓㄜˇ ㄆㄧㄥˊㄖˋ ㄌㄧˇ ㄉㄜ˙ ㄕㄥˉㄏㄨㄛˊ ㄇㄚ˙?
7
+ ./custom_character_voice/linghua/processed_6.wav|ㄍㄢˇㄐㄩㄝˊ ㄧㄡˋ ㄉㄨㄛˉ ㄌㄧㄠˇㄐㄧㄝˇ ㄌㄜ˙ ㄋㄧˇ ㄧˉㄒㄧㄝˉ。
8
+ ./custom_character_voice/linghua/processed_7.wav|ㄐㄧㄢˋ ㄅㄠˋㄧㄝˋㄇㄧㄥˊ ㄍㄨㄥˉㄏㄨㄞˊ ㄅㄠˇ。
9
+ ./custom_character_voice/linghua/processed_8.wav|ㄙㄨㄟˊ ㄨㄛˇ ㄧˉㄊㄨㄥˊ ㄅㄧˋㄩˇ ㄅㄚ˙。
10
+ ./custom_character_voice/linghua/processed_9.wav|ㄙㄨㄛˇ ㄉㄚˋㄖㄣˊ, ㄕˋ ㄗㄞˋ ㄙㄨˋㄕㄨㄛˉ ㄕㄣˊㄇㄜ˙ ㄇㄚ˙?
11
+ ./custom_character_voice/linghua/processed_10.wav|ㄐㄧˋㄧㄣˊㄓㄨㄤˉㄙㄨˋ, ㄐㄩˊㄍㄠˉㄧㄥˋ ㄑㄩㄥˊㄓˉ。
12
+ ./custom_character_voice/linghua/processed_11.wav|ㄣˊ…… ㄇㄟˇㄐㄧㄥˇ ㄉㄤˉㄑㄧㄢˊ, ㄓˇㄔㄚˋ ㄧˉㄏㄨˊ ㄔㄚˊ ㄩˇ ㄓˉ ㄒㄧㄤˉㄔㄣˋ ㄋㄜ˙。
13
+ ./custom_character_voice/linghua/processed_12.wav|ㄧㄠˋ ㄑㄩˋ ㄋㄚˇㄅㄧㄢˉ ㄗㄡˇㄗㄡˇ ㄇㄚ˙?
14
+ ./custom_character_voice/linghua/processed_13.wav|ㄧㄢˇㄐㄧㄥˉ, ㄒㄧㄤˋ ㄓㄨˋㄈㄥˉ ㄔㄨㄟˉ ㄌㄞˊ ㄉㄜ˙ ㄈㄤˉㄒㄧㄤˋ。
15
+ ./custom_character_voice/linghua/processed_14.wav|ㄞˉㄧㄚˉ, ㄏㄣˇ ㄕㄨˉㄈㄨˊ ㄅㄚ˙。
16
+ ./custom_character_voice/linghua/processed_15.wav|ㄌㄩˇㄒㄧㄥˊㄓㄜˇ。
17
+ ./custom_character_voice/linghua/processed_16.wav|ㄓㄜˋㄧㄤˋ ㄗㄞˋ ㄑㄧㄥˉㄔㄣˊ ㄐㄧㄢˋ ㄋㄧˇ ㄧˊㄇㄧㄢˋ, ㄨㄛˇㄏㄨㄟˋ ㄖㄣˇㄅㄨˊㄓㄨˋ ㄐㄩㄝˊㄉㄜˊ, ㄐㄧㄝˉㄒㄧㄚˋ ㄌㄞˊㄐㄧㄤˉ ㄕˋ ㄕㄨㄣˋㄌㄧˋ ㄉㄜ˙ ㄧˉㄊㄧㄢˉ。
18
+ ./custom_character_voice/linghua/processed_18.wav|ㄔㄚˊㄈㄢˋ ㄓˉㄏㄡˋ, ㄋㄢˊㄇㄧㄢˇ ㄌㄩㄝˋㄧㄡˇ ㄎㄨㄣˋㄐㄩㄢˋ ㄕˋㄈㄡˇ ㄧㄡˇ ㄒㄧㄥˋㄓˋ ㄒㄧㄚˋㄆㄢˊ ㄑㄧˊ ㄊㄧˊㄕㄣˊ ㄋㄜ˙?
19
+ ./custom_character_voice/linghua/processed_20.wav|ㄏㄨㄟˋ ㄕˋ ㄧˊㄍㄜˋ ㄌㄧㄤˊㄒㄧㄠˉ ㄋㄜ˙。
20
+ ./custom_character_voice/linghua/processed_21.wav|ㄓˉㄕˋ ㄇㄥˋ ㄏㄜˊㄒㄩˉ ㄒㄧㄥˇ。
21
+ ./custom_character_voice/linghua/processed_22.wav|ㄅㄨˋㄅㄧˇㄓㄣˉ ㄖㄨˊ, ㄧˉㄒㄧㄤˉㄏㄨㄟˋ。
22
+ ./custom_character_voice/linghua/processed_23.wav|ㄉㄠˋㄑㄧˉ ㄇㄨˋㄈㄨˇ ㄕㄜˋ ㄈㄥˋㄒㄧㄥˊ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ, ㄨㄟˋ ㄩˊ ㄉㄠˋㄑㄧˉ ㄇㄧㄥˊㄇㄣˊ ㄓㄨㄥˉ ㄉㄜ˙ ㄅㄧˇㄊㄡˊ ㄓˉ ㄍㄜˊㄨㄟˋ。
23
+ ./custom_character_voice/linghua/processed_24.wav|ㄗㄨㄛˋㄨㄟˊ ㄙㄢˉ ㄈㄥˋㄒㄧㄥˊ ㄓˉㄧˉ, ㄓㄤˇㄍㄨㄢˇ ㄐㄧˋㄙˋ ㄏㄨㄛˊㄉㄨㄥˋ ㄩˇ ㄖㄣˊㄨㄣˊ ㄧˋㄕㄨˋ。
24
+ ./custom_character_voice/linghua/processed_25.wav|ㄕㄨㄤˉㄑㄧㄣˉ ㄍㄨㄛˋㄕˋ ㄓˉㄏㄡˋ, ㄗㄨˊ ㄋㄟˋ ㄉㄜ˙ ㄉㄚˋㄒㄧㄠˇ ㄕˋㄨˋ ㄅㄧㄢˋ ㄧㄡˊ ㄒㄩㄥˉㄓㄤˇ ㄏㄜˊ ㄨㄛˇ ㄔㄥˊㄉㄢˉ ㄌㄜ˙。
25
+ ./custom_character_voice/linghua/processed_26.wav|ㄏㄣˇㄉㄨㄛˉ ㄖㄣˊㄧㄣˉ ㄨㄟˋ ㄨㄛˇ ㄕˋ ㄅㄞˊㄌㄨˋ ㄍㄨㄥˉㄓㄨˇ, ㄕˋ ㄕㄜˋ ㄈㄥˋㄒㄧㄥˊ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ ㄉㄜ˙ ㄉㄚˋ ㄒㄧㄠˇㄐㄧㄝˇ, ㄦˊ ㄐㄧㄥˋㄓㄨㄥˋ ㄨㄛˇ。
26
+ ./custom_character_voice/linghua/processed_27.wav|ㄊㄚˉㄇㄣ˙ ㄙㄨㄛˇ ㄐㄧㄥˋㄓㄨㄥˋ ㄉㄜ˙, ㄓˇㄕˋ ㄨㄛˇ ㄙㄨㄛˇ ㄕㄣˉㄔㄨˋ ㄉㄜ˙ ㄉㄧˋㄨㄟˋ, ㄩˇㄌㄧㄥˊㄏㄨㄚˊ ㄨㄛˇ ㄕˋ ㄗㄣˇㄧㄤˋ ㄉㄜ˙ ㄖㄣˊ ㄅㄧㄥˋ ㄨˊ ㄍㄨㄢˉㄒㄧˋ。
27
+ ./custom_character_voice/linghua/processed_28.wav|ㄨㄛˇ ㄒㄧㄤˇ, ㄋㄥˊ ㄓㄣˉㄓㄥˋ ㄗㄡˇㄐㄧㄣˋ ㄨㄛˇ ㄉㄜ˙, ㄏㄨㄛˋㄒㄩˇ ㄓˇㄧㄡˇ, ㄖㄨˊㄐㄧㄣˉ ㄉㄜ˙ ㄨㄛˇ。
28
+ ./custom_character_voice/linghua/processed_29.wav|ㄧˉㄐㄧㄡˋ ㄒㄧㄤˇ ㄔㄥˊㄨㄟˋ ㄓˊㄉㄜ˙ ㄉㄚˋㄐㄧㄚˉ ㄒㄧㄣˋㄖㄣˋ ㄉㄜ˙ ㄖㄣˊ。
29
+ ./custom_character_voice/linghua/processed_30.wav|ㄍㄨˇㄨˇ ㄨㄛˇ ㄉㄜ˙ ㄩㄢˊㄧㄣˉ, ㄧˇ ㄅㄨˋㄗㄞˋ ㄕˋ ㄐㄧㄢˉㄕㄤˋ ㄉㄜ˙ ㄗㄜˊㄖㄣˋ, ㄏㄨㄛˋ ㄊㄚˉㄖㄣˊ ㄉㄜ˙ ㄑㄧˉㄉㄞˋ。
30
+ ./custom_character_voice/linghua/processed_31.wav|ㄕˋ ㄧㄣˉㄨㄟˋ…… ㄋㄧˇ ㄧㄝˇ ㄕˋ ㄓㄜˋㄧㄤˋ ㄉㄜ˙ ㄖㄣˊ ㄚ˙。
31
+ ./custom_character_voice/linghua/processed_32.wav|ㄖㄨˊㄍㄨㄛˇ ㄋㄧㄣˊ ㄧㄡˇㄎㄨㄥˋ, ㄨㄛˇㄇㄣ˙ ㄧˉㄅㄨˋ ㄇㄨˋㄌㄨˋ ㄔㄚˊㄕˋ ㄖㄨˊㄏㄜˊ?
32
+ ./custom_character_voice/linghua/processed_33.wav|ㄗㄞˋ ㄓㄜˋㄧㄤˋ ㄊㄧㄢˊㄐㄧㄥˋ ㄉㄜ˙ ㄖˋㄗ˙, ㄌㄩㄝˋㄐㄧㄚˉ ㄐㄧㄠˉㄌㄧㄡˊ ㄔㄚˊㄧˋ ㄒㄧㄣˉㄉㄜˊ, ㄒㄧㄤˇㄌㄞˊ ㄕˋ ㄆㄛˇㄐㄩˋ ㄧㄚˇㄑㄩˋ ㄉㄜ˙。
33
+ ./custom_character_voice/linghua/processed_34.wav|ㄖㄨˊㄍㄨㄛˇ ㄧㄡˇ ㄐㄧˉㄏㄨㄟˋ ㄉㄜ˙ㄏㄨㄚˋ, ㄨㄛˇㄒㄧㄤˇㄕˋ ㄓㄜ˙ ㄏㄜˊ ㄋㄧˇ ㄍㄨㄥˋㄉㄨˋ ㄧˋㄍㄨㄛˊ ㄉㄜ˙ ㄐㄧㄝˊㄖˋ。
34
+ ./custom_character_voice/linghua/processed_35.wav|ㄗㄨㄣˉㄒㄩㄣˊ ㄉㄜ˙ ㄉㄤˉㄉㄧˋ ㄈㄥˉㄙㄨˊ, ㄌㄧˇㄧˊ ㄍㄨㄟˉㄈㄢˋ, ㄏㄞˊㄧㄡˇ ㄅㄢˋㄕㄡˇ ㄌㄧˇ ㄉㄜ˙ ㄊㄨㄟˉㄐㄧㄢˋ。
35
+ ./custom_character_voice/linghua/processed_36.wav|ㄎㄜˇㄧˇ ㄇㄚˊㄈㄢˊ ㄋㄧˇ… ㄧˉㄧˉ ㄓˇㄉㄠˇ ㄨㄛˇ ㄇㄚ˙?
36
+ ./custom_character_voice/linghua/processed_37.wav|ㄕㄣˊㄓˉㄧㄢˇ, ㄐㄧˊ ㄕˋ ㄒㄩㄥˉㄏㄨㄞˊㄉㄚˋㄓˋ ㄓˉㄖㄣˊ ㄙㄨㄛˇ ㄏㄨㄛˋ ㄉㄜ˙ ㄧㄥˉㄕㄡˋ。
37
+ ./custom_character_voice/linghua/processed_38.wav|ㄖㄨˊㄍㄨㄛˇ ㄨㄣˋ ㄨㄛˇ ㄧㄡˇ ㄕㄣˊㄇㄜ˙ ㄓˋㄒㄧㄤˋ ㄉㄜ˙ㄏㄨㄚˋ。
38
+ ./custom_character_voice/linghua/processed_39.wav|ㄓㄜˋㄍㄜˋ ㄏㄞˊㄕˋ ㄅㄠˇㄇㄧˋ ㄅㄚ˙。
39
+ ./custom_character_voice/linghua/processed_40.wav|ㄓˇㄕˋ ㄧˊㄍㄜˋ ㄨㄟˉㄅㄨˋㄗㄨˊㄉㄠˋ ㄉㄜ˙ ㄇㄥˋㄒㄧㄤˇ ㄅㄚˋㄌㄜ˙。
40
+ ./custom_character_voice/linghua/processed_41.wav|ㄔㄤˊㄕㄨㄛˉ ㄔㄢˊ ㄔㄚˊ ㄧˉㄨㄟˋ。
41
+ ./custom_character_voice/linghua/processed_42.wav|ㄐㄧㄢˋ ㄔㄢˊ ㄧˋ ㄖㄨˊ。
42
+ ./custom_character_voice/linghua/processed_43.wav|ㄋㄚˋㄇㄜ˙ ㄐㄧㄢˋ ㄏㄜˊ ㄔㄚˊ, ㄧㄡˋ ㄕˋ ㄕㄣˊㄇㄜ˙ ㄍㄨㄢˉㄒㄧˋ ㄋㄜ˙?
43
+ ./custom_character_voice/linghua/processed_44.wav|ㄋㄧˇ ㄗㄞˋ ㄔㄥˊㄓㄨㄥˉ, ㄐㄧㄢˋㄍㄨㄛˋ ㄎㄨˉㄨㄟˇ ㄉㄜ˙ ㄧㄥˉㄏㄨㄚˉㄕㄨˋ ㄇㄚ˙?
44
+ ./custom_character_voice/linghua/processed_45.wav|ㄎㄨˉㄓˉ ㄇㄟˇ ㄖㄤˋ ㄨㄛˇ ㄒㄧㄤˇㄉㄠˋ ㄔㄨㄣˉㄊㄧㄢˉ ㄕㄥˋㄎㄞˉ ㄓˉㄐㄧㄥˇ。
45
+ ./custom_character_voice/linghua/processed_46.wav|ㄅㄨˋㄍㄨㄛˋ, ㄅㄧㄝˊㄖㄣˊ ㄙˋㄏㄨˉ ㄅㄧㄥˋ ㄅㄨˋ ㄓㄜˋㄇㄜ˙ ㄒㄧㄤˇ。
46
+ ./custom_character_voice/linghua/processed_47.wav|ㄎㄞˉㄏㄨㄚˉ ㄉㄜ˙ ㄧㄣˉㄕㄨˋㄏㄨㄟˋ ㄅㄟˋ ㄧˊㄗㄡˇ。
47
+ ./custom_character_voice/linghua/processed_48.wav|ㄐㄧㄡˋㄙㄨㄢˋ ㄧˉㄘˋ ㄧㄝˇㄏㄠˇ, ㄓㄣˉㄒㄧㄤˇ ㄎㄢˋㄉㄠˋ ㄊㄚˉ ㄗㄞˋㄘˋ ㄎㄞˉㄈㄤˋ。
48
+ ./custom_character_voice/linghua/processed_49.wav|ㄕˋ ㄨㄛˇ ㄏㄣˇ ㄓㄨㄥˋㄧㄠˋ ㄉㄜ˙ ㄆㄥˊㄧㄡˇ。
49
+ ./custom_character_voice/linghua/processed_50.wav|ㄊㄧㄢˉㄌㄥˇ ㄏㄜˊ ㄧㄤˊㄍㄨㄤˉ, ㄗㄨㄥˇㄕˋ ㄍㄢˇㄖㄢˇ ㄓㄜ˙ ㄨㄛˇ。
50
+ ./custom_character_voice/linghua/processed_51.wav|ㄧˋㄧˋ ㄕㄤˋ ㄌㄞˊㄕㄨㄛˉ, ㄊㄚˉ ㄐㄧㄡˋ ㄒㄧㄤˋㄕˋ ㄨㄛˇ ㄉㄜ˙ ㄌㄧㄥˋ ㄧˊㄍㄜˋ ㄒㄩㄥˉㄓㄤˇ ㄧˉㄧㄤˋ。
51
+ ./custom_character_voice/linghua/processed_52.wav|ㄔㄥˊㄨㄟˋ ㄌㄜ˙ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄧˉㄩㄢˊ。
52
+ ./custom_character_voice/linghua/processed_53.wav|ㄌㄧㄥˇ ㄈㄥˋㄒㄧㄥˊ ㄍㄨㄥˉㄗㄨㄛˋ ㄉㄜ˙ ㄐㄧㄡˇㄊㄧㄠˊ ㄕㄚˉㄌㄨㄛˊ, ㄊㄚˉ ㄗㄨㄥˇㄕˋ ㄧˉㄌㄧㄢˇ ㄧㄢˊㄙㄨˋ。
53
+ ./custom_character_voice/linghua/processed_54.wav|ㄊㄚˉ ㄘㄥˊㄐㄧㄥˉ ㄑㄧˇㄍㄨㄛˋ ㄐㄧˇㄘˋ ㄓㄥˉㄉㄨㄢˉ。
54
+ ./custom_character_voice/linghua/processed_55.wav|ㄊㄚˉ ㄅㄣˇㄓˋ ㄕˋ ㄓㄨㄥˉㄧˋ ㄓˉㄕˋ, ㄓㄜˋㄉㄧㄢˇ ㄨˊㄎㄜˇㄈㄡˇㄖㄣˋ。
55
+ ./custom_character_voice/linghua/processed_56.wav|ㄙㄨˉㄧㄝˇ ㄩㄝˋㄒㄧㄢˉㄕㄥˉ。
56
+ ./custom_character_voice/linghua/processed_57.wav|ㄊㄚˉ ㄏㄜˊ ㄐㄧㄡˇㄊㄧㄠˊ ㄒㄧㄠˇㄐㄧㄝˇ ㄧˉㄧㄤˋ, ㄕˋ ㄊㄧㄢˉㄌㄧㄥˇ ㄈㄥˋㄒㄧㄥˊ ㄉㄜ˙ ㄖㄣˊ。
57
+ ./custom_character_voice/linghua/processed_58.wav|ㄊㄚˉ…… ㄧㄝˇ ㄕˋ ㄧˊㄍㄜˋ ㄏㄣˇ ㄧㄡˇ ㄩㄢˊㄗㄜˊ ㄉㄜ˙ ㄖㄣˊ。
58
+ ./custom_character_voice/linghua/processed_59.wav|ㄓㄜˋㄒㄧㄝˉ ㄩㄢˊㄗㄜˊ ㄉㄜ˙ ㄐㄧㄢˉㄔˊ, ㄕㄣˋㄓˋ ㄅㄧˇ ㄐㄧㄡˇㄊㄧㄠˊ ㄒㄧㄠˇㄐㄧㄝˇ ㄍㄥˋ ㄓˊㄓㄨㄛˊ。
59
+ ./custom_character_voice/linghua/processed_60.wav|ㄅㄨˋㄍㄨㄛˋ, ㄕㄣˊㄇㄜ˙ ㄕˋ ㄧㄥˉㄍㄞˉ ㄅㄟˋ ㄙㄨㄢˋ ㄗㄞˋ ㄓㄜˋㄒㄧㄝˉ ㄩㄢˊㄗㄜˊ ㄓˉㄋㄟˋ…… ㄨㄛˇ ㄒㄧㄤˇ, ㄏㄨㄛˋㄒㄩˇ ㄓˇㄧㄡˇ ㄌㄨˋ ㄧㄝˇ ㄩㄢ�� ㄒㄧㄢˉㄕㄥˉ ㄗˋㄐㄧˇ ㄓˉㄉㄠˋ ㄅㄚ˙。
60
+ ./custom_character_voice/linghua/processed_61.wav|ㄒㄧㄠˇ ㄧㄡˋㄓˋ ㄏㄞˊㄗ˙, ㄗㄨㄟˋㄐㄧㄣˋ ㄧㄡˇ ㄇㄟˊ ㄧㄡˇㄍㄟˇ ㄋㄧˇ ㄊㄧㄢˉㄕㄣˊㄇㄜ˙ ㄇㄚˊㄈㄢˊ ㄋㄜ˙?
61
+ ./custom_character_voice/linghua/processed_62.wav|ㄖㄨˊㄍㄨㄛˇ ㄎㄢˋㄐㄧㄢˋ ㄊㄚˉ ㄊㄡˉ ㄌㄢˇ, ㄎㄜˇㄧˇ ㄓˊㄐㄧㄝˉ ㄍㄠˋㄙㄨˋ ㄨㄛˇ。
62
+ ./custom_character_voice/linghua/processed_63.wav|ㄌㄧˇㄙㄨㄛˇ ㄉㄤˉㄖㄢˊ ㄉㄜ˙ ㄎㄢˋㄈㄚˇ ㄇㄚ˙?
63
+ ./custom_character_voice/linghua/processed_64.wav|ㄅㄨˋㄍㄞˉ ㄧㄡˊ ㄨㄛˇ ㄉㄥˇ ㄒㄧㄚˋㄕㄨˇ ㄙㄨㄟˊㄧˋ ㄧˋㄌㄨㄣˋ。
64
+ ./custom_character_voice/linghua/processed_65.wav|ㄏㄥˉ, ㄐㄧㄤˉㄐㄩㄣˉ ㄉㄚˋㄖㄣˊ ㄊㄚˉ ㄗㄞˋ ㄓㄨㄟˉㄑㄧㄡˊ ㄩㄥˇㄏㄥˊ ㄓˉ ㄌㄨˋㄕㄤˋ, ㄎㄜˇㄋㄥˊ ㄧㄝˇ ㄏㄣˇ ㄍㄨˉㄉㄨˊ ㄅㄚ˙。
65
+ ./custom_character_voice/linghua/processed_66.wav|ㄧˉㄉㄠˉ, ㄅㄧㄥˋㄑㄧㄝˇ ㄏㄨㄛˊ ㄌㄜ˙ ㄒㄧㄚˋㄌㄞˊ。 ㄍㄞˉ ㄕㄨㄛˉ ㄕˋ ㄎㄢˉㄔㄥˉ ㄨㄟˇㄧㄝˋ ㄉㄜ˙ ㄐㄧㄥˉㄌㄧˋ ㄌㄜ˙ ㄅㄚ˙。
66
+ ./custom_character_voice/linghua/processed_67.wav|ㄙㄨㄟˉㄖㄢˊ ㄉㄨㄟˋ ㄨㄛˇ ㄌㄞˊㄕㄨㄛˉ, ㄊㄚˉ ㄕˋ ㄓㄣˉㄓㄥˋ ㄉㄜ˙ ㄕㄣˊㄇㄧㄥˊ。
67
+ ./custom_character_voice/linghua/processed_68.wav|ㄎㄜˇㄧˇ ㄍㄥˉㄍㄞˇ ㄉㄠˋㄑㄧˉ ㄉㄜ˙ ㄇㄧㄥˋㄩㄣˋ。
68
+ ./custom_character_voice/linghua/processed_69.wav|ㄉㄢˋㄕˋ ㄖㄨˊㄍㄨㄛˇ ㄕˋ ㄏㄜˊ ㄋㄧˇ ㄑㄧˇ ㄌㄜ˙ ㄔㄨㄥˉㄊㄨˉ ㄉㄜ˙ㄏㄨㄚˋ, ㄨㄛˇ ㄧˊㄉㄧㄥˋ ㄏㄨㄟˋ ㄓㄢˋ ㄗㄞˋ ㄋㄧˇ ㄓㄜˋ ㄧˉㄅㄧㄢˉ ㄉㄜ˙。
69
+ ./custom_character_voice/linghua/processed_70.wav|ㄅㄚˉㄓㄨㄥˋ ㄍㄨㄥˉㄙˉ ㄉㄚˋㄖㄣˊ ㄉㄜ˙ ㄏㄜˊㄗㄨㄛˋ ㄒㄧㄤˋㄌㄞˊ ㄏㄣˇ ㄩˊㄎㄨㄞˋ。
70
+ ./custom_character_voice/linghua/processed_71.wav|ㄎㄢˋ, ㄘㄠˉㄅㄢˋ ㄐㄧㄝˊㄑㄧㄥˋㄑㄧㄥˋㄉㄧㄢˇ ㄈㄟˉㄔㄤˊ ㄌㄠˊㄕㄣˊㄈㄟˋㄌㄧˋ, ㄧㄥˊㄕㄡˉ ㄉㄨㄛˉㄅㄢˋ ㄧㄝˇ ㄅㄨˋ ㄏㄠˇㄎㄢˋ。
71
+ ./custom_character_voice/linghua/processed_72.wav|ㄅㄚˉㄓㄨㄥˋ ㄍㄨㄥˉㄙˉ ㄉㄚˋㄖㄣˊ ㄘㄠˉㄅㄢˋ ㄉㄜ˙ ㄔㄢˇㄧㄝˋ, ㄓㄣˉㄉㄜ˙ ㄐㄧˋ ㄈㄥˉㄧㄚˇ ㄧㄡˋ ㄧㄡˇ ㄕㄡˉㄔㄥˊ。
72
+ ./custom_character_voice/linghua/processed_73.wav|ㄗㄨㄛˋㄨㄟˋ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄐㄧㄚˉㄓㄨˇ, ㄒㄩㄥˉㄓㄤˇ ㄆㄧㄥˊㄖˋ ㄒㄩˉㄧㄠˋ ㄔㄨˉㄇㄧㄢˋ ㄓㄨˉㄉㄨㄛˉㄔㄤˇ ㄏㄜˊ。
73
+ ./custom_character_voice/linghua/processed_74.wav|ㄨㄛˇ ㄙㄨㄟˉ ㄐㄧㄣˇㄌㄧˋ ㄈㄣˉㄉㄢˉ ㄒㄩㄥˉㄓㄤˇ ㄐㄧㄢˉㄕㄤˋ ㄙㄨㄛˇ ㄈㄨˋㄉㄢˉ ㄉㄜ˙ ㄗㄜˊㄖㄣˋ, ㄑㄩㄝˋ ㄧㄝˇ ㄨˊㄈㄚˇㄏㄨㄢˇ ㄏㄜˊ ㄊㄚˉ ㄔㄤˊㄋㄧㄢˊ ㄐㄧˉㄧㄚˉ ㄗㄞˋ ㄕㄣˉ ㄉㄜ˙ ㄆㄧˊㄐㄩㄢˋ。
74
+ ./custom_character_voice/linghua/processed_75.wav|ㄨㄛˇ ㄧㄝˇ ㄕˋ ㄉㄤˉㄕˊ ㄨㄟˋㄌㄜ˙ ㄇㄟˋㄇㄟˋ ㄓㄨㄛˊㄒㄧㄤˇ, ㄒㄧˉㄨㄤˋ ㄋㄧˇ ㄋㄥˊ ㄑㄩㄢˋㄧㄢˊ, ㄖㄤˋ ㄒㄩㄥˉㄓㄤˇ ㄉㄨㄛˉㄉㄨㄛˉ ㄓㄨˋㄧˋ ㄕㄣˉㄊㄧˇ ㄚ˙。
75
+ ./custom_character_voice/linghua/processed_76.wav|ㄐㄧㄝˊㄑㄧㄥˋㄑㄧㄥˋㄉㄧㄢˇ ㄕˋ ㄕㄥˋ ㄈㄥˋㄒㄧㄥˊ ㄏㄜˊ ㄨˉㄋㄩˇ ㄓㄨㄥˉ ㄉㄜ˙ ㄗㄜˊㄖㄣˋ。
76
+ ./custom_character_voice/linghua/processed_77.wav|ㄗㄨㄛˋㄨㄟˋ ㄧㄢˉㄏㄨㄛˇ ㄓㄨㄢˉㄐㄧㄚˉ, ㄧㄝˇ ㄉㄜ˙ ㄑㄩㄝˋㄋㄥˊ ㄖㄤˋ ㄑㄧˋㄈㄣˉ ㄖㄜˋㄌㄧㄝˋ ㄑㄧˇㄌㄞˊ。
77
+ ./custom_character_voice/linghua/processed_78.wav|ㄏㄜˊㄗㄨㄛˋ ㄉㄨㄛˉ ㄌㄜ˙, ㄧㄣˉㄦˊ ㄐㄧㄢˋㄐㄧㄢˋ ㄕㄨˊㄌㄨㄛˋ。
78
+ ./custom_character_voice/linghua/processed_79.wav|ㄓˋㄢˉ ㄏㄜˊ ㄒㄧㄠˉㄈㄤˊ ㄨㄣˋㄊㄧˊ ㄇㄚ˙? ㄨㄛˇㄇㄣ˙ ㄧㄝˇ ㄏㄨㄟˋ ㄧˉ ㄅㄧㄥˋ ㄋㄚˋㄖㄨˋ ㄩˋㄒㄧㄢˉ ㄍㄨㄟˉㄏㄨㄚˋ ㄉㄜ˙。
79
+ ./custom_character_voice/linghua/processed_80.wav|ㄓㄜˋㄒㄧㄝˉ ㄩㄢˊㄧㄣˉ ㄦˊ ㄎㄢˋㄅㄨˊㄉㄠˋ ㄧㄥˉㄏㄨㄚˉ, ㄘㄞˊ ㄏㄨㄟˋ ㄖㄤˋ ㄖㄣˊㄇㄣ˙ ㄒㄧㄣˉㄓㄨㄥˉ ㄌㄧㄡˊㄒㄧㄚˋ ㄑㄩㄝˉㄏㄢˋ ㄅㄚ˙。
80
+ ./custom_character_voice/linghua/processed_81.wav|ㄋㄧˇ ㄉㄜ˙ ㄑㄧㄥˇㄑㄧㄡˊ, ㄉㄨㄟˋ ㄨㄛˇ ㄌㄞˊㄕㄨㄛˉ ㄏㄣˇ ㄊㄜˋㄅㄧㄝˊ ㄋㄜ˙ ㄐㄧˋㄖㄢˊ ㄅㄚˇ ㄋㄧˇ ㄉㄤˋㄗㄨㄛˋ ㄆㄥˊㄧㄡˇ, ㄨㄛˇ ㄧㄝˇ ㄧㄥˉ ㄊㄢˇㄔㄥˊㄧˇㄉㄞˋ。
81
+ ./custom_character_voice/linghua/processed_82.wav|ㄅㄨˋㄍㄨㄛˋ, ㄕˋㄍㄨㄢˉ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ ㄉㄜ˙ ㄇㄧˋㄇㄧˋ, ㄏㄞˊ ㄒㄧˉㄨㄤˋ ㄋㄧˇ ㄋㄥˊ ㄕㄡˇㄎㄡˇㄖㄨˊㄆㄧㄥˊ。
82
+ ./custom_character_voice/linghua/processed_83.wav|ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉㄧㄣˉ ㄨㄟˋ ㄇㄟˊㄋㄥˊ ㄅㄠˇㄏㄨˋ ㄏㄠˇ ㄍㄨㄛˊㄅ���ˇㄐㄧˊ ㄅㄧㄝˊ ㄉㄜ˙ ㄉㄠˉㄍㄨㄥˉ, ㄗㄠˉㄕㄡˋ ㄌㄜ˙ ㄅㄨˋㄒㄧㄠˇ ㄉㄜ˙ ㄔㄨㄥˉㄐㄧˉ。
83
+ ./custom_character_voice/linghua/processed_84.wav|ㄅㄧㄝˊㄖㄣˊ ㄓㄨㄥˉ ㄧㄣˉㄇㄡˊ ㄙㄨㄢˋㄐㄧˋ ㄨㄛˇㄇㄣ˙ ㄕㄜˊㄙㄨㄣˇ ㄌㄜ˙ ㄓㄨˉㄉㄨㄛˉ ㄔㄣˊ ㄒㄧㄚˋ ㄕㄡˋㄉㄠˋ ㄒㄩˇㄉㄨㄛˉ ㄗㄜˊㄈㄚˊ。
84
+ ./custom_character_voice/linghua/processed_85.wav|ㄕㄣˋㄓˋ ㄧㄣˉ ㄓˉ ㄗㄠˇㄕㄨㄞˉ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄗㄞˋ ㄇㄨˋㄈㄨˇ ㄓㄨㄥˉ ㄉㄜ˙ ㄉㄧˋㄨㄟˋ ㄧㄝˇ ㄧˉㄌㄨㄛˋㄑㄧㄢˉㄓㄤˋ。
85
+ ./custom_character_voice/linghua/processed_86.wav|ㄏㄠˇ ㄗㄞˋ ㄒㄩㄥˉㄓㄤˇ ㄐㄧˋㄖㄣˋㄏㄡˋㄌㄧˋ ㄨㄢˇ ㄎㄨㄤˊㄌㄢˊ。
86
+ ./custom_character_voice/linghua/processed_87.wav|ㄐㄧㄚˉㄇㄣˊ ㄙㄨㄟˉ ㄧˇ ㄈㄨˋ ㄒㄧㄥˋ, ㄕㄜˋㄈㄥˉㄒㄧㄥˇ ㄧˉㄒㄧˉ ㄧㄝˇ ㄕㄤˋㄒㄧㄚˋ ㄑㄧˊㄒㄧㄣˉ, ㄉㄢˋ ㄉㄚˋㄕˋ ㄧㄠˋㄕˋ ㄈㄤˉㄇㄧㄢˋ ㄖㄥˊㄎㄠˋ ㄒㄩㄥˉㄓㄤˇ ㄉㄧㄥˋㄉㄨㄛˊ。
87
+ ./custom_character_voice/linghua/processed_88.wav|ㄊㄚˉㄇㄣ˙ ㄙㄨㄛˇㄔㄨㄢˊ ㄉㄜ˙ ㄉㄨㄢˋ ㄉㄠˉ ㄓˉㄕㄨˋ, ㄧㄝˇ ㄧㄣˉ ㄒㄧㄥˉㄒㄧㄤˋ, ㄩㄥˋㄊㄨˊ, ㄎㄨㄤˋㄓˊ, ㄌㄨˊㄏㄨㄛˇ ㄏㄨㄢˊㄐㄧㄥˋ, ㄖㄣˊ ㄓˉ ㄒㄧㄥˋㄍㄜˊ, ㄩㄢˊㄙㄨˋ ㄅㄧㄢˋㄏㄨㄚˋ ㄉㄜ˙ ㄅㄨˋㄊㄨㄥˊ ㄦˊ ㄧㄡˇㄙㄨㄛˇ ㄑㄩˉㄈㄣˉ。
88
+ ./custom_character_voice/linghua/processed_89.wav|ㄕˋ ㄉㄠˉ ㄍㄨㄥˉ ㄓˉㄐㄧㄢˉ ㄙㄨㄛˇㄕㄨㄛˉ ㄉㄜ˙ ㄌㄟˊㄉㄧㄢˋ ㄨˇㄔㄨㄢˉ。
89
+ ./custom_character_voice/linghua/processed_90.wav|ㄘㄤˊㄇㄧㄥˊ ㄉㄠˉ ㄉㄜ˙ ㄉㄠˉㄍㄨㄥˉ, ㄧㄝˇ ㄅㄟˋ ㄙㄨㄢˋㄗㄨㄛˋ ㄕˋ ㄅㄣˇㄌㄧㄥˇ ㄊㄨㄥˉㄕㄣˊ ㄉㄜ˙ ㄕㄣˊㄕˋ ㄒㄧㄤˉㄍㄨㄢˉ ㄖㄣˊㄩㄢˊ, ㄍㄨㄟˉㄕㄨˇ ㄊㄨㄥˇㄔㄡˊ ㄨㄣˊㄏㄨㄚˋ, ㄧˋㄕㄨˋ, ㄐㄧˋㄙˋ ㄉㄜ˙ ㄕㄜˋㄈㄥˋ ㄒㄧㄥˊㄧˋ ㄆㄞˋ ㄍㄨㄢˇㄌㄧˇ。
90
+ ./custom_character_voice/linghua/processed_91.wav|ㄔㄨˉㄒㄧㄢˋ ㄌㄜ˙ ㄉㄠˉㄍㄨㄥˉ ㄅㄟˋㄆㄢˋ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ, ㄗˋㄖㄢˊ ㄐㄧㄡˋㄕˋ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ ㄉㄜ˙ ㄉㄨˊㄅㄢˋ ㄅㄨˋㄌㄧˋ ㄌㄜ˙。
91
+ ./custom_character_voice/linghua/processed_92.wav|ㄉㄨㄟˋ ㄨㄛˇ ㄌㄞˊ ㄕㄨㄛˉ, ㄇㄨˇㄑㄧㄣˉ ㄕˋ ㄧˋㄧˋ ㄈㄟˉㄈㄢˊ ㄉㄜ˙ ㄘㄨㄣˊㄗㄞˋ。
92
+ ./custom_character_voice/linghua/processed_93.wav|ㄈㄨˊㄓㄨㄤˉ, ㄧㄡˉㄧㄚˇ, ㄨˊㄌㄨㄣˋ ㄩˋㄉㄠˋ ㄗㄣˇㄧㄤˋ ㄉㄜ˙ ㄐㄩˊㄇㄧㄢˋ, ㄉㄡˉ ㄏㄨㄟˋ ㄌㄨˋㄔㄨˉ ㄔㄣˊㄐㄧㄣˋ ㄉㄜ˙ ㄒㄧㄠˋㄖㄨㄥˊ, ㄧˇ ㄘㄨㄥˊㄖㄨㄥˊㄅㄨˋㄆㄛˋ ㄉㄜ˙ ㄊㄞˋㄉㄨˋ, ㄘㄠˉㄔˊ ㄓㄜ˙ ㄕㄣˇㄌㄧˇ ㄐㄧㄚˉ ㄉㄚˋㄉㄚˋㄒㄧㄠˇㄒㄧㄠˇ ㄉㄜ˙ ㄕˋㄨˋ。
93
+ ./custom_character_voice/linghua/processed_94.wav|ㄍㄢˇㄑㄧㄥˊ ㄕˋ ㄨㄢˊㄇㄟˇ ㄉㄜ˙ ㄏㄨㄚˋㄕㄣˉ ㄧㄝˇ ㄅㄨˋ ㄨㄟˋㄍㄨㄛˋ。
94
+ ./custom_character_voice/linghua/processed_95.wav|ㄉㄢˋ ㄗˋㄘㄨㄥˊ ㄊㄚˉ ㄌㄧˊㄕˋ ㄉㄜ˙ ㄋㄚˋ ㄧˉㄎㄜˋㄑㄧˇ, ㄨㄛˇ ㄐㄧㄡˋ ㄕㄣˉㄑㄧㄝˋ ㄉㄧˋ ㄧˋㄕˊ ㄉㄠˋ, ㄨㄛˇ ㄧˇㄐㄧㄥˉ ㄅㄨˊㄕˋ ㄋㄚˋㄍㄜˋ ㄎㄜˇㄧˇ ㄉㄨㄛˇ ㄗㄞˋ ㄇㄨˇㄑㄧㄣˉ ㄕㄣˉㄏㄡˋ ㄉㄜ˙ ㄒㄧㄠˇㄌㄧㄥˊㄏㄨㄚˉ ㄌㄜ˙。
95
+ ./custom_character_voice/linghua/processed_96.wav|ㄩㄢˊㄌㄞˊ ㄧㄠˋㄕㄨㄛˉ ㄉㄜ˙ㄏㄨㄚˋ, ㄎㄜˇㄋㄥˊ ㄅㄨˋㄊㄞˋ ㄈㄨˊㄏㄜˊ ㄉㄠˋㄑㄧㄝˋ ㄇㄨˋㄈㄨˇ ㄕㄜˋ ㄈㄥˉㄒㄧㄥˊ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄕㄣˉㄈㄣˋ。
96
+ ./custom_character_voice/linghua/processed_97.wav|ㄅㄨˋㄍㄨㄛˋ, ㄐㄧㄡˋ ㄨㄛˇ ㄉㄜ˙ ㄆㄢˋㄉㄨㄢˋ, ㄋㄧˇ ㄧㄥˉㄍㄞˉ ㄋㄥˊ ㄖㄨㄥˊㄒㄩˇ ㄨㄛˇ ㄒㄧㄠˇㄒㄧㄠˇㄉㄜ˙ ㄖㄣˋㄒㄧㄥˋ ㄅㄚ˙。
97
+ ./custom_character_voice/linghua/processed_98.wav|ㄕㄠˉㄨㄟˉ ㄧㄡˇㄉㄧㄢˇㄌㄟˋ ㄌㄜ˙ ㄎㄜˇㄧˇ ㄖㄤˋ ㄨㄛˇ ㄎㄠˋ ㄧˉㄒㄧㄚˋ ㄋㄧˇ ㄉㄜ˙ ㄐㄧㄢˉㄅㄤˇ ㄇㄚ˙?
98
+ ./custom_character_voice/linghua/processed_99.wav|ㄐㄧㄡˋㄐㄧㄡˋ。
99
+ ./custom_character_voice/linghua/processed_100.wav|ㄨㄛˇ ㄉㄡˉ ㄏㄣˇ ㄒㄧˇㄏㄨㄢˉ ㄧㄚˇㄩㄝˋ ㄕˉㄘˊ ㄑㄧˊㄧˋ ㄩˇ ㄨˇㄉㄠˇ ㄋㄧˇ ㄧㄝˇ ㄍㄢˇㄒㄧㄥˋㄑㄩˋ ㄇㄚ˙?
100
+ ./custom_character_voice/linghua/processed_102.wav|…… ㄕˋ ㄚ˙, ㄓˇㄧㄠˋ ㄕㄥˉㄏㄨㄛˊ ㄗㄞˋ ㄓㄜˋㄍㄜˋ ㄕˋㄐㄧㄝˋ ㄕㄤˋ, ㄐㄧㄡˋ ㄋㄢˊㄇㄧㄢˇ ㄩˋㄉㄠˋ ㄓㄨㄥˇㄓㄨㄥˇ ㄅㄨˋㄖㄨˊㄧˋ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ。
101
+ ./custom_character_voice/linghua/processed_103.wav|ㄉㄢˋ ㄖㄨˊㄍㄨㄛˇ ㄕˋ ㄧㄣˉㄨㄟˋ ㄗˋㄐㄧˇ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ, ㄐㄧㄡˋ ㄖㄤˋ ㄓㄡˉㄗㄠˉ ㄉㄜ˙ ㄖㄣˊ ㄉㄢˉㄒㄧㄣˉ ㄉㄜ�� ㄏㄨㄚˋ……
102
+ ./custom_character_voice/linghua/processed_104.wav|ㄍㄨㄛˇㄖㄢˊ, ㄨㄛˇ ㄏㄞˊㄕˋ ㄅㄨˋㄋㄥˊ ㄕㄨㄛˉ。
103
+ ./custom_character_voice/linghua/processed_105.wav|ㄋㄢˊㄕㄨㄞˋ, ㄓㄣˉㄉㄜ˙ ㄕˋ ㄧˉㄐㄧㄢˋ ㄏㄣˇㄋㄢˊ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ。
104
+ ./custom_character_voice/linghua/processed_106.wav|ㄨㄛˇ ㄅㄧˋㄒㄩˉ ㄅㄨˋㄉㄨㄢˋ ㄍㄠˋㄐㄧㄝˋ ㄗˋㄐㄧˇ ㄕˋ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄉㄚˋ ㄒㄧㄠˇㄐㄧㄝˇ ㄗㄞˋ ㄨˊㄕㄨˋㄕㄨㄤˉ ㄧㄢˇㄐㄧㄥˉ, ㄨˊㄕㄨˋ ㄖㄣˊ ㄉㄜ˙ ㄑㄧˉㄆㄢˋ ㄓˉㄒㄧㄚˋ ㄅㄞˇ ㄔㄨˉ ㄨㄢˊㄇㄟˇㄨˊㄑㄩㄝˉ ㄉㄜ˙ ㄗˉㄊㄞˋ。
105
+ ./custom_character_voice/linghua/processed_107.wav|ㄓㄜˋㄧㄤˋ ㄉㄜ˙ ㄨㄛˇ, ㄕˋㄈㄡˇ ㄧㄝˇ ㄍㄞˉ ㄓㄨㄟˉㄑㄧㄡˊ ㄗˋㄐㄧˇ ㄉㄜ˙ ㄩㄢˋㄨㄤˋ ㄋㄜ˙?
106
+ ./custom_character_voice/linghua/processed_108.wav|ㄕˋㄈㄡˇ ㄧㄝˇ ㄍㄞˉ… ㄖㄤˋ ㄋㄧˇ ㄌㄧˇㄐㄧㄝˇ ㄨㄛˇ ㄉㄜ˙ ㄒㄧㄣˉㄧˋ ㄋㄜ˙?
107
+ ./custom_character_voice/linghua/processed_109.wav|ㄨㄛˇ ㄉㄨㄟˋ ㄧˋㄍㄨㄛˊ ㄌㄧㄠˋㄌㄧˇ ㄏㄣˇ ㄧㄡˇ ㄒㄧㄥˋㄑㄩˋ, ㄙㄨㄟˉㄖㄢˊ ㄏㄣˇㄕㄠˇ ㄧㄡˇ ㄔㄤˊㄕˋ ㄉㄜ˙ ㄐㄧˉㄏㄨㄟˋ。
108
+ ./custom_character_voice/linghua/processed_110.wav|ㄖㄨˊㄍㄨㄛˇ ㄕˋ ㄧㄠˋ ㄐㄩˊㄒㄧㄢˋ ㄗㄞˋ ㄉㄠˋㄑㄧˉ ㄌㄧㄠˋㄌㄧˇ ㄋㄟˋ ㄉㄜ˙ ㄏㄨㄚˋ, ㄧㄥˉㄍㄞˉ ㄕˋ ㄔㄚˊ ㄆㄠˋ ㄈㄢˋ ㄅㄚ˙。
109
+ ./custom_character_voice/linghua/processed_111.wav|ㄅㄨˋㄋㄥˊ ㄍㄟˇ ㄧˋㄅㄢˉ ㄎㄜˋㄖㄣˊ ㄎㄢˋㄐㄧㄢˋ。
110
+ ./custom_character_voice/linghua/processed_112.wav|ㄨㄛˇ ㄧㄝˇ ㄕˋ ㄊㄡˉㄊㄡˉ ㄍㄠˋㄙㄨˋ ㄋㄧˇ ㄉㄜ˙。
111
+ ./custom_character_voice/linghua/processed_113.wav|ㄙㄨㄟˉㄖㄢˊ ㄅㄨˊㄕˋ ㄅㄨˋㄋㄥˊ ㄔˉ, ㄉㄢˋ ㄨㄛˇ ㄉㄨㄟˋ ㄉㄨㄥˋㄨˋ ㄓˉㄈㄤˊ ㄏㄨㄛˋ ㄋㄟˋㄗㄤˋ… ㄉㄚˋㄍㄞˋ ㄏㄨㄟˋ ㄧㄡˇㄉㄧㄢˇ…
112
+ ./custom_character_voice/linghua/processed_114.wav|ㄑㄧㄥˇ ㄙㄨㄟˊ ㄨㄛˇ ㄌㄞˊ, ㄓˇㄧㄠˋ ㄗㄡˇ ㄧˉㄒㄧㄠˇ ㄉㄨㄢˋㄌㄨˋ, ㄅㄨˊㄏㄨㄟˋ ㄉㄢˉㄍㄜˉ ㄋㄧˇ ㄊㄞˋ ㄓㄤˇㄕˊㄐㄧㄢˉ ㄉㄜ˙。
113
+ ./custom_character_voice/linghua/processed_115.wav|ㄉㄚˇㄊㄧㄥˉ ㄉㄠˋ ㄋㄧˇ ㄉㄜ˙ ㄕㄥˉㄖˋ ㄓˉㄏㄡˋ, ㄨㄛˇ ㄐㄧㄡˋ ㄊㄧˊㄑㄧㄢˊ ㄌㄜ˙ ㄧˉㄉㄨㄢˋㄕˊㄐㄧㄢˉ ㄎㄞˉㄕˇ ㄔㄡˊㄅㄟˋ。
114
+ ./custom_character_voice/linghua/processed_116.wav|ㄅㄧˇㄑㄧˇ ㄇㄧㄥˊㄍㄨㄟˋ ㄉㄜ˙ ㄌㄧˇㄨˋ ㄨㄛˇ ㄨㄤˋㄗˋ ㄘㄞˉㄘㄜˋ ㄏㄨㄛˋㄒㄩˇ ㄓㄜˋㄧㄤˋ ㄉㄜ˙ ㄌㄧˇㄨˋ ㄏㄨㄟˋ ㄍㄥˋㄏㄜˊ ㄨㄛˇㄇㄣ˙ ㄉㄜ˙ ㄑㄧㄥˊㄧˋ?
115
+ ./custom_character_voice/linghua/processed_117.wav|ㄘˇㄘˋ, ㄐㄧㄡˋ ㄑㄧㄥˇ ㄖㄤˋ ㄨㄛˇ ㄧˇㄕㄢˋ ㄨˊㄨㄟˋㄌㄧˇ ㄅㄚ˙。
116
+ ./custom_character_voice/linghua/processed_118.wav|ㄕˉㄌㄧˇ ㄌㄜ˙。
117
+ ./custom_character_voice/linghua/processed_119.wav|ㄍㄢˇㄒㄧㄝˋ, ㄩˇ ㄋㄧˇ ㄑㄧㄝˉㄘㄨㄛˉ ㄕˇ ㄨㄛˇ ㄕㄡˉㄧˋ ㄌㄧㄤˊㄉㄨㄛˉ, ㄒㄧㄤˉㄒㄧㄣˋ ㄗㄞˋ ㄐㄧㄢˋㄕㄨˋ ㄕㄤˋ ㄧㄝˇ ㄋㄥˊ ㄍㄥˋ ㄐㄧㄣˋ ㄧˉㄅㄨˋ。
118
+ ./custom_character_voice/linghua/processed_120.wav|ㄉㄨㄛˉㄎㄨㄟˉ ㄋㄧˇ ㄉㄜ˙ ㄉㄧㄢˇㄅㄛˉ。
119
+ ./custom_character_voice/linghua/processed_121.wav|ㄨㄛˇ ㄉㄨㄟˋ ㄗˋㄐㄧˇ ㄉㄜ˙ ㄋㄥˊㄌㄧˋ ㄧㄝˇ ㄌㄧˇㄐㄧㄝˇ ㄉㄜˊ ㄍㄥˋ ㄊㄡˋㄔㄜˋ ㄌㄜ˙。
120
+ ./custom_character_voice/linghua/processed_122.wav|ㄍㄥˋㄐㄧㄚˉ ㄧㄡˊㄖㄣˋㄧㄡˇㄩˊ ㄌㄜ˙。
121
+ ./custom_character_voice/linghua/processed_123.wav|ㄕㄡˉ ㄈㄥˋㄒㄧㄥˊ ㄕˋㄨˋ ㄓˉㄩˊ, ㄕㄣˋㄓˋ ㄧㄡˇㄎㄨㄥˋ ㄔㄤˊㄕˋ ㄧˉㄒㄧㄝˉ ㄒㄧㄣˉ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ。
122
+ ./custom_character_voice/linghua/processed_124.wav|ㄒㄧㄤˇㄧㄠˋ ㄌㄞˊ ㄕˋㄕˋ ㄗˋㄐㄧˇ ㄒㄩㄝˊㄗㄨㄛˋ ㄉㄜ˙ ㄉㄧㄢˇㄒㄧㄣˉ ㄇㄚ˙?
123
+ ./custom_character_voice/linghua/processed_125.wav|ㄒㄧㄣˉ ㄧㄡˇㄙㄨㄛˇㄙˉ, ㄙˉㄕˋ ㄖㄨˊㄆㄢˋ。
124
+ ./custom_character_voice/linghua/processed_126.wav|ㄊㄨˊㄌㄧㄠˋ ㄈㄨˊㄕˋ ㄕˋ, ㄌㄧㄡˊㄓㄨˋ ㄋㄢˊ。
125
+ ./custom_character_voice/linghua/processed_127.wav|ㄅㄠˋㄑㄧㄢˋ, ㄇㄧㄥˊㄇㄧㄥˊ ㄕˋ ㄓˊㄉㄜ˙ ㄍㄠˉㄒㄧㄥˋ ㄉㄜ˙ ㄕˊㄏㄡˋ, ㄨㄛˇ ㄑㄩㄝˋ ㄒㄧㄤˇㄑㄧˇ ㄌㄜ˙ ㄋㄚˋㄇㄜ˙ ㄅㄟˉㄕㄤˉ ㄉㄜ˙ ㄕˊㄎㄜˋ……
126
+ ./custom_character_voice/linghua/processed_128.wav|ㄒㄧㄤˉㄔㄨˋ ㄉㄜ˙ ㄕˊㄐㄧㄢˉㄍㄨㄛˋ ㄩˊ ㄔㄤˋㄏㄨㄢˇ ㄐㄧㄥˋㄖㄢˊ ㄖㄤˋ ㄨㄛˇ ㄏㄞˋㄆㄚˋ ㄗㄞˋㄘˋ ㄕˉㄑㄩˋ。
127
+ ./custom_character_voice/linghua/processed_129.wav|ㄕˉ… ㄕˉㄊㄞˋ ㄌㄜ˙ ㄧㄚ˙。
128
+ ./custom_character_voice/linghua/processed_130.wav|ㄅㄧˇㄨˇ ㄅㄚ˙ ㄕˉㄌㄧˇ ㄌㄜ˙。
129
+ ./custom_character_voice/linghua/processed_132.wav|ㄕㄣˊㄌㄧˇㄌㄧㄡˊ ㄕㄨㄤˉㄇㄧㄝˋ。
130
+ ./custom_character_voice/linghua/processed_133.wav|ㄓㄜˋ ㄇㄧˋ ㄑㄧˊ, ㄧㄝˇ ㄙㄨㄢˋ ㄉㄜˊ ㄧˉㄓㄨㄥˇ ㄧㄚˇㄑㄩˋ。
131
+ ./custom_character_voice/linghua/processed_134.wav|ㄐㄧㄣˉㄖˋ ㄩㄣˋㄕˋ ㄅㄨˋㄘㄨㄛˋ, ㄨㄛˇㄏㄨㄟˋ ㄓㄣˉㄒㄧˉ ㄓㄜˋ ㄧˉㄈㄣˋ ㄒㄧㄥˋㄩㄣˋ, ㄅㄨˋㄖㄨㄥˊ ㄒㄧㄠˇㄑㄩˋ ㄋㄜ˙。
132
+ ./custom_character_voice/linghua/processed_135.wav|ㄨㄛˇ ㄉㄜ˙ ㄉㄨㄟˋㄕㄡˇ, ㄍㄞˉ ㄐㄩㄝˊㄉㄨㄢˋ ㄌㄜ˙。
133
+ ./custom_character_voice/linghua/processed_136.wav|ㄕˉㄊㄞˋ ㄌㄜ˙ ㄨㄛˇ ㄏㄞˊㄧㄡˇ ㄨㄟˋㄐㄧㄣˇ ㄓˉㄕˋ ㄖㄤˋ ㄐㄧㄚˉㄗㄨˊ ㄇㄥˊㄒㄧㄡˉ ㄌㄜ˙。
134
+ ./custom_character_voice/linghua/processed_137.wav|ㄉㄜ˙ ㄐㄧㄚˉㄏㄨㄛ˙… ㄗㄣˇㄇㄜ˙ ㄏㄨㄟˋ…
135
+ ./custom_character_voice/linghua/processed_138.wav|ㄕㄣˊㄌㄧˇㄌㄧㄥˊㄏㄨㄚˊ。
136
+ ./custom_character_voice/linghua/processed_140.wav|ㄑㄧㄥˇ ㄘˋㄐㄧㄠˋ。
137
+ ./custom_character_voice/linghua/processed_141.wav|ㄑㄧㄥˇ ㄉㄨㄛˉ ㄍㄨㄢˉㄓㄠˋ。
filelists/final_annotation_val.txt ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ./custom_character_voice/linghua/processed_0.wav|ㄉㄠˋㄑㄧˉ ㄕㄣˊㄌㄧˇ ㄌㄧㄡˊㄊㄞˋ ㄉㄠˉㄕㄨˋ ㄐㄧㄝˉ ㄔㄨㄢˊㄕㄣˊ ㄌㄧˇㄌㄧㄥˊㄏㄨㄚˊ ㄘㄢˉㄕㄤˋ。
2
+ ./custom_character_voice/linghua/processed_1.wav|ㄑㄧㄥˇ ㄉㄨㄛˉ ㄓˇㄐㄧㄠˋ ㄚ˙。
3
+ ./custom_character_voice/linghua/processed_2.wav|ㄓㄜˋㄧㄤˋ ㄧㄡˉㄒㄧㄢˊㄢˉㄨㄣˇ ㄉㄜ˙ ㄕˊㄍㄨㄤˉ, ㄖㄨˊㄍㄨㄛˇ ㄗㄞˋ ㄉㄨㄛˉ ㄧˉㄉㄧㄢˇ ㄐㄧㄡˋ ㄏㄠˇ ㄌㄜ˙。
4
+ ./custom_character_voice/linghua/processed_3.wav|ㄨㄛˇ ㄓㄣˉ ㄊㄢˉㄒㄧㄣˉ ㄚ˙。
5
+ ./custom_character_voice/linghua/processed_4.wav|ㄐㄧㄡˋ ㄏㄜˊ ㄔㄚˊ ㄧˉㄧㄤˋ, ㄒㄧˋㄒㄧˋㄆㄧㄣˇㄨㄟˋ, ㄘㄞˊㄋㄥˊ ㄌㄧˇㄐㄧㄝˇ ㄑㄧˊㄓㄨㄥˉ ㄈㄥˉㄧㄚˇ。
6
+ ./custom_character_voice/linghua/processed_5.wav|ㄉㄡˉ ㄕˋ ㄌㄩˇㄒㄧㄥˊㄓㄜˇ ㄆㄧㄥˊㄖˋ ㄌㄧˇ ㄉㄜ˙ ㄕㄥˉㄏㄨㄛˊ ㄇㄚ˙?
7
+ ./custom_character_voice/linghua/processed_6.wav|ㄍㄢˇㄐㄩㄝˊ ㄧㄡˋ ㄉㄨㄛˉ ㄌㄧㄠˇㄐㄧㄝˇ ㄌㄜ˙ ㄋㄧˇ ㄧˉㄒㄧㄝˉ。
8
+ ./custom_character_voice/linghua/processed_7.wav|ㄐㄧㄢˋ ㄅㄠˋㄧㄝˋㄇㄧㄥˊ ㄍㄨㄥˉㄏㄨㄞˊ ㄅㄠˇ。
9
+ ./custom_character_voice/linghua/processed_8.wav|ㄙㄨㄟˊ ㄨㄛˇ ㄧˉㄊㄨㄥˊ ㄅㄧˋㄩˇ ㄅㄚ˙。
10
+ ./custom_character_voice/linghua/processed_9.wav|ㄙㄨㄛˇ ㄉㄚˋㄖㄣˊ, ㄕˋ ㄗㄞˋ ㄙㄨˋㄕㄨㄛˉ ㄕㄣˊㄇㄜ˙ ㄇㄚ˙?
11
+ ./custom_character_voice/linghua/processed_10.wav|ㄐㄧˋㄧㄣˊㄓㄨㄤˉㄙㄨˋ, ㄐㄩˊㄍㄠˉㄧㄥˋ ㄑㄩㄥˊㄓˉ。
12
+ ./custom_character_voice/linghua/processed_11.wav|ㄣˊ…… ㄇㄟˇㄐㄧㄥˇ ㄉㄤˉㄑㄧㄢˊ, ㄓˇㄔㄚˋ ㄧˉㄏㄨˊ ㄔㄚˊ ㄩˇ ㄓˉ ㄒㄧㄤˉㄔㄣˋ ㄋㄜ˙。
13
+ ./custom_character_voice/linghua/processed_12.wav|ㄧㄠˋ ㄑㄩˋ ㄋㄚˇㄅㄧㄢˉ ㄗㄡˇㄗㄡˇ ㄇㄚ˙?
14
+ ./custom_character_voice/linghua/processed_13.wav|ㄧㄢˇㄐㄧㄥˉ, ㄒㄧㄤˋ ㄓㄨˋㄈㄥˉ ㄔㄨㄟˉ ㄌㄞˊ ㄉㄜ˙ ㄈㄤˉㄒㄧㄤˋ。
15
+ ./custom_character_voice/linghua/processed_14.wav|ㄞˉㄧㄚˉ, ㄏㄣˇ ㄕㄨˉㄈㄨˊ ㄅㄚ˙。
16
+ ./custom_character_voice/linghua/processed_15.wav|ㄌㄩˇㄒㄧㄥˊㄓㄜˇ。
17
+ ./custom_character_voice/linghua/processed_16.wav|ㄓㄜˋㄧㄤˋ ㄗㄞˋ ㄑㄧㄥˉㄔㄣˊ ㄐㄧㄢˋ ㄋㄧˇ ㄧˊㄇㄧㄢˋ, ㄨㄛˇㄏㄨㄟˋ ㄖㄣˇㄅㄨˊㄓㄨˋ ㄐㄩㄝˊㄉㄜˊ, ㄐㄧㄝˉㄒㄧㄚˋ ㄌㄞˊㄐㄧㄤˉ ㄕˋ ㄕㄨㄣˋㄌㄧˋ ㄉㄜ˙ ㄧˉㄊㄧㄢˉ。
18
+ ./custom_character_voice/linghua/processed_18.wav|ㄔㄚˊㄈㄢˋ ㄓˉㄏㄡˋ, ㄋㄢˊㄇㄧㄢˇ ㄌㄩㄝˋㄧㄡˇ ㄎㄨㄣˋㄐㄩㄢˋ ㄕˋㄈㄡˇ ㄧㄡˇ ㄒㄧㄥˋㄓˋ ㄒㄧㄚˋㄆㄢˊ ㄑㄧˊ ㄊㄧˊㄕㄣˊ ㄋㄜ˙?
19
+ ./custom_character_voice/linghua/processed_20.wav|ㄏㄨㄟˋ ㄕˋ ㄧˊㄍㄜˋ ㄌㄧㄤˊㄒㄧㄠˉ ㄋㄜ˙。
20
+ ./custom_character_voice/linghua/processed_21.wav|ㄓˉㄕˋ ㄇㄥˋ ㄏㄜˊㄒㄩˉ ㄒㄧㄥˇ。
21
+ ./custom_character_voice/linghua/processed_22.wav|ㄅㄨˋㄅㄧˇㄓㄣˉ ㄖㄨˊ, ㄧˉㄒㄧㄤˉㄏㄨㄟˋ。
22
+ ./custom_character_voice/linghua/processed_23.wav|ㄉㄠˋㄑㄧˉ ㄇㄨˋㄈㄨˇ ㄕㄜˋ ㄈㄥˋㄒㄧㄥˊ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ, ㄨㄟˋ ㄩˊ ㄉㄠˋㄑㄧˉ ㄇㄧㄥˊㄇㄣˊ ㄓㄨㄥˉ ㄉㄜ˙ ㄅㄧˇㄊㄡˊ ㄓˉ ㄍㄜˊㄨㄟˋ。
23
+ ./custom_character_voice/linghua/processed_24.wav|ㄗㄨㄛˋㄨㄟˊ ㄙㄢˉ ㄈㄥˋㄒㄧㄥˊ ㄓˉㄧˉ, ㄓㄤˇㄍㄨㄢˇ ㄐㄧˋㄙˋ ㄏㄨㄛˊㄉㄨㄥˋ ㄩˇ ㄖㄣˊㄨㄣˊ ㄧˋㄕㄨˋ。
24
+ ./custom_character_voice/linghua/processed_25.wav|ㄕㄨㄤˉㄑㄧㄣˉ ㄍㄨㄛˋㄕˋ ㄓˉㄏㄡˋ, ㄗㄨˊ ㄋㄟˋ ㄉㄜ˙ ㄉㄚˋㄒㄧㄠˇ ㄕˋㄨˋ ㄅㄧㄢˋ ㄧㄡˊ ㄒㄩㄥˉㄓㄤˇ ㄏㄜˊ ㄨㄛˇ ㄔㄥˊㄉㄢˉ ㄌㄜ˙。
25
+ ./custom_character_voice/linghua/processed_26.wav|ㄏㄣˇㄉㄨㄛˉ ㄖㄣˊㄧㄣˉ ㄨㄟˋ ㄨㄛˇ ㄕˋ ㄅㄞˊㄌㄨˋ ㄍㄨㄥˉㄓㄨˇ, ㄕˋ ㄕㄜˋ ㄈㄥˋㄒㄧㄥˊ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ ㄉㄜ˙ ㄉㄚˋ ㄒㄧㄠˇㄐㄧㄝˇ, ㄦˊ ㄐㄧㄥˋㄓㄨㄥˋ ㄨㄛˇ。
26
+ ./custom_character_voice/linghua/processed_27.wav|ㄊㄚˉㄇㄣ˙ ㄙㄨㄛˇ ㄐㄧㄥˋㄓㄨㄥˋ ㄉㄜ˙, ㄓˇㄕˋ ㄨㄛˇ ㄙㄨㄛˇ ㄕㄣˉㄔㄨˋ ㄉㄜ˙ ㄉㄧˋㄨㄟˋ, ㄩˇㄌㄧㄥˊㄏㄨㄚˊ ㄨㄛˇ ㄕˋ ㄗㄣˇㄧㄤˋ ㄉㄜ˙ ㄖㄣˊ ㄅㄧㄥˋ ㄨˊ ㄍㄨㄢˉㄒㄧˋ。
27
+ ./custom_character_voice/linghua/processed_28.wav|ㄨㄛˇ ㄒㄧㄤˇ, ㄋㄥˊ ㄓㄣˉㄓㄥˋ ㄗㄡˇㄐㄧㄣˋ ㄨㄛˇ ㄉㄜ˙, ㄏㄨㄛˋㄒㄩˇ ㄓˇㄧㄡˇ, ㄖㄨˊㄐㄧㄣˉ ㄉㄜ˙ ㄨㄛˇ。
28
+ ./custom_character_voice/linghua/processed_29.wav|ㄧˉㄐㄧㄡˋ ㄒㄧㄤˇ ㄔㄥˊㄨㄟˋ ㄓˊㄉㄜ˙ ㄉㄚˋㄐㄧㄚˉ ㄒㄧㄣˋㄖㄣˋ ㄉㄜ˙ ㄖㄣˊ。
29
+ ./custom_character_voice/linghua/processed_30.wav|ㄍㄨˇㄨˇ ㄨㄛˇ ㄉㄜ˙ ㄩㄢˊㄧㄣˉ, ㄧˇ ㄅㄨˋㄗㄞˋ ㄕˋ ㄐㄧㄢˉㄕㄤˋ ㄉㄜ˙ ㄗㄜˊㄖㄣˋ, ㄏㄨㄛˋ ㄊㄚˉㄖㄣˊ ㄉㄜ˙ ㄑㄧˉㄉㄞˋ。
30
+ ./custom_character_voice/linghua/processed_31.wav|ㄕˋ ㄧㄣˉㄨㄟˋ…… ㄋㄧˇ ㄧㄝˇ ㄕˋ ㄓㄜˋㄧㄤˋ ㄉㄜ˙ ㄖㄣˊ ㄚ˙。
31
+ ./custom_character_voice/linghua/processed_32.wav|ㄖㄨˊㄍㄨㄛˇ ㄋㄧㄣˊ ㄧㄡˇㄎㄨㄥˋ, ㄨㄛˇㄇㄣ˙ ㄧˉㄅㄨˋ ㄇㄨˋㄌㄨˋ ㄔㄚˊㄕˋ ㄖㄨˊㄏㄜˊ?
32
+ ./custom_character_voice/linghua/processed_33.wav|ㄗㄞˋ ㄓㄜˋㄧㄤˋ ㄊㄧㄢˊㄐㄧㄥˋ ㄉㄜ˙ ㄖˋㄗ˙, ㄌㄩㄝˋㄐㄧㄚˉ ㄐㄧㄠˉㄌㄧㄡˊ ㄔㄚˊㄧˋ ㄒㄧㄣˉㄉㄜˊ, ㄒㄧㄤˇㄌㄞˊ ㄕˋ ㄆㄛˇㄐㄩˋ ㄧㄚˇㄑㄩˋ ㄉㄜ˙。
33
+ ./custom_character_voice/linghua/processed_34.wav|ㄖㄨˊㄍㄨㄛˇ ㄧㄡˇ ㄐㄧˉㄏㄨㄟˋ ㄉㄜ˙ㄏㄨㄚˋ, ㄨㄛˇㄒㄧㄤˇㄕˋ ㄓㄜ˙ ㄏㄜˊ ㄋㄧˇ ㄍㄨㄥˋㄉㄨˋ ㄧˋㄍㄨㄛˊ ㄉㄜ˙ ㄐㄧㄝˊㄖˋ。
34
+ ./custom_character_voice/linghua/processed_35.wav|ㄗㄨㄣˉㄒㄩㄣˊ ㄉㄜ˙ ㄉㄤˉㄉㄧˋ ㄈㄥˉㄙㄨˊ, ㄌㄧˇㄧˊ ㄍㄨㄟˉㄈㄢˋ, ㄏㄞˊㄧㄡˇ ㄅㄢˋㄕㄡˇ ㄌㄧˇ ㄉㄜ˙ ㄊㄨㄟˉㄐㄧㄢˋ。
35
+ ./custom_character_voice/linghua/processed_36.wav|ㄎㄜˇㄧˇ ㄇㄚˊㄈㄢˊ ㄋㄧˇ… ㄧˉㄧˉ ㄓˇㄉㄠˇ ㄨㄛˇ ㄇㄚ˙?
36
+ ./custom_character_voice/linghua/processed_37.wav|ㄕㄣˊㄓˉㄧㄢˇ, ㄐㄧˊ ㄕˋ ㄒㄩㄥˉㄏㄨㄞˊㄉㄚˋㄓˋ ㄓˉㄖㄣˊ ㄙㄨㄛˇ ㄏㄨㄛˋ ㄉㄜ˙ ㄧㄥˉㄕㄡˋ。
37
+ ./custom_character_voice/linghua/processed_38.wav|ㄖㄨˊㄍㄨㄛˇ ㄨㄣˋ ㄨㄛˇ ㄧㄡˇ ㄕㄣˊㄇㄜ˙ ㄓˋㄒㄧㄤˋ ㄉㄜ˙ㄏㄨㄚˋ。
38
+ ./custom_character_voice/linghua/processed_39.wav|ㄓㄜˋㄍㄜˋ ㄏㄞˊㄕˋ ㄅㄠˇㄇㄧˋ ㄅㄚ˙。
39
+ ./custom_character_voice/linghua/processed_40.wav|ㄓˇㄕˋ ㄧˊㄍㄜˋ ㄨㄟˉㄅㄨˋㄗㄨˊㄉㄠˋ ㄉㄜ˙ ㄇㄥˋㄒㄧㄤˇ ㄅㄚˋㄌㄜ˙。
40
+ ./custom_character_voice/linghua/processed_41.wav|ㄔㄤˊㄕㄨㄛˉ ㄔㄢˊ ㄔㄚˊ ㄧˉㄨㄟˋ。
41
+ ./custom_character_voice/linghua/processed_42.wav|ㄐㄧㄢˋ ㄔㄢˊ ㄧˋ ㄖㄨˊ。
42
+ ./custom_character_voice/linghua/processed_43.wav|ㄋㄚˋㄇㄜ˙ ㄐㄧㄢˋ ㄏㄜˊ ㄔㄚˊ, ㄧㄡˋ ㄕˋ ㄕㄣˊㄇㄜ˙ ㄍㄨㄢˉㄒㄧˋ ㄋㄜ˙?
43
+ ./custom_character_voice/linghua/processed_44.wav|ㄋㄧˇ ㄗㄞˋ ㄔㄥˊㄓㄨㄥˉ, ㄐㄧㄢˋㄍㄨㄛˋ ㄎㄨˉㄨㄟˇ ㄉㄜ˙ ㄧㄥˉㄏㄨㄚˉㄕㄨˋ ㄇㄚ˙?
44
+ ./custom_character_voice/linghua/processed_45.wav|ㄎㄨˉㄓˉ ㄇㄟˇ ㄖㄤˋ ㄨㄛˇ ㄒㄧㄤˇㄉㄠˋ ㄔㄨㄣˉㄊㄧㄢˉ ㄕㄥˋㄎㄞˉ ㄓˉㄐㄧㄥˇ。
45
+ ./custom_character_voice/linghua/processed_46.wav|ㄅㄨˋㄍㄨㄛˋ, ㄅㄧㄝˊㄖㄣˊ ㄙˋㄏㄨˉ ㄅㄧㄥˋ ㄅㄨˋ ㄓㄜˋㄇㄜ˙ ㄒㄧㄤˇ。
46
+ ./custom_character_voice/linghua/processed_47.wav|ㄎㄞˉㄏㄨㄚˉ ㄉㄜ˙ ㄧㄣˉㄕㄨˋㄏㄨㄟˋ ㄅㄟˋ ㄧˊㄗㄡˇ。
47
+ ./custom_character_voice/linghua/processed_48.wav|ㄐㄧㄡˋㄙㄨㄢˋ ㄧˉㄘˋ ㄧㄝˇㄏㄠˇ, ㄓㄣˉㄒㄧㄤˇ ㄎㄢˋㄉㄠˋ ㄊㄚˉ ㄗㄞˋㄘˋ ㄎㄞˉㄈㄤˋ。
48
+ ./custom_character_voice/linghua/processed_49.wav|ㄕˋ ㄨㄛˇ ㄏㄣˇ ㄓㄨㄥˋㄧㄠˋ ㄉㄜ˙ ㄆㄥˊㄧㄡˇ。
49
+ ./custom_character_voice/linghua/processed_50.wav|ㄊㄧㄢˉㄌㄥˇ ㄏㄜˊ ㄧㄤˊㄍㄨㄤˉ, ㄗㄨㄥˇㄕˋ ㄍㄢˇㄖㄢˇ ㄓㄜ˙ ㄨㄛˇ。
50
+ ./custom_character_voice/linghua/processed_51.wav|ㄧˋㄧˋ ㄕㄤˋ ㄌㄞˊㄕㄨㄛˉ, ㄊㄚˉ ㄐㄧㄡˋ ㄒㄧㄤˋㄕˋ ㄨㄛˇ ㄉㄜ˙ ㄌㄧㄥˋ ㄧˊㄍㄜˋ ㄒㄩㄥˉㄓㄤˇ ㄧˉㄧㄤˋ。
51
+ ./custom_character_voice/linghua/processed_52.wav|ㄔㄥˊㄨㄟˋ ㄌㄜ˙ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄧˉㄩㄢˊ。
52
+ ./custom_character_voice/linghua/processed_53.wav|ㄌㄧㄥˇ ㄈㄥˋㄒㄧㄥˊ ㄍㄨㄥˉㄗㄨㄛˋ ㄉㄜ˙ ㄐㄧㄡˇㄊㄧㄠˊ ㄕㄚˉㄌㄨㄛˊ, ㄊㄚˉ ㄗㄨㄥˇㄕˋ ㄧˉㄌㄧㄢˇ ㄧㄢˊㄙㄨˋ。
53
+ ./custom_character_voice/linghua/processed_54.wav|ㄊㄚˉ ㄘㄥˊㄐㄧㄥˉ ㄑㄧˇㄍㄨㄛˋ ㄐㄧˇㄘˋ ㄓㄥˉㄉㄨㄢˉ。
54
+ ./custom_character_voice/linghua/processed_55.wav|ㄊㄚˉ ㄅㄣˇㄓˋ ㄕˋ ㄓㄨㄥˉㄧˋ ㄓˉㄕˋ, ㄓㄜˋㄉㄧㄢˇ ㄨˊㄎㄜˇㄈㄡˇㄖㄣˋ。
55
+ ./custom_character_voice/linghua/processed_56.wav|ㄙㄨˉㄧㄝˇ ㄩㄝˋㄒㄧㄢˉㄕㄥˉ。
56
+ ./custom_character_voice/linghua/processed_57.wav|ㄊㄚˉ ㄏㄜˊ ㄐㄧㄡˇㄊㄧㄠˊ ㄒㄧㄠˇㄐㄧㄝˇ ㄧˉㄧㄤˋ, ㄕˋ ㄊㄧㄢˉㄌㄧㄥˇ ㄈㄥˋㄒㄧㄥˊ ㄉㄜ˙ ㄖㄣˊ。
57
+ ./custom_character_voice/linghua/processed_58.wav|ㄊㄚˉ…… ㄧㄝˇ ㄕˋ ㄧˊㄍㄜˋ ㄏㄣˇ ㄧㄡˇ ㄩㄢˊㄗㄜˊ ㄉㄜ˙ ㄖㄣˊ。
58
+ ./custom_character_voice/linghua/processed_59.wav|ㄓㄜˋㄒㄧㄝˉ ㄩㄢˊㄗㄜˊ ㄉㄜ˙ ㄐㄧㄢˉㄔˊ, ㄕㄣˋㄓˋ ㄅㄧˇ ㄐㄧㄡˇㄊㄧㄠˊ ㄒㄧㄠˇㄐㄧㄝˇ ㄍㄥˋ ㄓˊㄓㄨㄛˊ。
59
+ ./custom_character_voice/linghua/processed_60.wav|ㄅㄨˋㄍㄨㄛˋ, ㄕㄣˊㄇㄜ˙ ㄕˋ ㄧㄥˉㄍㄞˉ ㄅㄟˋ ㄙㄨㄢˋ ㄗㄞˋ ㄓㄜˋㄒㄧㄝˉ ㄩㄢˊㄗㄜˊ ㄓˉㄋㄟˋ…… ㄨㄛˇ ㄒㄧㄤˇ, ㄏㄨㄛˋㄒㄩˇ ㄓˇㄧㄡˇ ㄌㄨˋ ㄧㄝˇ ㄩㄢ�� ㄒㄧㄢˉㄕㄥˉ ㄗˋㄐㄧˇ ㄓˉㄉㄠˋ ㄅㄚ˙。
60
+ ./custom_character_voice/linghua/processed_61.wav|ㄒㄧㄠˇ ㄧㄡˋㄓˋ ㄏㄞˊㄗ˙, ㄗㄨㄟˋㄐㄧㄣˋ ㄧㄡˇ ㄇㄟˊ ㄧㄡˇㄍㄟˇ ㄋㄧˇ ㄊㄧㄢˉㄕㄣˊㄇㄜ˙ ㄇㄚˊㄈㄢˊ ㄋㄜ˙?
61
+ ./custom_character_voice/linghua/processed_62.wav|ㄖㄨˊㄍㄨㄛˇ ㄎㄢˋㄐㄧㄢˋ ㄊㄚˉ ㄊㄡˉ ㄌㄢˇ, ㄎㄜˇㄧˇ ㄓˊㄐㄧㄝˉ ㄍㄠˋㄙㄨˋ ㄨㄛˇ。
62
+ ./custom_character_voice/linghua/processed_63.wav|ㄌㄧˇㄙㄨㄛˇ ㄉㄤˉㄖㄢˊ ㄉㄜ˙ ㄎㄢˋㄈㄚˇ ㄇㄚ˙?
63
+ ./custom_character_voice/linghua/processed_64.wav|ㄅㄨˋㄍㄞˉ ㄧㄡˊ ㄨㄛˇ ㄉㄥˇ ㄒㄧㄚˋㄕㄨˇ ㄙㄨㄟˊㄧˋ ㄧˋㄌㄨㄣˋ。
64
+ ./custom_character_voice/linghua/processed_65.wav|ㄏㄥˉ, ㄐㄧㄤˉㄐㄩㄣˉ ㄉㄚˋㄖㄣˊ ㄊㄚˉ ㄗㄞˋ ㄓㄨㄟˉㄑㄧㄡˊ ㄩㄥˇㄏㄥˊ ㄓˉ ㄌㄨˋㄕㄤˋ, ㄎㄜˇㄋㄥˊ ㄧㄝˇ ㄏㄣˇ ㄍㄨˉㄉㄨˊ ㄅㄚ˙。
65
+ ./custom_character_voice/linghua/processed_66.wav|ㄧˉㄉㄠˉ, ㄅㄧㄥˋㄑㄧㄝˇ ㄏㄨㄛˊ ㄌㄜ˙ ㄒㄧㄚˋㄌㄞˊ。 ㄍㄞˉ ㄕㄨㄛˉ ㄕˋ ㄎㄢˉㄔㄥˉ ㄨㄟˇㄧㄝˋ ㄉㄜ˙ ㄐㄧㄥˉㄌㄧˋ ㄌㄜ˙ ㄅㄚ˙。
66
+ ./custom_character_voice/linghua/processed_67.wav|ㄙㄨㄟˉㄖㄢˊ ㄉㄨㄟˋ ㄨㄛˇ ㄌㄞˊㄕㄨㄛˉ, ㄊㄚˉ ㄕˋ ㄓㄣˉㄓㄥˋ ㄉㄜ˙ ㄕㄣˊㄇㄧㄥˊ。
67
+ ./custom_character_voice/linghua/processed_68.wav|ㄎㄜˇㄧˇ ㄍㄥˉㄍㄞˇ ㄉㄠˋㄑㄧˉ ㄉㄜ˙ ㄇㄧㄥˋㄩㄣˋ。
68
+ ./custom_character_voice/linghua/processed_69.wav|ㄉㄢˋㄕˋ ㄖㄨˊㄍㄨㄛˇ ㄕˋ ㄏㄜˊ ㄋㄧˇ ㄑㄧˇ ㄌㄜ˙ ㄔㄨㄥˉㄊㄨˉ ㄉㄜ˙ㄏㄨㄚˋ, ㄨㄛˇ ㄧˊㄉㄧㄥˋ ㄏㄨㄟˋ ㄓㄢˋ ㄗㄞˋ ㄋㄧˇ ㄓㄜˋ ㄧˉㄅㄧㄢˉ ㄉㄜ˙。
69
+ ./custom_character_voice/linghua/processed_70.wav|ㄅㄚˉㄓㄨㄥˋ ㄍㄨㄥˉㄙˉ ㄉㄚˋㄖㄣˊ ㄉㄜ˙ ㄏㄜˊㄗㄨㄛˋ ㄒㄧㄤˋㄌㄞˊ ㄏㄣˇ ㄩˊㄎㄨㄞˋ。
70
+ ./custom_character_voice/linghua/processed_71.wav|ㄎㄢˋ, ㄘㄠˉㄅㄢˋ ㄐㄧㄝˊㄑㄧㄥˋㄑㄧㄥˋㄉㄧㄢˇ ㄈㄟˉㄔㄤˊ ㄌㄠˊㄕㄣˊㄈㄟˋㄌㄧˋ, ㄧㄥˊㄕㄡˉ ㄉㄨㄛˉㄅㄢˋ ㄧㄝˇ ㄅㄨˋ ㄏㄠˇㄎㄢˋ。
71
+ ./custom_character_voice/linghua/processed_72.wav|ㄅㄚˉㄓㄨㄥˋ ㄍㄨㄥˉㄙˉ ㄉㄚˋㄖㄣˊ ㄘㄠˉㄅㄢˋ ㄉㄜ˙ ㄔㄢˇㄧㄝˋ, ㄓㄣˉㄉㄜ˙ ㄐㄧˋ ㄈㄥˉㄧㄚˇ ㄧㄡˋ ㄧㄡˇ ㄕㄡˉㄔㄥˊ。
72
+ ./custom_character_voice/linghua/processed_73.wav|ㄗㄨㄛˋㄨㄟˋ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄐㄧㄚˉㄓㄨˇ, ㄒㄩㄥˉㄓㄤˇ ㄆㄧㄥˊㄖˋ ㄒㄩˉㄧㄠˋ ㄔㄨˉㄇㄧㄢˋ ㄓㄨˉㄉㄨㄛˉㄔㄤˇ ㄏㄜˊ。
73
+ ./custom_character_voice/linghua/processed_74.wav|ㄨㄛˇ ㄙㄨㄟˉ ㄐㄧㄣˇㄌㄧˋ ㄈㄣˉㄉㄢˉ ㄒㄩㄥˉㄓㄤˇ ㄐㄧㄢˉㄕㄤˋ ㄙㄨㄛˇ ㄈㄨˋㄉㄢˉ ㄉㄜ˙ ㄗㄜˊㄖㄣˋ, ㄑㄩㄝˋ ㄧㄝˇ ㄨˊㄈㄚˇㄏㄨㄢˇ ㄏㄜˊ ㄊㄚˉ ㄔㄤˊㄋㄧㄢˊ ㄐㄧˉㄧㄚˉ ㄗㄞˋ ㄕㄣˉ ㄉㄜ˙ ㄆㄧˊㄐㄩㄢˋ。
74
+ ./custom_character_voice/linghua/processed_75.wav|ㄨㄛˇ ㄧㄝˇ ㄕˋ ㄉㄤˉㄕˊ ㄨㄟˋㄌㄜ˙ ㄇㄟˋㄇㄟˋ ㄓㄨㄛˊㄒㄧㄤˇ, ㄒㄧˉㄨㄤˋ ㄋㄧˇ ㄋㄥˊ ㄑㄩㄢˋㄧㄢˊ, ㄖㄤˋ ㄒㄩㄥˉㄓㄤˇ ㄉㄨㄛˉㄉㄨㄛˉ ㄓㄨˋㄧˋ ㄕㄣˉㄊㄧˇ ㄚ˙。
75
+ ./custom_character_voice/linghua/processed_76.wav|ㄐㄧㄝˊㄑㄧㄥˋㄑㄧㄥˋㄉㄧㄢˇ ㄕˋ ㄕㄥˋ ㄈㄥˋㄒㄧㄥˊ ㄏㄜˊ ㄨˉㄋㄩˇ ㄓㄨㄥˉ ㄉㄜ˙ ㄗㄜˊㄖㄣˋ。
76
+ ./custom_character_voice/linghua/processed_77.wav|ㄗㄨㄛˋㄨㄟˋ ㄧㄢˉㄏㄨㄛˇ ㄓㄨㄢˉㄐㄧㄚˉ, ㄧㄝˇ ㄉㄜ˙ ㄑㄩㄝˋㄋㄥˊ ㄖㄤˋ ㄑㄧˋㄈㄣˉ ㄖㄜˋㄌㄧㄝˋ ㄑㄧˇㄌㄞˊ。
77
+ ./custom_character_voice/linghua/processed_78.wav|ㄏㄜˊㄗㄨㄛˋ ㄉㄨㄛˉ ㄌㄜ˙, ㄧㄣˉㄦˊ ㄐㄧㄢˋㄐㄧㄢˋ ㄕㄨˊㄌㄨㄛˋ。
78
+ ./custom_character_voice/linghua/processed_79.wav|ㄓˋㄢˉ ㄏㄜˊ ㄒㄧㄠˉㄈㄤˊ ㄨㄣˋㄊㄧˊ ㄇㄚ˙? ㄨㄛˇㄇㄣ˙ ㄧㄝˇ ㄏㄨㄟˋ ㄧˉ ㄅㄧㄥˋ ㄋㄚˋㄖㄨˋ ㄩˋㄒㄧㄢˉ ㄍㄨㄟˉㄏㄨㄚˋ ㄉㄜ˙。
79
+ ./custom_character_voice/linghua/processed_80.wav|ㄓㄜˋㄒㄧㄝˉ ㄩㄢˊㄧㄣˉ ㄦˊ ㄎㄢˋㄅㄨˊㄉㄠˋ ㄧㄥˉㄏㄨㄚˉ, ㄘㄞˊ ㄏㄨㄟˋ ㄖㄤˋ ㄖㄣˊㄇㄣ˙ ㄒㄧㄣˉㄓㄨㄥˉ ㄌㄧㄡˊㄒㄧㄚˋ ㄑㄩㄝˉㄏㄢˋ ㄅㄚ˙。
80
+ ./custom_character_voice/linghua/processed_81.wav|ㄋㄧˇ ㄉㄜ˙ ㄑㄧㄥˇㄑㄧㄡˊ, ㄉㄨㄟˋ ㄨㄛˇ ㄌㄞˊㄕㄨㄛˉ ㄏㄣˇ ㄊㄜˋㄅㄧㄝˊ ㄋㄜ˙ ㄐㄧˋㄖㄢˊ ㄅㄚˇ ㄋㄧˇ ㄉㄤˋㄗㄨㄛˋ ㄆㄥˊㄧㄡˇ, ㄨㄛˇ ㄧㄝˇ ㄧㄥˉ ㄊㄢˇㄔㄥˊㄧˇㄉㄞˋ。
81
+ ./custom_character_voice/linghua/processed_82.wav|ㄅㄨˋㄍㄨㄛˋ, ㄕˋㄍㄨㄢˉ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ ㄉㄜ˙ ㄇㄧˋㄇㄧˋ, ㄏㄞˊ ㄒㄧˉㄨㄤˋ ㄋㄧˇ ㄋㄥˊ ㄕㄡˇㄎㄡˇㄖㄨˊㄆㄧㄥˊ。
82
+ ./custom_character_voice/linghua/processed_83.wav|ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉㄧㄣˉ ㄨㄟˋ ㄇㄟˊㄋㄥˊ ㄅㄠˇㄏㄨˋ ㄏㄠˇ ㄍㄨㄛˊㄅ���ˇㄐㄧˊ ㄅㄧㄝˊ ㄉㄜ˙ ㄉㄠˉㄍㄨㄥˉ, ㄗㄠˉㄕㄡˋ ㄌㄜ˙ ㄅㄨˋㄒㄧㄠˇ ㄉㄜ˙ ㄔㄨㄥˉㄐㄧˉ。
83
+ ./custom_character_voice/linghua/processed_84.wav|ㄅㄧㄝˊㄖㄣˊ ㄓㄨㄥˉ ㄧㄣˉㄇㄡˊ ㄙㄨㄢˋㄐㄧˋ ㄨㄛˇㄇㄣ˙ ㄕㄜˊㄙㄨㄣˇ ㄌㄜ˙ ㄓㄨˉㄉㄨㄛˉ ㄔㄣˊ ㄒㄧㄚˋ ㄕㄡˋㄉㄠˋ ㄒㄩˇㄉㄨㄛˉ ㄗㄜˊㄈㄚˊ。
84
+ ./custom_character_voice/linghua/processed_85.wav|ㄕㄣˋㄓˋ ㄧㄣˉ ㄓˉ ㄗㄠˇㄕㄨㄞˉ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄗㄞˋ ㄇㄨˋㄈㄨˇ ㄓㄨㄥˉ ㄉㄜ˙ ㄉㄧˋㄨㄟˋ ㄧㄝˇ ㄧˉㄌㄨㄛˋㄑㄧㄢˉㄓㄤˋ。
85
+ ./custom_character_voice/linghua/processed_86.wav|ㄏㄠˇ ㄗㄞˋ ㄒㄩㄥˉㄓㄤˇ ㄐㄧˋㄖㄣˋㄏㄡˋㄌㄧˋ ㄨㄢˇ ㄎㄨㄤˊㄌㄢˊ。
86
+ ./custom_character_voice/linghua/processed_87.wav|ㄐㄧㄚˉㄇㄣˊ ㄙㄨㄟˉ ㄧˇ ㄈㄨˋ ㄒㄧㄥˋ, ㄕㄜˋㄈㄥˉㄒㄧㄥˇ ㄧˉㄒㄧˉ ㄧㄝˇ ㄕㄤˋㄒㄧㄚˋ ㄑㄧˊㄒㄧㄣˉ, ㄉㄢˋ ㄉㄚˋㄕˋ ㄧㄠˋㄕˋ ㄈㄤˉㄇㄧㄢˋ ㄖㄥˊㄎㄠˋ ㄒㄩㄥˉㄓㄤˇ ㄉㄧㄥˋㄉㄨㄛˊ。
87
+ ./custom_character_voice/linghua/processed_88.wav|ㄊㄚˉㄇㄣ˙ ㄙㄨㄛˇㄔㄨㄢˊ ㄉㄜ˙ ㄉㄨㄢˋ ㄉㄠˉ ㄓˉㄕㄨˋ, ㄧㄝˇ ㄧㄣˉ ㄒㄧㄥˉㄒㄧㄤˋ, ㄩㄥˋㄊㄨˊ, ㄎㄨㄤˋㄓˊ, ㄌㄨˊㄏㄨㄛˇ ㄏㄨㄢˊㄐㄧㄥˋ, ㄖㄣˊ ㄓˉ ㄒㄧㄥˋㄍㄜˊ, ㄩㄢˊㄙㄨˋ ㄅㄧㄢˋㄏㄨㄚˋ ㄉㄜ˙ ㄅㄨˋㄊㄨㄥˊ ㄦˊ ㄧㄡˇㄙㄨㄛˇ ㄑㄩˉㄈㄣˉ。
88
+ ./custom_character_voice/linghua/processed_89.wav|ㄕˋ ㄉㄠˉ ㄍㄨㄥˉ ㄓˉㄐㄧㄢˉ ㄙㄨㄛˇㄕㄨㄛˉ ㄉㄜ˙ ㄌㄟˊㄉㄧㄢˋ ㄨˇㄔㄨㄢˉ。
89
+ ./custom_character_voice/linghua/processed_90.wav|ㄘㄤˊㄇㄧㄥˊ ㄉㄠˉ ㄉㄜ˙ ㄉㄠˉㄍㄨㄥˉ, ㄧㄝˇ ㄅㄟˋ ㄙㄨㄢˋㄗㄨㄛˋ ㄕˋ ㄅㄣˇㄌㄧㄥˇ ㄊㄨㄥˉㄕㄣˊ ㄉㄜ˙ ㄕㄣˊㄕˋ ㄒㄧㄤˉㄍㄨㄢˉ ㄖㄣˊㄩㄢˊ, ㄍㄨㄟˉㄕㄨˇ ㄊㄨㄥˇㄔㄡˊ ㄨㄣˊㄏㄨㄚˋ, ㄧˋㄕㄨˋ, ㄐㄧˋㄙˋ ㄉㄜ˙ ㄕㄜˋㄈㄥˋ ㄒㄧㄥˊㄧˋ ㄆㄞˋ ㄍㄨㄢˇㄌㄧˇ。
90
+ ./custom_character_voice/linghua/processed_91.wav|ㄔㄨˉㄒㄧㄢˋ ㄌㄜ˙ ㄉㄠˉㄍㄨㄥˉ ㄅㄟˋㄆㄢˋ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ, ㄗˋㄖㄢˊ ㄐㄧㄡˋㄕˋ ㄕㄣˊㄌㄧˇㄐㄧㄚˉ ㄉㄜ˙ ㄉㄨˊㄅㄢˋ ㄅㄨˋㄌㄧˋ ㄌㄜ˙。
91
+ ./custom_character_voice/linghua/processed_92.wav|ㄉㄨㄟˋ ㄨㄛˇ ㄌㄞˊ ㄕㄨㄛˉ, ㄇㄨˇㄑㄧㄣˉ ㄕˋ ㄧˋㄧˋ ㄈㄟˉㄈㄢˊ ㄉㄜ˙ ㄘㄨㄣˊㄗㄞˋ。
92
+ ./custom_character_voice/linghua/processed_93.wav|ㄈㄨˊㄓㄨㄤˉ, ㄧㄡˉㄧㄚˇ, ㄨˊㄌㄨㄣˋ ㄩˋㄉㄠˋ ㄗㄣˇㄧㄤˋ ㄉㄜ˙ ㄐㄩˊㄇㄧㄢˋ, ㄉㄡˉ ㄏㄨㄟˋ ㄌㄨˋㄔㄨˉ ㄔㄣˊㄐㄧㄣˋ ㄉㄜ˙ ㄒㄧㄠˋㄖㄨㄥˊ, ㄧˇ ㄘㄨㄥˊㄖㄨㄥˊㄅㄨˋㄆㄛˋ ㄉㄜ˙ ㄊㄞˋㄉㄨˋ, ㄘㄠˉㄔˊ ㄓㄜ˙ ㄕㄣˇㄌㄧˇ ㄐㄧㄚˉ ㄉㄚˋㄉㄚˋㄒㄧㄠˇㄒㄧㄠˇ ㄉㄜ˙ ㄕˋㄨˋ。
93
+ ./custom_character_voice/linghua/processed_94.wav|ㄍㄢˇㄑㄧㄥˊ ㄕˋ ㄨㄢˊㄇㄟˇ ㄉㄜ˙ ㄏㄨㄚˋㄕㄣˉ ㄧㄝˇ ㄅㄨˋ ㄨㄟˋㄍㄨㄛˋ。
94
+ ./custom_character_voice/linghua/processed_95.wav|ㄉㄢˋ ㄗˋㄘㄨㄥˊ ㄊㄚˉ ㄌㄧˊㄕˋ ㄉㄜ˙ ㄋㄚˋ ㄧˉㄎㄜˋㄑㄧˇ, ㄨㄛˇ ㄐㄧㄡˋ ㄕㄣˉㄑㄧㄝˋ ㄉㄧˋ ㄧˋㄕˊ ㄉㄠˋ, ㄨㄛˇ ㄧˇㄐㄧㄥˉ ㄅㄨˊㄕˋ ㄋㄚˋㄍㄜˋ ㄎㄜˇㄧˇ ㄉㄨㄛˇ ㄗㄞˋ ㄇㄨˇㄑㄧㄣˉ ㄕㄣˉㄏㄡˋ ㄉㄜ˙ ㄒㄧㄠˇㄌㄧㄥˊㄏㄨㄚˉ ㄌㄜ˙。
95
+ ./custom_character_voice/linghua/processed_96.wav|ㄩㄢˊㄌㄞˊ ㄧㄠˋㄕㄨㄛˉ ㄉㄜ˙ㄏㄨㄚˋ, ㄎㄜˇㄋㄥˊ ㄅㄨˋㄊㄞˋ ㄈㄨˊㄏㄜˊ ㄉㄠˋㄑㄧㄝˋ ㄇㄨˋㄈㄨˇ ㄕㄜˋ ㄈㄥˉㄒㄧㄥˊ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄕㄣˉㄈㄣˋ。
96
+ ./custom_character_voice/linghua/processed_97.wav|ㄅㄨˋㄍㄨㄛˋ, ㄐㄧㄡˋ ㄨㄛˇ ㄉㄜ˙ ㄆㄢˋㄉㄨㄢˋ, ㄋㄧˇ ㄧㄥˉㄍㄞˉ ㄋㄥˊ ㄖㄨㄥˊㄒㄩˇ ㄨㄛˇ ㄒㄧㄠˇㄒㄧㄠˇㄉㄜ˙ ㄖㄣˋㄒㄧㄥˋ ㄅㄚ˙。
97
+ ./custom_character_voice/linghua/processed_98.wav|ㄕㄠˉㄨㄟˉ ㄧㄡˇㄉㄧㄢˇㄌㄟˋ ㄌㄜ˙ ㄎㄜˇㄧˇ ㄖㄤˋ ㄨㄛˇ ㄎㄠˋ ㄧˉㄒㄧㄚˋ ㄋㄧˇ ㄉㄜ˙ ㄐㄧㄢˉㄅㄤˇ ㄇㄚ˙?
98
+ ./custom_character_voice/linghua/processed_99.wav|ㄐㄧㄡˋㄐㄧㄡˋ。
99
+ ./custom_character_voice/linghua/processed_100.wav|ㄨㄛˇ ㄉㄡˉ ㄏㄣˇ ㄒㄧˇㄏㄨㄢˉ ㄧㄚˇㄩㄝˋ ㄕˉㄘˊ ㄑㄧˊㄧˋ ㄩˇ ㄨˇㄉㄠˇ ㄋㄧˇ ㄧㄝˇ ㄍㄢˇㄒㄧㄥˋㄑㄩˋ ㄇㄚ˙?
100
+ ./custom_character_voice/linghua/processed_102.wav|…… ㄕˋ ㄚ˙, ㄓˇㄧㄠˋ ㄕㄥˉㄏㄨㄛˊ ㄗㄞˋ ㄓㄜˋㄍㄜˋ ㄕˋㄐㄧㄝˋ ㄕㄤˋ, ㄐㄧㄡˋ ㄋㄢˊㄇㄧㄢˇ ㄩˋㄉㄠˋ ㄓㄨㄥˇㄓㄨㄥˇ ㄅㄨˋㄖㄨˊㄧˋ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ。
101
+ ./custom_character_voice/linghua/processed_103.wav|ㄉㄢˋ ㄖㄨˊㄍㄨㄛˇ ㄕˋ ㄧㄣˉㄨㄟˋ ㄗˋㄐㄧˇ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ, ㄐㄧㄡˋ ㄖㄤˋ ㄓㄡˉㄗㄠˉ ㄉㄜ˙ ㄖㄣˊ ㄉㄢˉㄒㄧㄣˉ ㄉㄜ�� ㄏㄨㄚˋ……
102
+ ./custom_character_voice/linghua/processed_104.wav|ㄍㄨㄛˇㄖㄢˊ, ㄨㄛˇ ㄏㄞˊㄕˋ ㄅㄨˋㄋㄥˊ ㄕㄨㄛˉ。
103
+ ./custom_character_voice/linghua/processed_105.wav|ㄋㄢˊㄕㄨㄞˋ, ㄓㄣˉㄉㄜ˙ ㄕˋ ㄧˉㄐㄧㄢˋ ㄏㄣˇㄋㄢˊ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ。
104
+ ./custom_character_voice/linghua/processed_106.wav|ㄨㄛˇ ㄅㄧˋㄒㄩˉ ㄅㄨˋㄉㄨㄢˋ ㄍㄠˋㄐㄧㄝˋ ㄗˋㄐㄧˇ ㄕˋ ㄕㄣˊㄌㄧˋ ㄐㄧㄚˉ ㄉㄜ˙ ㄉㄚˋ ㄒㄧㄠˇㄐㄧㄝˇ ㄗㄞˋ ㄨˊㄕㄨˋㄕㄨㄤˉ ㄧㄢˇㄐㄧㄥˉ, ㄨˊㄕㄨˋ ㄖㄣˊ ㄉㄜ˙ ㄑㄧˉㄆㄢˋ ㄓˉㄒㄧㄚˋ ㄅㄞˇ ㄔㄨˉ ㄨㄢˊㄇㄟˇㄨˊㄑㄩㄝˉ ㄉㄜ˙ ㄗˉㄊㄞˋ。
105
+ ./custom_character_voice/linghua/processed_107.wav|ㄓㄜˋㄧㄤˋ ㄉㄜ˙ ㄨㄛˇ, ㄕˋㄈㄡˇ ㄧㄝˇ ㄍㄞˉ ㄓㄨㄟˉㄑㄧㄡˊ ㄗˋㄐㄧˇ ㄉㄜ˙ ㄩㄢˋㄨㄤˋ ㄋㄜ˙?
106
+ ./custom_character_voice/linghua/processed_108.wav|ㄕˋㄈㄡˇ ㄧㄝˇ ㄍㄞˉ… ㄖㄤˋ ㄋㄧˇ ㄌㄧˇㄐㄧㄝˇ ㄨㄛˇ ㄉㄜ˙ ㄒㄧㄣˉㄧˋ ㄋㄜ˙?
107
+ ./custom_character_voice/linghua/processed_109.wav|ㄨㄛˇ ㄉㄨㄟˋ ㄧˋㄍㄨㄛˊ ㄌㄧㄠˋㄌㄧˇ ㄏㄣˇ ㄧㄡˇ ㄒㄧㄥˋㄑㄩˋ, ㄙㄨㄟˉㄖㄢˊ ㄏㄣˇㄕㄠˇ ㄧㄡˇ ㄔㄤˊㄕˋ ㄉㄜ˙ ㄐㄧˉㄏㄨㄟˋ。
108
+ ./custom_character_voice/linghua/processed_110.wav|ㄖㄨˊㄍㄨㄛˇ ㄕˋ ㄧㄠˋ ㄐㄩˊㄒㄧㄢˋ ㄗㄞˋ ㄉㄠˋㄑㄧˉ ㄌㄧㄠˋㄌㄧˇ ㄋㄟˋ ㄉㄜ˙ ㄏㄨㄚˋ, ㄧㄥˉㄍㄞˉ ㄕˋ ㄔㄚˊ ㄆㄠˋ ㄈㄢˋ ㄅㄚ˙。
109
+ ./custom_character_voice/linghua/processed_111.wav|ㄅㄨˋㄋㄥˊ ㄍㄟˇ ㄧˋㄅㄢˉ ㄎㄜˋㄖㄣˊ ㄎㄢˋㄐㄧㄢˋ。
110
+ ./custom_character_voice/linghua/processed_112.wav|ㄨㄛˇ ㄧㄝˇ ㄕˋ ㄊㄡˉㄊㄡˉ ㄍㄠˋㄙㄨˋ ㄋㄧˇ ㄉㄜ˙。
111
+ ./custom_character_voice/linghua/processed_113.wav|ㄙㄨㄟˉㄖㄢˊ ㄅㄨˊㄕˋ ㄅㄨˋㄋㄥˊ ㄔˉ, ㄉㄢˋ ㄨㄛˇ ㄉㄨㄟˋ ㄉㄨㄥˋㄨˋ ㄓˉㄈㄤˊ ㄏㄨㄛˋ ㄋㄟˋㄗㄤˋ… ㄉㄚˋㄍㄞˋ ㄏㄨㄟˋ ㄧㄡˇㄉㄧㄢˇ…
112
+ ./custom_character_voice/linghua/processed_114.wav|ㄑㄧㄥˇ ㄙㄨㄟˊ ㄨㄛˇ ㄌㄞˊ, ㄓˇㄧㄠˋ ㄗㄡˇ ㄧˉㄒㄧㄠˇ ㄉㄨㄢˋㄌㄨˋ, ㄅㄨˊㄏㄨㄟˋ ㄉㄢˉㄍㄜˉ ㄋㄧˇ ㄊㄞˋ ㄓㄤˇㄕˊㄐㄧㄢˉ ㄉㄜ˙。
113
+ ./custom_character_voice/linghua/processed_115.wav|ㄉㄚˇㄊㄧㄥˉ ㄉㄠˋ ㄋㄧˇ ㄉㄜ˙ ㄕㄥˉㄖˋ ㄓˉㄏㄡˋ, ㄨㄛˇ ㄐㄧㄡˋ ㄊㄧˊㄑㄧㄢˊ ㄌㄜ˙ ㄧˉㄉㄨㄢˋㄕˊㄐㄧㄢˉ ㄎㄞˉㄕˇ ㄔㄡˊㄅㄟˋ。
114
+ ./custom_character_voice/linghua/processed_116.wav|ㄅㄧˇㄑㄧˇ ㄇㄧㄥˊㄍㄨㄟˋ ㄉㄜ˙ ㄌㄧˇㄨˋ ㄨㄛˇ ㄨㄤˋㄗˋ ㄘㄞˉㄘㄜˋ ㄏㄨㄛˋㄒㄩˇ ㄓㄜˋㄧㄤˋ ㄉㄜ˙ ㄌㄧˇㄨˋ ㄏㄨㄟˋ ㄍㄥˋㄏㄜˊ ㄨㄛˇㄇㄣ˙ ㄉㄜ˙ ㄑㄧㄥˊㄧˋ?
115
+ ./custom_character_voice/linghua/processed_117.wav|ㄘˇㄘˋ, ㄐㄧㄡˋ ㄑㄧㄥˇ ㄖㄤˋ ㄨㄛˇ ㄧˇㄕㄢˋ ㄨˊㄨㄟˋㄌㄧˇ ㄅㄚ˙。
116
+ ./custom_character_voice/linghua/processed_118.wav|ㄕˉㄌㄧˇ ㄌㄜ˙。
117
+ ./custom_character_voice/linghua/processed_119.wav|ㄍㄢˇㄒㄧㄝˋ, ㄩˇ ㄋㄧˇ ㄑㄧㄝˉㄘㄨㄛˉ ㄕˇ ㄨㄛˇ ㄕㄡˉㄧˋ ㄌㄧㄤˊㄉㄨㄛˉ, ㄒㄧㄤˉㄒㄧㄣˋ ㄗㄞˋ ㄐㄧㄢˋㄕㄨˋ ㄕㄤˋ ㄧㄝˇ ㄋㄥˊ ㄍㄥˋ ㄐㄧㄣˋ ㄧˉㄅㄨˋ。
118
+ ./custom_character_voice/linghua/processed_120.wav|ㄉㄨㄛˉㄎㄨㄟˉ ㄋㄧˇ ㄉㄜ˙ ㄉㄧㄢˇㄅㄛˉ。
119
+ ./custom_character_voice/linghua/processed_121.wav|ㄨㄛˇ ㄉㄨㄟˋ ㄗˋㄐㄧˇ ㄉㄜ˙ ㄋㄥˊㄌㄧˋ ㄧㄝˇ ㄌㄧˇㄐㄧㄝˇ ㄉㄜˊ ㄍㄥˋ ㄊㄡˋㄔㄜˋ ㄌㄜ˙。
120
+ ./custom_character_voice/linghua/processed_122.wav|ㄍㄥˋㄐㄧㄚˉ ㄧㄡˊㄖㄣˋㄧㄡˇㄩˊ ㄌㄜ˙。
121
+ ./custom_character_voice/linghua/processed_123.wav|ㄕㄡˉ ㄈㄥˋㄒㄧㄥˊ ㄕˋㄨˋ ㄓˉㄩˊ, ㄕㄣˋㄓˋ ㄧㄡˇㄎㄨㄥˋ ㄔㄤˊㄕˋ ㄧˉㄒㄧㄝˉ ㄒㄧㄣˉ ㄉㄜ˙ ㄕˋㄑㄧㄥˊ。
122
+ ./custom_character_voice/linghua/processed_124.wav|ㄒㄧㄤˇㄧㄠˋ ㄌㄞˊ ㄕˋㄕˋ ㄗˋㄐㄧˇ ㄒㄩㄝˊㄗㄨㄛˋ ㄉㄜ˙ ㄉㄧㄢˇㄒㄧㄣˉ ㄇㄚ˙?
123
+ ./custom_character_voice/linghua/processed_125.wav|ㄒㄧㄣˉ ㄧㄡˇㄙㄨㄛˇㄙˉ, ㄙˉㄕˋ ㄖㄨˊㄆㄢˋ。
124
+ ./custom_character_voice/linghua/processed_126.wav|ㄊㄨˊㄌㄧㄠˋ ㄈㄨˊㄕˋ ㄕˋ, ㄌㄧㄡˊㄓㄨˋ ㄋㄢˊ。
125
+ ./custom_character_voice/linghua/processed_127.wav|ㄅㄠˋㄑㄧㄢˋ, ㄇㄧㄥˊㄇㄧㄥˊ ㄕˋ ㄓˊㄉㄜ˙ ㄍㄠˉㄒㄧㄥˋ ㄉㄜ˙ ㄕˊㄏㄡˋ, ㄨㄛˇ ㄑㄩㄝˋ ㄒㄧㄤˇㄑㄧˇ ㄌㄜ˙ ㄋㄚˋㄇㄜ˙ ㄅㄟˉㄕㄤˉ ㄉㄜ˙ ㄕˊㄎㄜˋ……
126
+ ./custom_character_voice/linghua/processed_128.wav|ㄒㄧㄤˉㄔㄨˋ ㄉㄜ˙ ㄕˊㄐㄧㄢˉㄍㄨㄛˋ ㄩˊ ㄔㄤˋㄏㄨㄢˇ ㄐㄧㄥˋㄖㄢˊ ㄖㄤˋ ㄨㄛˇ ㄏㄞˋㄆㄚˋ ㄗㄞˋㄘˋ ㄕˉㄑㄩˋ。
127
+ ./custom_character_voice/linghua/processed_129.wav|ㄕˉ… ㄕˉㄊㄞˋ ㄌㄜ˙ ㄧㄚ˙。
128
+ ./custom_character_voice/linghua/processed_130.wav|ㄅㄧˇㄨˇ ㄅㄚ˙ ㄕˉㄌㄧˇ ㄌㄜ˙。
129
+ ./custom_character_voice/linghua/processed_132.wav|ㄕㄣˊㄌㄧˇㄌㄧㄡˊ ㄕㄨㄤˉㄇㄧㄝˋ。
130
+ ./custom_character_voice/linghua/processed_133.wav|ㄓㄜˋ ㄇㄧˋ ㄑㄧˊ, ㄧㄝˇ ㄙㄨㄢˋ ㄉㄜˊ ㄧˉㄓㄨㄥˇ ㄧㄚˇㄑㄩˋ。
131
+ ./custom_character_voice/linghua/processed_134.wav|ㄐㄧㄣˉㄖˋ ㄩㄣˋㄕˋ ㄅㄨˋㄘㄨㄛˋ, ㄨㄛˇㄏㄨㄟˋ ㄓㄣˉㄒㄧˉ ㄓㄜˋ ㄧˉㄈㄣˋ ㄒㄧㄥˋㄩㄣˋ, ㄅㄨˋㄖㄨㄥˊ ㄒㄧㄠˇㄑㄩˋ ㄋㄜ˙。
132
+ ./custom_character_voice/linghua/processed_135.wav|ㄨㄛˇ ㄉㄜ˙ ㄉㄨㄟˋㄕㄡˇ, ㄍㄞˉ ㄐㄩㄝˊㄉㄨㄢˋ ㄌㄜ˙。
133
+ ./custom_character_voice/linghua/processed_136.wav|ㄕˉㄊㄞˋ ㄌㄜ˙ ㄨㄛˇ ㄏㄞˊㄧㄡˇ ㄨㄟˋㄐㄧㄣˇ ㄓˉㄕˋ ㄖㄤˋ ㄐㄧㄚˉㄗㄨˊ ㄇㄥˊㄒㄧㄡˉ ㄌㄜ˙。
134
+ ./custom_character_voice/linghua/processed_137.wav|ㄉㄜ˙ ㄐㄧㄚˉㄏㄨㄛ˙… ㄗㄣˇㄇㄜ˙ ㄏㄨㄟˋ…
135
+ ./custom_character_voice/linghua/processed_138.wav|ㄕㄣˊㄌㄧˇㄌㄧㄥˊㄏㄨㄚˊ。
136
+ ./custom_character_voice/linghua/processed_140.wav|ㄑㄧㄥˇ ㄘˋㄐㄧㄠˋ。
137
+ ./custom_character_voice/linghua/processed_141.wav|ㄑㄧㄥˇ ㄉㄨㄛˉ ㄍㄨㄢˉㄓㄠˋ。
filelists/short_character_anno.list ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ./custom_character_voice/linghua/processed_0.wav|0|稻妻神里流太刀术皆传神里绫华参上
2
+ ./custom_character_voice/linghua/processed_1.wav|0|請多指教啊
3
+ ./custom_character_voice/linghua/processed_2.wav|0|這樣悠閒安穩的時光,如果再多一點就好了。
4
+ ./custom_character_voice/linghua/processed_3.wav|0|我真貪心啊
5
+ ./custom_character_voice/linghua/processed_4.wav|0|就和茶一样,细细品味,才能理解其中风雅。
6
+ ./custom_character_voice/linghua/processed_5.wav|0|都是旅行者平日里的生活吗?
7
+ ./custom_character_voice/linghua/processed_6.wav|0|感覺又多瞭解了你一些。
8
+ ./custom_character_voice/linghua/processed_7.wav|0|剑抱业名工懷寶
9
+ ./custom_character_voice/linghua/processed_8.wav|0|随我一同避雨吧
10
+ ./custom_character_voice/linghua/processed_9.wav|0|所大人,是在訴說什麼嗎?
11
+ ./custom_character_voice/linghua/processed_10.wav|0|寂银妆素,桔高映琼枝。
12
+ ./custom_character_voice/linghua/processed_11.wav|0|嗯……美景当前,只差一壶茶与之相衬呢。
13
+ ./custom_character_voice/linghua/processed_12.wav|0|要去哪邊走走嗎?
14
+ ./custom_character_voice/linghua/processed_13.wav|0|眼睛,向著風吹來的方向
15
+ ./custom_character_voice/linghua/processed_14.wav|0|哎呀,很舒服吧
16
+ ./custom_character_voice/linghua/processed_15.wav|0|旅行者
17
+ ./custom_character_voice/linghua/processed_16.wav|0|這樣在清晨見你一面,我會忍不住覺得,接下來將是順利的一天。
18
+ ./custom_character_voice/linghua/processed_18.wav|0|茶饭之后,难免略有困倦是否有兴致下盘棋提神呢?
19
+ ./custom_character_voice/linghua/processed_20.wav|0|会是一个良宵呢
20
+ ./custom_character_voice/linghua/processed_21.wav|0|知是梦 何须醒
21
+ ./custom_character_voice/linghua/processed_22.wav|0|不比真如,一相會。
22
+ ./custom_character_voice/linghua/processed_23.wav|0|稻妻幕府社奉行神里家,位於稻妻名門中的筆頭之格位。
23
+ ./custom_character_voice/linghua/processed_24.wav|0|作为三奉行之一,掌管祭祀活动与人文艺术
24
+ ./custom_character_voice/linghua/processed_25.wav|0|双亲过世之后,族内的大小事务便由兄长和我承担了。
25
+ ./custom_character_voice/linghua/processed_26.wav|0|很多人因為我是白鷺公主,是社奉行神里家的大小姐,而敬重我。
26
+ ./custom_character_voice/linghua/processed_27.wav|0|他们所敬重的,只是我所身处的地位,与绫华我是怎样的人并无关系。
27
+ ./custom_character_voice/linghua/processed_28.wav|0|我想,能真正走进我的,或许只有,如今的我
28
+ ./custom_character_voice/linghua/processed_29.wav|0|依舊想成為值得大家信任的人
29
+ ./custom_character_voice/linghua/processed_30.wav|0|鼓舞我的原因,已不再是肩上的责任,或他人的期待。
30
+ ./custom_character_voice/linghua/processed_31.wav|0|是因為……你也是這樣的人啊
31
+ ./custom_character_voice/linghua/processed_32.wav|0|如果您有空,我們一步暮露茶室如何?
32
+ ./custom_character_voice/linghua/processed_33.wav|0|在这样恬静的日子,略加交流茶艺心得,想来是颇具雅趣的。
33
+ ./custom_character_voice/linghua/processed_34.wav|0|如果有机会的话,我想试着和你共度异国的节日。
34
+ ./custom_character_voice/linghua/processed_35.wav|0|遵循的当地风俗、礼仪规范,还有伴手礼的推荐
35
+ ./custom_character_voice/linghua/processed_36.wav|0|可以麻烦你…一一指导我吗?
36
+ ./custom_character_voice/linghua/processed_37.wav|0|神之眼,即是胸怀大志之人所获的应兽
37
+ ./custom_character_voice/linghua/processed_38.wav|0|如果问我有什么志向的话
38
+ ./custom_character_voice/linghua/processed_39.wav|0|这个还是保密吧
39
+ ./custom_character_voice/linghua/processed_40.wav|0|只是一个微不足道的梦想罢了
40
+ ./custom_character_voice/linghua/processed_41.wav|0|常说 蝉茶一味
41
+ ./custom_character_voice/linghua/processed_42.wav|0|剑禅亦如
42
+ ./custom_character_voice/linghua/processed_43.wav|0|那么剑和茶,又是什么关系呢?
43
+ ./custom_character_voice/linghua/processed_44.wav|0|你在城中,見過枯萎的櫻花樹嗎?
44
+ ./custom_character_voice/linghua/processed_45.wav|0|枯枝美 讓我想到春天盛開之景
45
+ ./custom_character_voice/linghua/processed_46.wav|0|不过,别人似乎并不这么想
46
+ ./custom_character_voice/linghua/processed_47.wav|0|開花的音數會被移走
47
+ ./custom_character_voice/linghua/processed_48.wav|0|就算一次也好,真想看到它再次開放。
48
+ ./custom_character_voice/linghua/processed_49.wav|0|是我很重要的朋友
49
+ ./custom_character_voice/linghua/processed_50.wav|0|天冷和阳光,总是感染着我
50
+ ./custom_character_voice/linghua/processed_51.wav|0|意义上来说,他就像是我的另一个兄长一样。
51
+ ./custom_character_voice/linghua/processed_52.wav|0|成為了神力家的一員
52
+ ./custom_character_voice/linghua/processed_53.wav|0|领奉行工作的九条沙罗,他总是一脸严肃
53
+ ./custom_character_voice/linghua/processed_54.wav|0|她曾经起过几次争端
54
+ ./custom_character_voice/linghua/processed_55.wav|0|���本质是忠义之士,这点无可否认
55
+ ./custom_character_voice/linghua/processed_56.wav|0|苏冶岳先生
56
+ ./custom_character_voice/linghua/processed_57.wav|0|她和九条小姐一样,是天领奉行的人。
57
+ ./custom_character_voice/linghua/processed_58.wav|0|她……也是一个很有原则的人。
58
+ ./custom_character_voice/linghua/processed_59.wav|0|这些原则的坚持,甚至比九条小姐更执着。
59
+ ./custom_character_voice/linghua/processed_60.wav|0|不过,什么事应该被算在这些原则之内……我想,或许只有路也愿先生自己知道吧。
60
+ ./custom_character_voice/linghua/processed_61.wav|0|小幼稚孩子,最近有沒有給你添什麼麻煩呢?
61
+ ./custom_character_voice/linghua/processed_62.wav|0|如果看見他偷懶,可以直接告訴我。
62
+ ./custom_character_voice/linghua/processed_63.wav|0|理所當然的看法嗎?
63
+ ./custom_character_voice/linghua/processed_64.wav|0|不該由我等下屬隨意議論
64
+ ./custom_character_voice/linghua/processed_65.wav|0|哼,將軍大人他在追求永恆之路上,可能也很孤獨吧。
65
+ ./custom_character_voice/linghua/processed_66.wav|0|一刀,并且活了下来。该说是堪称伟业的经历了吧。
66
+ ./custom_character_voice/linghua/processed_67.wav|0|虽然对我来说,她是真正的神明
67
+ ./custom_character_voice/linghua/processed_68.wav|0|可以更改到期的命运
68
+ ./custom_character_voice/linghua/processed_69.wav|0|但是如果是和你起了冲突的话,我一定会站在你这一边的。
69
+ ./custom_character_voice/linghua/processed_70.wav|0|八重公司大人的合作向来很愉快
70
+ ./custom_character_voice/linghua/processed_71.wav|0|看,操辦節慶慶典非常勞神費力,營收多半也不好看。
71
+ ./custom_character_voice/linghua/processed_72.wav|0|八重公司大人操办的产业,真的既风雅又有收成。
72
+ ./custom_character_voice/linghua/processed_73.wav|0|作為神力家的家主,兄長平日需要出面諸多場合。
73
+ ./custom_character_voice/linghua/processed_74.wav|0|我雖盡力分擔兄長肩上所負擔的責任,卻也無法緩和他常年積壓在身的疲倦。
74
+ ./custom_character_voice/linghua/processed_75.wav|0|我也是当时为了妹妹着想,希望你能劝言,让兄长多多注意身体啊。
75
+ ./custom_character_voice/linghua/processed_76.wav|0|節慶慶典是聖奉行和巫女中的責任
76
+ ./custom_character_voice/linghua/processed_77.wav|0|作為煙火專家,也的確能讓氣氛熱烈起來。
77
+ ./custom_character_voice/linghua/processed_78.wav|0|合作多了,因而漸漸熟絡
78
+ ./custom_character_voice/linghua/processed_79.wav|0|治安和消防問題嗎?我們也會一併納入預先規劃的
79
+ ./custom_character_voice/linghua/processed_80.wav|0|這些原因而看不到櫻花,才會讓人們心中留下缺憾吧。
80
+ ./custom_character_voice/linghua/processed_81.wav|0|你的请求,对我来说很特别呢既然把你当作朋友,我也应坦诚以待
81
+ ./custom_character_voice/linghua/processed_82.wav|0|不过,事关神里家的秘密,还希望你能守口如瓶。
82
+ ./custom_character_voice/linghua/processed_83.wav|0|神力嘉因為沒能保護好國寶級別的刀功,遭受了不小的衝擊。
83
+ ./custom_character_voice/linghua/processed_84.wav|0|别人中阴谋算计我们折损了诸多臣下受到许多责罚
84
+ ./custom_character_voice/linghua/processed_85.wav|0|甚至因之早衰神力家在幕府中的地位也一落千丈
85
+ ./custom_character_voice/linghua/processed_86.wav|0|好在兄長繼任後力挽狂瀾
86
+ ./custom_character_voice/linghua/processed_87.wav|0|家門雖已復興,射風醒一夕也上下其心,但大事要事方面仍靠兄長定奪。
87
+ ./custom_character_voice/linghua/processed_88.wav|0|他们所传的断刀之术,也因星象、用途、旷植、炉火环境、人之性格、元素变化的不同而有所区分
88
+ ./custom_character_voice/linghua/processed_89.wav|0|是刀弓之间所说的雷电五川
89
+ ./custom_character_voice/linghua/processed_90.wav|0|藏明刀的刀工,也被算作是本領通神的神士相關人員,歸屬統籌文化、藝術、祭祀的射鳳形意派管理。
90
+ ./custom_character_voice/linghua/processed_91.wav|0|出現了刀工背叛的事情,自然就是神里家的獨辦不力了。
91
+ ./custom_character_voice/linghua/processed_92.wav|0|對我來說,母親是意義非凡的存在。
92
+ ./custom_character_voice/linghua/processed_93.wav|0|服装,优雅,无论遇到怎样的局面,都会露出沉浸的笑容,以从容不迫的态度,操持着审理家大大小小的事物。
93
+ ./custom_character_voice/linghua/processed_94.wav|0|感情是完美的化身也不為過
94
+ ./custom_character_voice/linghua/processed_95.wav|0|但自从她离世的那一刻起,我就深切地意识到,我已经不是那个可以躲在母亲身后的小灵花了。
95
+ ./custom_character_voice/linghua/processed_96.wav|0|原来要说的话,可能不太符合盗窃幕府射风行神力家的身份
96
+ ./custom_character_voice/linghua/processed_97.wav|0|不过,就我的判断,你应该能容许我小小的任性吧
97
+ ./custom_character_voice/linghua/processed_98.wav|0|稍微有点累了可以让我靠一���你的肩膀吗?
98
+ ./custom_character_voice/linghua/processed_99.wav|0|舅舅
99
+ ./custom_character_voice/linghua/processed_100.wav|0|我都很喜欢雅乐诗词棋艺与舞蹈你也感兴趣吗?
100
+ ./custom_character_voice/linghua/processed_102.wav|0|……是啊,只要生活在這個世界上,就難免遇到種種不如意的事情。
101
+ ./custom_character_voice/linghua/processed_103.wav|0|但如果是因為自己的事情,就讓周遭的人擔心的話……
102
+ ./custom_character_voice/linghua/processed_104.wav|0|果然,我還是不能說。
103
+ ./custom_character_voice/linghua/processed_105.wav|0|男帅,真的是一件很难的事情
104
+ ./custom_character_voice/linghua/processed_106.wav|0|我必须不断告诫自己是神力家的大小姐在无数双眼睛、无数人的期盼之下摆出完美无缺的姿态
105
+ ./custom_character_voice/linghua/processed_107.wav|0|这样的我,是否也该追求自己的愿望呢?
106
+ ./custom_character_voice/linghua/processed_108.wav|0|是否也該…讓你理解我的心意呢?
107
+ ./custom_character_voice/linghua/processed_109.wav|0|我对异国料理很有兴趣,虽然很少有尝试的机会。
108
+ ./custom_character_voice/linghua/processed_110.wav|0|如果是要局限在稻妻料理內的話,應該是茶泡飯吧。
109
+ ./custom_character_voice/linghua/processed_111.wav|0|不能給一般客人看見
110
+ ./custom_character_voice/linghua/processed_112.wav|0|我也是偷偷告訴你的
111
+ ./custom_character_voice/linghua/processed_113.wav|0|虽然不是不能吃,但我对动物脂肪或内脏…大概会有点…
112
+ ./custom_character_voice/linghua/processed_114.wav|0|请随我来,只要走一小段路,不会耽搁你太长时间的。
113
+ ./custom_character_voice/linghua/processed_115.wav|0|打听到你的生日之后,我就提前了一段时间开始筹备。
114
+ ./custom_character_voice/linghua/processed_116.wav|0|比起名贵的礼物我妄自猜测或许这样的礼物会更合我们的情意?
115
+ ./custom_character_voice/linghua/processed_117.wav|0|此次,就請讓我以善無為禮吧。
116
+ ./custom_character_voice/linghua/processed_118.wav|0|失禮了
117
+ ./custom_character_voice/linghua/processed_119.wav|0|感謝,與你切磋使我收益良多,相信在劍術上也能更進一步。
118
+ ./custom_character_voice/linghua/processed_120.wav|0|多亏你的点播
119
+ ./custom_character_voice/linghua/processed_121.wav|0|我對自己的能力也理解得更透徹了。
120
+ ./custom_character_voice/linghua/processed_122.wav|0|更加游刃有余了
121
+ ./custom_character_voice/linghua/processed_123.wav|0|收奉行事物之餘,甚至有空嘗試一些新的事情。
122
+ ./custom_character_voice/linghua/processed_124.wav|0|想要來試試自己學做的點心嗎?
123
+ ./custom_character_voice/linghua/processed_125.wav|0|心有所思,思事如盼。
124
+ ./custom_character_voice/linghua/processed_126.wav|0|塗料服侍世,留住難。
125
+ ./custom_character_voice/linghua/processed_127.wav|0|抱歉,明明是值得高兴的时候,我却想起了那么悲伤的时刻……
126
+ ./custom_character_voice/linghua/processed_128.wav|0|相處的時間過於暢緩竟然讓我害怕再次失去
127
+ ./custom_character_voice/linghua/processed_129.wav|0|失…失態了呀
128
+ ./custom_character_voice/linghua/processed_130.wav|0|比武吧失禮了
129
+ ./custom_character_voice/linghua/processed_132.wav|0|神里流 霜灭
130
+ ./custom_character_voice/linghua/processed_133.wav|0|這祕奇,也算得一種雅趣
131
+ ./custom_character_voice/linghua/processed_134.wav|0|今日运势不错,我会珍惜这一份幸运,不容小觑呢。
132
+ ./custom_character_voice/linghua/processed_135.wav|0|我的对手,该决断了
133
+ ./custom_character_voice/linghua/processed_136.wav|0|失态了我还有未尽之事让家族蒙羞了
134
+ ./custom_character_voice/linghua/processed_137.wav|0|的家伙…怎么会…
135
+ ./custom_character_voice/linghua/processed_138.wav|0|神里绫华
136
+ ./custom_character_voice/linghua/processed_140.wav|0|请赐教
137
+ ./custom_character_voice/linghua/processed_141.wav|0|請多關照
infer_onnx.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import onnxruntime
3
+ import numpy as np
4
+ import argparse
5
+
6
+ import commons
7
+ import utils
8
+ from text import text_to_sequence
9
+
10
+ from scipy.io.wavfile import write
11
+
12
+
13
+ def get_text(text, hps):
14
+ text_norm = text_to_sequence(text, hps.data.text_cleaners)
15
+ if hps.data.add_blank:
16
+ text_norm = commons.intersperse(text_norm, 0)
17
+ text_norm = torch.LongTensor(text_norm)
18
+ return text_norm
19
+
20
+
21
+ def main() -> None:
22
+ parser = argparse.ArgumentParser()
23
+ parser.add_argument("--model", required=True, help="Path to model (.onnx)")
24
+ parser.add_argument(
25
+ "--config-path", required=True, help="Path to model config (.json)"
26
+ )
27
+ parser.add_argument(
28
+ "--output-wav-path", required=True, help="Path to write WAV file"
29
+ )
30
+ parser.add_argument("--text", required=True, type=str, help="Text to synthesize")
31
+ args = parser.parse_args()
32
+
33
+ sess_options = onnxruntime.SessionOptions()
34
+ model = onnxruntime.InferenceSession(str(args.model), sess_options=sess_options)
35
+
36
+ hps = utils.get_hparams_from_file(args.config_path)
37
+
38
+ phoneme_ids = get_text(args.text, hps)
39
+ text = np.expand_dims(np.array(phoneme_ids, dtype=np.int64), 0)
40
+ text_lengths = np.array([text.shape[1]], dtype=np.int64)
41
+ scales = np.array([0.667, 1.0, 0.8], dtype=np.float32)
42
+ sid = None
43
+
44
+ audio = model.run(
45
+ None,
46
+ {
47
+ "input": text,
48
+ "input_lengths": text_lengths,
49
+ "scales": scales,
50
+ "sid": sid,
51
+ },
52
+ )[0].squeeze((0, 1))
53
+
54
+ write(data=audio, rate=hps.data.sampling_rate, filename=args.output_wav_path)
55
+
56
+
57
+ if __name__ == "__main__":
58
+ main()
inference.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## LJSpeech
2
+ import torch
3
+
4
+ import commons
5
+ import utils
6
+ from models import SynthesizerTrn
7
+ from text.symbols import symbols
8
+ from text import text_to_sequence
9
+
10
+ from scipy.io.wavfile import write
11
+
12
+
13
+ def get_text(text, hps):
14
+ text_norm = text_to_sequence(text, hps.data.text_cleaners)
15
+ if hps.data.add_blank:
16
+ text_norm = commons.intersperse(text_norm, 0)
17
+ text_norm = torch.LongTensor(text_norm)
18
+ return text_norm
19
+
20
+
21
+ CONFIG_PATH = "./configs/vits2_ljs_nosdp.json"
22
+ MODEL_PATH = "./logs/G_114000.pth"
23
+ TEXT = "VITS-2 is Awesome!"
24
+ OUTPUT_WAV_PATH = "sample_vits2.wav"
25
+
26
+ hps = utils.get_hparams_from_file(CONFIG_PATH)
27
+
28
+ if (
29
+ "use_mel_posterior_encoder" in hps.model.keys()
30
+ and hps.model.use_mel_posterior_encoder == True
31
+ ):
32
+ print("Using mel posterior encoder for VITS2")
33
+ posterior_channels = 80 # vits2
34
+ hps.data.use_mel_posterior_encoder = True
35
+ else:
36
+ print("Using lin posterior encoder for VITS1")
37
+ posterior_channels = hps.data.filter_length // 2 + 1
38
+ hps.data.use_mel_posterior_encoder = False
39
+
40
+ net_g = SynthesizerTrn(
41
+ len(symbols),
42
+ posterior_channels,
43
+ hps.train.segment_size // hps.data.hop_length,
44
+ **hps.model
45
+ ).cuda()
46
+ _ = net_g.eval()
47
+
48
+ _ = utils.load_checkpoint(MODEL_PATH, net_g, None)
49
+
50
+ stn_tst = get_text(TEXT, hps)
51
+ with torch.no_grad():
52
+ x_tst = stn_tst.cuda().unsqueeze(0)
53
+ x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).cuda()
54
+ audio = (
55
+ net_g.infer(
56
+ x_tst, x_tst_lengths, noise_scale=0.667, noise_scale_w=0.8, length_scale=1
57
+ )[0][0, 0]
58
+ .data.cpu()
59
+ .float()
60
+ .numpy()
61
+ )
62
+
63
+ write(data=audio, rate=hps.data.sampling_rate, filename=OUTPUT_WAV_PATH)
inference_ms.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## VCTK
2
+ import torch
3
+
4
+ import commons
5
+ import utils
6
+ from models import SynthesizerTrn
7
+ from text.symbols import symbols
8
+ from text import text_to_sequence
9
+
10
+ from scipy.io.wavfile import write
11
+
12
+
13
+ def get_text(text, hps):
14
+ text_norm = text_to_sequence(text, hps.data.text_cleaners)
15
+ if hps.data.add_blank:
16
+ text_norm = commons.intersperse(text_norm, 0)
17
+ text_norm = torch.LongTensor(text_norm)
18
+ return text_norm
19
+
20
+
21
+ CONFIG_PATH = "./configs/vits2_vctk_base.json"
22
+ MODEL_PATH = "/path/to/pretrained_vctk.pth"
23
+ TEXT = "VITS-2 is Awesome!"
24
+ SPK_ID = 4
25
+ OUTPUT_WAV_PATH = "sample_vits2_ms.wav"
26
+
27
+ hps = utils.get_hparams_from_file(CONFIG_PATH)
28
+
29
+ if (
30
+ "use_mel_posterior_encoder" in hps.model.keys()
31
+ and hps.model.use_mel_posterior_encoder == True
32
+ ):
33
+ print("Using mel posterior encoder for VITS2")
34
+ posterior_channels = 80 # vits2
35
+ hps.data.use_mel_posterior_encoder = True
36
+ else:
37
+ print("Using lin posterior encoder for VITS1")
38
+ posterior_channels = hps.data.filter_length // 2 + 1
39
+ hps.data.use_mel_posterior_encoder = False
40
+
41
+ net_g = SynthesizerTrn(
42
+ len(symbols),
43
+ posterior_channels,
44
+ hps.train.segment_size // hps.data.hop_length,
45
+ n_speakers=hps.data.n_speakers,
46
+ **hps.model
47
+ ).cuda()
48
+ _ = net_g.eval()
49
+
50
+ _ = utils.load_checkpoint(MODEL_PATH, net_g, None)
51
+
52
+ stn_tst = get_text(TEXT, hps)
53
+ with torch.no_grad():
54
+ x_tst = stn_tst.cuda().unsqueeze(0)
55
+ x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).cuda()
56
+ sid = torch.LongTensor([SPK_ID]).cuda()
57
+ audio = (
58
+ net_g.infer(
59
+ x_tst,
60
+ x_tst_lengths,
61
+ sid=sid,
62
+ noise_scale=0.667,
63
+ noise_scale_w=0.8,
64
+ length_scale=1,
65
+ )[0][0, 0]
66
+ .data.cpu()
67
+ .float()
68
+ .numpy()
69
+ )
70
+
71
+ write(data=audio, rate=hps.data.sampling_rate, filename=OUTPUT_WAV_PATH)
logs/pretrained_models/README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ Please put the pretrained models under this folder | 请将预训练模型放在此文件夹下
losses.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch.nn import functional as F
3
+
4
+ import commons
5
+
6
+
7
+ def feature_loss(fmap_r, fmap_g):
8
+ loss = 0
9
+ for dr, dg in zip(fmap_r, fmap_g):
10
+ for rl, gl in zip(dr, dg):
11
+ rl = rl.float().detach()
12
+ gl = gl.float()
13
+ loss += torch.mean(torch.abs(rl - gl))
14
+
15
+ return loss * 2
16
+
17
+
18
+ def discriminator_loss(disc_real_outputs, disc_generated_outputs):
19
+ loss = 0
20
+ r_losses = []
21
+ g_losses = []
22
+ for dr, dg in zip(disc_real_outputs, disc_generated_outputs):
23
+ dr = dr.float()
24
+ dg = dg.float()
25
+ r_loss = torch.mean((1 - dr) ** 2)
26
+ g_loss = torch.mean(dg**2)
27
+ loss += r_loss + g_loss
28
+ r_losses.append(r_loss.item())
29
+ g_losses.append(g_loss.item())
30
+
31
+ return loss, r_losses, g_losses
32
+
33
+
34
+ def generator_loss(disc_outputs):
35
+ loss = 0
36
+ gen_losses = []
37
+ for dg in disc_outputs:
38
+ dg = dg.float()
39
+ l = torch.mean((1 - dg) ** 2)
40
+ gen_losses.append(l)
41
+ loss += l
42
+
43
+ return loss, gen_losses
44
+
45
+
46
+ def kl_loss(z_p, logs_q, m_p, logs_p, z_mask):
47
+ """
48
+ z_p, logs_q: [b, h, t_t]
49
+ m_p, logs_p: [b, h, t_t]
50
+ """
51
+ z_p = z_p.float()
52
+ logs_q = logs_q.float()
53
+ m_p = m_p.float()
54
+ logs_p = logs_p.float()
55
+ z_mask = z_mask.float()
56
+
57
+ kl = logs_p - logs_q - 0.5
58
+ kl += 0.5 * ((z_p - m_p) ** 2) * torch.exp(-2.0 * logs_p)
59
+ kl = torch.sum(kl * z_mask)
60
+ l = kl / torch.sum(z_mask)
61
+ return l
mel_processing.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import os
3
+ from packaging import version
4
+ import random
5
+ import torch
6
+ from torch import nn
7
+ import torch.nn.functional as F
8
+ import torch.utils.data
9
+ import numpy as np
10
+ import librosa
11
+ import librosa.util as librosa_util
12
+ from librosa.util import normalize, pad_center, tiny
13
+ from scipy.signal import get_window
14
+ from scipy.io.wavfile import read
15
+ from librosa.filters import mel as librosa_mel_fn
16
+
17
+ MAX_WAV_VALUE = 32768.0
18
+
19
+
20
+ def dynamic_range_compression_torch(x, C=1, clip_val=1e-5):
21
+ """
22
+ PARAMS
23
+ ------
24
+ C: compression factor
25
+ """
26
+ return torch.log(torch.clamp(x, min=clip_val) * C)
27
+
28
+
29
+ def dynamic_range_decompression_torch(x, C=1):
30
+ """
31
+ PARAMS
32
+ ------
33
+ C: compression factor used to compress
34
+ """
35
+ return torch.exp(x) / C
36
+
37
+
38
+ def spectral_normalize_torch(magnitudes):
39
+ output = dynamic_range_compression_torch(magnitudes)
40
+ return output
41
+
42
+
43
+ def spectral_de_normalize_torch(magnitudes):
44
+ output = dynamic_range_decompression_torch(magnitudes)
45
+ return output
46
+
47
+
48
+ mel_basis = {}
49
+ hann_window = {}
50
+
51
+
52
+ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False):
53
+ if torch.min(y) < -1.0:
54
+ print("min value is ", torch.min(y))
55
+ if torch.max(y) > 1.0:
56
+ print("max value is ", torch.max(y))
57
+
58
+ global hann_window
59
+ dtype_device = str(y.dtype) + "_" + str(y.device)
60
+ wnsize_dtype_device = str(win_size) + "_" + dtype_device
61
+ if wnsize_dtype_device not in hann_window:
62
+ hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(
63
+ dtype=y.dtype, device=y.device
64
+ )
65
+
66
+ y = torch.nn.functional.pad(
67
+ y.unsqueeze(1),
68
+ (int((n_fft - hop_size) / 2), int((n_fft - hop_size) / 2)),
69
+ mode="reflect",
70
+ )
71
+ y = y.squeeze(1)
72
+
73
+ if version.parse(torch.__version__) >= version.parse("2"):
74
+ spec = torch.stft(
75
+ y,
76
+ n_fft,
77
+ hop_length=hop_size,
78
+ win_length=win_size,
79
+ window=hann_window[wnsize_dtype_device],
80
+ center=center,
81
+ pad_mode="reflect",
82
+ normalized=False,
83
+ onesided=True,
84
+ return_complex=False,
85
+ )
86
+ else:
87
+ spec = torch.stft(
88
+ y,
89
+ n_fft,
90
+ hop_length=hop_size,
91
+ win_length=win_size,
92
+ window=hann_window[wnsize_dtype_device],
93
+ center=center,
94
+ pad_mode="reflect",
95
+ normalized=False,
96
+ onesided=True,
97
+ )
98
+
99
+ spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
100
+ return spec
101
+
102
+
103
+ def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax):
104
+ global mel_basis
105
+ dtype_device = str(spec.dtype) + "_" + str(spec.device)
106
+ fmax_dtype_device = str(fmax) + "_" + dtype_device
107
+ if fmax_dtype_device not in mel_basis:
108
+ mel = librosa_mel_fn(
109
+ sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax
110
+ )
111
+ mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(
112
+ dtype=spec.dtype, device=spec.device
113
+ )
114
+ spec = torch.matmul(mel_basis[fmax_dtype_device], spec)
115
+ spec = spectral_normalize_torch(spec)
116
+ return spec
117
+
118
+
119
+ def mel_spectrogram_torch(
120
+ y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False
121
+ ):
122
+ if torch.min(y) < -1.0:
123
+ print("min value is ", torch.min(y))
124
+ if torch.max(y) > 1.0:
125
+ print("max value is ", torch.max(y))
126
+
127
+ global mel_basis, hann_window
128
+ dtype_device = str(y.dtype) + "_" + str(y.device)
129
+ fmax_dtype_device = str(fmax) + "_" + dtype_device
130
+ wnsize_dtype_device = str(win_size) + "_" + dtype_device
131
+ if fmax_dtype_device not in mel_basis:
132
+ mel = librosa_mel_fn(
133
+ sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax
134
+ )
135
+ mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(
136
+ dtype=y.dtype, device=y.device
137
+ )
138
+ if wnsize_dtype_device not in hann_window:
139
+ hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(
140
+ dtype=y.dtype, device=y.device
141
+ )
142
+
143
+ y = torch.nn.functional.pad(
144
+ y.unsqueeze(1),
145
+ (int((n_fft - hop_size) / 2), int((n_fft - hop_size) / 2)),
146
+ mode="reflect",
147
+ )
148
+ y = y.squeeze(1)
149
+
150
+ if version.parse(torch.__version__) >= version.parse("2"):
151
+ spec = torch.stft(
152
+ y,
153
+ n_fft,
154
+ hop_length=hop_size,
155
+ win_length=win_size,
156
+ window=hann_window[wnsize_dtype_device],
157
+ center=center,
158
+ pad_mode="reflect",
159
+ normalized=False,
160
+ onesided=True,
161
+ return_complex=False,
162
+ )
163
+ else:
164
+ spec = torch.stft(
165
+ y,
166
+ n_fft,
167
+ hop_length=hop_size,
168
+ win_length=win_size,
169
+ window=hann_window[wnsize_dtype_device],
170
+ center=center,
171
+ pad_mode="reflect",
172
+ normalized=False,
173
+ onesided=True,
174
+ )
175
+
176
+ spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
177
+
178
+ spec = torch.matmul(mel_basis[fmax_dtype_device], spec)
179
+ spec = spectral_normalize_torch(spec)
180
+
181
+ return spec
models.py ADDED
@@ -0,0 +1,1202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import math
3
+ import torch
4
+ from torch import nn
5
+ from torch.nn import functional as F
6
+
7
+ import commons
8
+ import modules
9
+ import attentions
10
+ import monotonic_align
11
+
12
+ from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
13
+ from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
14
+ from commons import init_weights, get_padding
15
+
16
+ AVAILABLE_FLOW_TYPES = [
17
+ "pre_conv",
18
+ "fft",
19
+ "mono_layer_inter_residual",
20
+ "mono_layer_post_residual",
21
+ ]
22
+
23
+
24
+ class StochasticDurationPredictor(nn.Module):
25
+ def __init__(
26
+ self,
27
+ in_channels,
28
+ filter_channels,
29
+ kernel_size,
30
+ p_dropout,
31
+ n_flows=4,
32
+ gin_channels=0,
33
+ ):
34
+ super().__init__()
35
+ filter_channels = in_channels # it needs to be removed from future version.
36
+ self.in_channels = in_channels
37
+ self.filter_channels = filter_channels
38
+ self.kernel_size = kernel_size
39
+ self.p_dropout = p_dropout
40
+ self.n_flows = n_flows
41
+ self.gin_channels = gin_channels
42
+
43
+ self.log_flow = modules.Log()
44
+ self.flows = nn.ModuleList()
45
+ self.flows.append(modules.ElementwiseAffine(2))
46
+ for i in range(n_flows):
47
+ self.flows.append(
48
+ modules.ConvFlow(2, filter_channels, kernel_size, n_layers=3)
49
+ )
50
+ self.flows.append(modules.Flip())
51
+
52
+ self.post_pre = nn.Conv1d(1, filter_channels, 1)
53
+ self.post_proj = nn.Conv1d(filter_channels, filter_channels, 1)
54
+ self.post_convs = modules.DDSConv(
55
+ filter_channels, kernel_size, n_layers=3, p_dropout=p_dropout
56
+ )
57
+ self.post_flows = nn.ModuleList()
58
+ self.post_flows.append(modules.ElementwiseAffine(2))
59
+ for i in range(4):
60
+ self.post_flows.append(
61
+ modules.ConvFlow(2, filter_channels, kernel_size, n_layers=3)
62
+ )
63
+ self.post_flows.append(modules.Flip())
64
+
65
+ self.pre = nn.Conv1d(in_channels, filter_channels, 1)
66
+ self.proj = nn.Conv1d(filter_channels, filter_channels, 1)
67
+ self.convs = modules.DDSConv(
68
+ filter_channels, kernel_size, n_layers=3, p_dropout=p_dropout
69
+ )
70
+ if gin_channels != 0:
71
+ self.cond = nn.Conv1d(gin_channels, filter_channels, 1)
72
+
73
+ def forward(self, x, x_mask, w=None, g=None, reverse=False, noise_scale=1.0):
74
+ x = torch.detach(x)
75
+ x = self.pre(x)
76
+ if g is not None:
77
+ g = torch.detach(g)
78
+ x = x + self.cond(g)
79
+ x = self.convs(x, x_mask)
80
+ x = self.proj(x) * x_mask
81
+
82
+ if not reverse:
83
+ flows = self.flows
84
+ assert w is not None
85
+
86
+ logdet_tot_q = 0
87
+ h_w = self.post_pre(w)
88
+ h_w = self.post_convs(h_w, x_mask)
89
+ h_w = self.post_proj(h_w) * x_mask
90
+ e_q = (
91
+ torch.randn(w.size(0), 2, w.size(2)).to(device=x.device, dtype=x.dtype)
92
+ * x_mask
93
+ )
94
+ z_q = e_q
95
+ for flow in self.post_flows:
96
+ z_q, logdet_q = flow(z_q, x_mask, g=(x + h_w))
97
+ logdet_tot_q += logdet_q
98
+ z_u, z1 = torch.split(z_q, [1, 1], 1)
99
+ u = torch.sigmoid(z_u) * x_mask
100
+ z0 = (w - u) * x_mask
101
+ logdet_tot_q += torch.sum(
102
+ (F.logsigmoid(z_u) + F.logsigmoid(-z_u)) * x_mask, [1, 2]
103
+ )
104
+ logq = (
105
+ torch.sum(-0.5 * (math.log(2 * math.pi) + (e_q**2)) * x_mask, [1, 2])
106
+ - logdet_tot_q
107
+ )
108
+
109
+ logdet_tot = 0
110
+ z0, logdet = self.log_flow(z0, x_mask)
111
+ logdet_tot += logdet
112
+ z = torch.cat([z0, z1], 1)
113
+ for flow in flows:
114
+ z, logdet = flow(z, x_mask, g=x, reverse=reverse)
115
+ logdet_tot = logdet_tot + logdet
116
+ nll = (
117
+ torch.sum(0.5 * (math.log(2 * math.pi) + (z**2)) * x_mask, [1, 2])
118
+ - logdet_tot
119
+ )
120
+ return nll + logq # [b]
121
+ else:
122
+ flows = list(reversed(self.flows))
123
+ flows = flows[:-2] + [flows[-1]] # remove a useless vflow
124
+ z = (
125
+ torch.randn(x.size(0), 2, x.size(2)).to(device=x.device, dtype=x.dtype)
126
+ * noise_scale
127
+ )
128
+ for flow in flows:
129
+ z = flow(z, x_mask, g=x, reverse=reverse)
130
+ z0, z1 = torch.split(z, [1, 1], 1)
131
+ logw = z0
132
+ return logw
133
+
134
+
135
+ class DurationPredictor(nn.Module):
136
+ def __init__(
137
+ self, in_channels, filter_channels, kernel_size, p_dropout, gin_channels=0
138
+ ):
139
+ super().__init__()
140
+
141
+ self.in_channels = in_channels
142
+ self.filter_channels = filter_channels
143
+ self.kernel_size = kernel_size
144
+ self.p_dropout = p_dropout
145
+ self.gin_channels = gin_channels
146
+
147
+ self.drop = nn.Dropout(p_dropout)
148
+ self.conv_1 = nn.Conv1d(
149
+ in_channels, filter_channels, kernel_size, padding=kernel_size // 2
150
+ )
151
+ self.norm_1 = modules.LayerNorm(filter_channels)
152
+ self.conv_2 = nn.Conv1d(
153
+ filter_channels, filter_channels, kernel_size, padding=kernel_size // 2
154
+ )
155
+ self.norm_2 = modules.LayerNorm(filter_channels)
156
+ self.proj = nn.Conv1d(filter_channels, 1, 1)
157
+
158
+ if gin_channels != 0:
159
+ self.cond = nn.Conv1d(gin_channels, in_channels, 1)
160
+
161
+ def forward(self, x, x_mask, g=None):
162
+ x = torch.detach(x)
163
+ if g is not None:
164
+ g = torch.detach(g)
165
+ x = x + self.cond(g)
166
+ x = self.conv_1(x * x_mask)
167
+ x = torch.relu(x)
168
+ x = self.norm_1(x)
169
+ x = self.drop(x)
170
+ x = self.conv_2(x * x_mask)
171
+ x = torch.relu(x)
172
+ x = self.norm_2(x)
173
+ x = self.drop(x)
174
+ x = self.proj(x * x_mask)
175
+ return x * x_mask
176
+
177
+
178
+ class DurationDiscriminator(nn.Module): # vits2
179
+ # TODO : not using "spk conditioning" for now according to the paper.
180
+ # Can be a better discriminator if we use it.
181
+ def __init__(
182
+ self, in_channels, filter_channels, kernel_size, p_dropout, gin_channels=0
183
+ ):
184
+ super().__init__()
185
+
186
+ self.in_channels = in_channels
187
+ self.filter_channels = filter_channels
188
+ self.kernel_size = kernel_size
189
+ self.p_dropout = p_dropout
190
+ self.gin_channels = gin_channels
191
+
192
+ self.drop = nn.Dropout(p_dropout)
193
+ self.conv_1 = nn.Conv1d(
194
+ in_channels, filter_channels, kernel_size, padding=kernel_size // 2
195
+ )
196
+ # self.norm_1 = modules.LayerNorm(filter_channels)
197
+ self.conv_2 = nn.Conv1d(
198
+ filter_channels, filter_channels, kernel_size, padding=kernel_size // 2
199
+ )
200
+ # self.norm_2 = modules.LayerNorm(filter_channels)
201
+ self.dur_proj = nn.Conv1d(1, filter_channels, 1)
202
+
203
+ self.pre_out_conv_1 = nn.Conv1d(
204
+ 2 * filter_channels, filter_channels, kernel_size, padding=kernel_size // 2
205
+ )
206
+ self.pre_out_norm_1 = modules.LayerNorm(filter_channels)
207
+ self.pre_out_conv_2 = nn.Conv1d(
208
+ filter_channels, filter_channels, kernel_size, padding=kernel_size // 2
209
+ )
210
+ self.pre_out_norm_2 = modules.LayerNorm(filter_channels)
211
+
212
+ # if gin_channels != 0:
213
+ # self.cond = nn.Conv1d(gin_channels, in_channels, 1)
214
+
215
+ self.output_layer = nn.Sequential(nn.Linear(filter_channels, 1), nn.Sigmoid())
216
+
217
+ def forward_probability(self, x, x_mask, dur, g=None):
218
+ dur = self.dur_proj(dur)
219
+ x = torch.cat([x, dur], dim=1)
220
+ x = self.pre_out_conv_1(x * x_mask)
221
+ # x = torch.relu(x)
222
+ # x = self.pre_out_norm_1(x)
223
+ # x = self.drop(x)
224
+ x = self.pre_out_conv_2(x * x_mask)
225
+ # x = torch.relu(x)
226
+ # x = self.pre_out_norm_2(x)
227
+ # x = self.drop(x)
228
+ x = x * x_mask
229
+ x = x.transpose(1, 2)
230
+ output_prob = self.output_layer(x)
231
+ return output_prob
232
+
233
+ def forward(self, x, x_mask, dur_r, dur_hat, g=None):
234
+ x = torch.detach(x)
235
+ # if g is not None:
236
+ # g = torch.detach(g)
237
+ # x = x + self.cond(g)
238
+ x = self.conv_1(x * x_mask)
239
+ # x = torch.relu(x)
240
+ # x = self.norm_1(x)
241
+ # x = self.drop(x)
242
+ x = self.conv_2(x * x_mask)
243
+ # x = torch.relu(x)
244
+ # x = self.norm_2(x)
245
+ # x = self.drop(x)
246
+
247
+ output_probs = []
248
+ for dur in [dur_r, dur_hat]:
249
+ output_prob = self.forward_probability(x, x_mask, dur, g)
250
+ output_probs.append(output_prob)
251
+
252
+ return output_probs
253
+
254
+
255
+ class TextEncoder(nn.Module):
256
+ def __init__(
257
+ self,
258
+ n_vocab,
259
+ out_channels,
260
+ hidden_channels,
261
+ filter_channels,
262
+ n_heads,
263
+ n_layers,
264
+ kernel_size,
265
+ p_dropout,
266
+ gin_channels=0,
267
+ ):
268
+ super().__init__()
269
+ self.n_vocab = n_vocab
270
+ self.out_channels = out_channels
271
+ self.hidden_channels = hidden_channels
272
+ self.filter_channels = filter_channels
273
+ self.n_heads = n_heads
274
+ self.n_layers = n_layers
275
+ self.kernel_size = kernel_size
276
+ self.p_dropout = p_dropout
277
+ self.gin_channels = gin_channels
278
+ self.emb = nn.Embedding(n_vocab, hidden_channels)
279
+ nn.init.normal_(self.emb.weight, 0.0, hidden_channels**-0.5)
280
+
281
+ self.encoder = attentions.Encoder(
282
+ hidden_channels,
283
+ filter_channels,
284
+ n_heads,
285
+ n_layers,
286
+ kernel_size,
287
+ p_dropout,
288
+ gin_channels=self.gin_channels,
289
+ )
290
+ self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
291
+
292
+ def forward(self, x, x_lengths, g=None):
293
+ x = self.emb(x) * math.sqrt(self.hidden_channels) # [b, t, h]
294
+ x = torch.transpose(x, 1, -1) # [b, h, t]
295
+ x_mask = torch.unsqueeze(commons.sequence_mask(x_lengths, x.size(2)), 1).to(
296
+ x.dtype
297
+ )
298
+
299
+ x = self.encoder(x * x_mask, x_mask, g=g)
300
+ stats = self.proj(x) * x_mask
301
+
302
+ m, logs = torch.split(stats, self.out_channels, dim=1)
303
+ return x, m, logs, x_mask
304
+
305
+
306
+ class ResidualCouplingTransformersLayer(nn.Module): # vits2
307
+ def __init__(
308
+ self,
309
+ channels,
310
+ hidden_channels,
311
+ kernel_size,
312
+ dilation_rate,
313
+ n_layers,
314
+ p_dropout=0,
315
+ gin_channels=0,
316
+ mean_only=False,
317
+ ):
318
+ assert channels % 2 == 0, "channels should be divisible by 2"
319
+ super().__init__()
320
+ self.channels = channels
321
+ self.hidden_channels = hidden_channels
322
+ self.kernel_size = kernel_size
323
+ self.dilation_rate = dilation_rate
324
+ self.n_layers = n_layers
325
+ self.half_channels = channels // 2
326
+ self.mean_only = mean_only
327
+ # vits2
328
+ self.pre_transformer = attentions.Encoder(
329
+ self.half_channels,
330
+ self.half_channels,
331
+ n_heads=2,
332
+ n_layers=2,
333
+ kernel_size=3,
334
+ p_dropout=0.1,
335
+ window_size=None,
336
+ )
337
+
338
+ self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1)
339
+ self.enc = modules.WN(
340
+ hidden_channels,
341
+ kernel_size,
342
+ dilation_rate,
343
+ n_layers,
344
+ p_dropout=p_dropout,
345
+ gin_channels=gin_channels,
346
+ )
347
+ # vits2
348
+ self.post_transformer = attentions.Encoder(
349
+ self.hidden_channels,
350
+ self.hidden_channels,
351
+ n_heads=2,
352
+ n_layers=2,
353
+ kernel_size=3,
354
+ p_dropout=0.1,
355
+ window_size=None,
356
+ )
357
+
358
+ self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1)
359
+ self.post.weight.data.zero_()
360
+ self.post.bias.data.zero_()
361
+
362
+ def forward(self, x, x_mask, g=None, reverse=False):
363
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
364
+ x0_ = self.pre_transformer(x0 * x_mask, x_mask) # vits2
365
+ x0_ = x0_ + x0 # vits2 residual connection
366
+ h = self.pre(x0_) * x_mask # changed from x0 to x0_ to retain x0 for the flow
367
+ h = self.enc(h, x_mask, g=g)
368
+
369
+ # vits2 - (experimental;uncomment the following 2 line to use)
370
+ # h_ = self.post_transformer(h, x_mask)
371
+ # h = h + h_ #vits2 residual connection
372
+
373
+ stats = self.post(h) * x_mask
374
+ if not self.mean_only:
375
+ m, logs = torch.split(stats, [self.half_channels] * 2, 1)
376
+ else:
377
+ m = stats
378
+ logs = torch.zeros_like(m)
379
+ if not reverse:
380
+ x1 = m + x1 * torch.exp(logs) * x_mask
381
+ x = torch.cat([x0, x1], 1)
382
+ logdet = torch.sum(logs, [1, 2])
383
+ return x, logdet
384
+ else:
385
+ x1 = (x1 - m) * torch.exp(-logs) * x_mask
386
+ x = torch.cat([x0, x1], 1)
387
+ return x
388
+
389
+
390
+ class FFTransformerCouplingLayer(nn.Module): # vits2
391
+ def __init__(
392
+ self,
393
+ channels,
394
+ hidden_channels,
395
+ kernel_size,
396
+ n_layers,
397
+ n_heads,
398
+ p_dropout=0,
399
+ filter_channels=768,
400
+ mean_only=False,
401
+ gin_channels=0,
402
+ ):
403
+ assert channels % 2 == 0, "channels should be divisible by 2"
404
+ super().__init__()
405
+ self.channels = channels
406
+ self.hidden_channels = hidden_channels
407
+ self.kernel_size = kernel_size
408
+ self.n_layers = n_layers
409
+ self.half_channels = channels // 2
410
+ self.mean_only = mean_only
411
+
412
+ self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1)
413
+ self.enc = attentions.FFT(
414
+ hidden_channels,
415
+ filter_channels,
416
+ n_heads,
417
+ n_layers,
418
+ kernel_size,
419
+ p_dropout,
420
+ isflow=True,
421
+ gin_channels=gin_channels,
422
+ )
423
+ self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1)
424
+ self.post.weight.data.zero_()
425
+ self.post.bias.data.zero_()
426
+
427
+ def forward(self, x, x_mask, g=None, reverse=False):
428
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
429
+ h = self.pre(x0) * x_mask
430
+ h_ = self.enc(h, x_mask, g=g)
431
+ h = h_ + h
432
+ stats = self.post(h) * x_mask
433
+ if not self.mean_only:
434
+ m, logs = torch.split(stats, [self.half_channels] * 2, 1)
435
+ else:
436
+ m = stats
437
+ logs = torch.zeros_like(m)
438
+
439
+ if not reverse:
440
+ x1 = m + x1 * torch.exp(logs) * x_mask
441
+ x = torch.cat([x0, x1], 1)
442
+ logdet = torch.sum(logs, [1, 2])
443
+ return x, logdet
444
+ else:
445
+ x1 = (x1 - m) * torch.exp(-logs) * x_mask
446
+ x = torch.cat([x0, x1], 1)
447
+ return x
448
+
449
+
450
+ class MonoTransformerFlowLayer(nn.Module): # vits2
451
+ def __init__(
452
+ self,
453
+ channels,
454
+ hidden_channels,
455
+ mean_only=False,
456
+ residual_connection=False,
457
+ # according to VITS-2 paper fig 1B set residual_connection=True
458
+ ):
459
+ assert channels % 2 == 0, "channels should be divisible by 2"
460
+ super().__init__()
461
+ self.channels = channels
462
+ self.hidden_channels = hidden_channels
463
+ self.half_channels = channels // 2
464
+ self.mean_only = mean_only
465
+ self.residual_connection = residual_connection
466
+ # vits2
467
+ self.pre_transformer = attentions.Encoder(
468
+ self.half_channels,
469
+ self.half_channels,
470
+ n_heads=2,
471
+ n_layers=2,
472
+ kernel_size=3,
473
+ p_dropout=0.1,
474
+ window_size=None,
475
+ )
476
+
477
+ self.post = nn.Conv1d(
478
+ self.half_channels, self.half_channels * (2 - mean_only), 1
479
+ )
480
+ self.post.weight.data.zero_()
481
+ self.post.bias.data.zero_()
482
+
483
+ def forward(self, x, x_mask, g=None, reverse=False):
484
+ if self.residual_connection:
485
+ if not reverse:
486
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
487
+ x0_ = self.pre_transformer(x0, x_mask) # vits2
488
+ stats = self.post(x0_) * x_mask
489
+ if not self.mean_only:
490
+ m, logs = torch.split(stats, [self.half_channels] * 2, 1)
491
+ else:
492
+ m = stats
493
+ logs = torch.zeros_like(m)
494
+ x1 = m + x1 * torch.exp(logs) * x_mask
495
+ x_ = torch.cat([x0, x1], 1)
496
+ x = x + x_
497
+ logdet = torch.sum(torch.log(torch.exp(logs) + 1), [1, 2])
498
+ logdet = logdet + torch.log(torch.tensor(2)) * (
499
+ x0.shape[1] * x0.shape[2]
500
+ )
501
+ return x, logdet
502
+ else:
503
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
504
+ x0 = x0 / 2
505
+ x0_ = x0 * x_mask
506
+ x0_ = self.pre_transformer(x0, x_mask) # vits2
507
+ stats = self.post(x0_) * x_mask
508
+ if not self.mean_only:
509
+ m, logs = torch.split(stats, [self.half_channels] * 2, 1)
510
+ else:
511
+ m = stats
512
+ logs = torch.zeros_like(m)
513
+ x1_ = ((x1 - m) / (1 + torch.exp(-logs))) * x_mask
514
+ x = torch.cat([x0, x1_], 1)
515
+ return x
516
+ else:
517
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
518
+ x0_ = self.pre_transformer(x0 * x_mask, x_mask) # vits2
519
+ h = x0_ + x0 # vits2
520
+ stats = self.post(h) * x_mask
521
+ if not self.mean_only:
522
+ m, logs = torch.split(stats, [self.half_channels] * 2, 1)
523
+ else:
524
+ m = stats
525
+ logs = torch.zeros_like(m)
526
+ if not reverse:
527
+ x1 = m + x1 * torch.exp(logs) * x_mask
528
+ x_ = torch.cat([x0, x1], 1)
529
+ logdet = torch.sum(logs, [1, 2])
530
+ return x, logdet
531
+ else:
532
+ x1 = (x1 - m) * torch.exp(-logs) * x_mask
533
+ x = torch.cat([x0, x1], 1)
534
+ return x
535
+
536
+
537
+ class ResidualCouplingTransformersBlock(nn.Module): # vits2
538
+ def __init__(
539
+ self,
540
+ channels,
541
+ hidden_channels,
542
+ kernel_size,
543
+ dilation_rate,
544
+ n_layers,
545
+ n_flows=4,
546
+ gin_channels=0,
547
+ use_transformer_flows=False,
548
+ transformer_flow_type="pre_conv",
549
+ ):
550
+ super().__init__()
551
+ self.channels = channels
552
+ self.hidden_channels = hidden_channels
553
+ self.kernel_size = kernel_size
554
+ self.dilation_rate = dilation_rate
555
+ self.n_layers = n_layers
556
+ self.n_flows = n_flows
557
+ self.gin_channels = gin_channels
558
+
559
+ self.flows = nn.ModuleList()
560
+ if use_transformer_flows:
561
+ if transformer_flow_type == "pre_conv":
562
+ for i in range(n_flows):
563
+ self.flows.append(
564
+ ResidualCouplingTransformersLayer(
565
+ channels,
566
+ hidden_channels,
567
+ kernel_size,
568
+ dilation_rate,
569
+ n_layers,
570
+ gin_channels=gin_channels,
571
+ mean_only=True,
572
+ )
573
+ )
574
+ self.flows.append(modules.Flip())
575
+ elif transformer_flow_type == "fft":
576
+ for i in range(n_flows):
577
+ self.flows.append(
578
+ FFTransformerCouplingLayer(
579
+ channels,
580
+ hidden_channels,
581
+ kernel_size,
582
+ dilation_rate,
583
+ n_layers,
584
+ gin_channels=gin_channels,
585
+ mean_only=True,
586
+ )
587
+ )
588
+ self.flows.append(modules.Flip())
589
+ elif transformer_flow_type == "mono_layer_inter_residual":
590
+ for i in range(n_flows):
591
+ self.flows.append(
592
+ modules.ResidualCouplingLayer(
593
+ channels,
594
+ hidden_channels,
595
+ kernel_size,
596
+ dilation_rate,
597
+ n_layers,
598
+ gin_channels=gin_channels,
599
+ mean_only=True,
600
+ )
601
+ )
602
+ self.flows.append(modules.Flip())
603
+ self.flows.append(
604
+ MonoTransformerFlowLayer(
605
+ channels, hidden_channels, mean_only=True
606
+ )
607
+ )
608
+ elif transformer_flow_type == "mono_layer_post_residual":
609
+ for i in range(n_flows):
610
+ self.flows.append(
611
+ modules.ResidualCouplingLayer(
612
+ channels,
613
+ hidden_channels,
614
+ kernel_size,
615
+ dilation_rate,
616
+ n_layers,
617
+ gin_channels=gin_channels,
618
+ mean_only=True,
619
+ )
620
+ )
621
+ self.flows.append(modules.Flip())
622
+ self.flows.append(
623
+ MonoTransformerFlowLayer(
624
+ channels,
625
+ hidden_channels,
626
+ mean_only=True,
627
+ residual_connection=True,
628
+ )
629
+ )
630
+ else:
631
+ for i in range(n_flows):
632
+ self.flows.append(
633
+ modules.ResidualCouplingLayer(
634
+ channels,
635
+ hidden_channels,
636
+ kernel_size,
637
+ dilation_rate,
638
+ n_layers,
639
+ gin_channels=gin_channels,
640
+ mean_only=True,
641
+ )
642
+ )
643
+ self.flows.append(modules.Flip())
644
+
645
+ def forward(self, x, x_mask, g=None, reverse=False):
646
+ if not reverse:
647
+ for flow in self.flows:
648
+ x, _ = flow(x, x_mask, g=g, reverse=reverse)
649
+ else:
650
+ for flow in reversed(self.flows):
651
+ x = flow(x, x_mask, g=g, reverse=reverse)
652
+ return x
653
+
654
+
655
+ class ResidualCouplingBlock(nn.Module):
656
+ def __init__(
657
+ self,
658
+ channels,
659
+ hidden_channels,
660
+ kernel_size,
661
+ dilation_rate,
662
+ n_layers,
663
+ n_flows=4,
664
+ gin_channels=0,
665
+ ):
666
+ super().__init__()
667
+ self.channels = channels
668
+ self.hidden_channels = hidden_channels
669
+ self.kernel_size = kernel_size
670
+ self.dilation_rate = dilation_rate
671
+ self.n_layers = n_layers
672
+ self.n_flows = n_flows
673
+ self.gin_channels = gin_channels
674
+
675
+ self.flows = nn.ModuleList()
676
+ for i in range(n_flows):
677
+ self.flows.append(
678
+ modules.ResidualCouplingLayer(
679
+ channels,
680
+ hidden_channels,
681
+ kernel_size,
682
+ dilation_rate,
683
+ n_layers,
684
+ gin_channels=gin_channels,
685
+ mean_only=True,
686
+ )
687
+ )
688
+ self.flows.append(modules.Flip())
689
+
690
+ def forward(self, x, x_mask, g=None, reverse=False):
691
+ if not reverse:
692
+ for flow in self.flows:
693
+ x, _ = flow(x, x_mask, g=g, reverse=reverse)
694
+ else:
695
+ for flow in reversed(self.flows):
696
+ x = flow(x, x_mask, g=g, reverse=reverse)
697
+ return x
698
+
699
+
700
+ class PosteriorEncoder(nn.Module):
701
+ def __init__(
702
+ self,
703
+ in_channels,
704
+ out_channels,
705
+ hidden_channels,
706
+ kernel_size,
707
+ dilation_rate,
708
+ n_layers,
709
+ gin_channels=0,
710
+ ):
711
+ super().__init__()
712
+ self.in_channels = in_channels
713
+ self.out_channels = out_channels
714
+ self.hidden_channels = hidden_channels
715
+ self.kernel_size = kernel_size
716
+ self.dilation_rate = dilation_rate
717
+ self.n_layers = n_layers
718
+ self.gin_channels = gin_channels
719
+
720
+ self.pre = nn.Conv1d(in_channels, hidden_channels, 1)
721
+ self.enc = modules.WN(
722
+ hidden_channels,
723
+ kernel_size,
724
+ dilation_rate,
725
+ n_layers,
726
+ gin_channels=gin_channels,
727
+ )
728
+ self.proj = nn.Conv1d(hidden_channels, out_channels * 2, 1)
729
+
730
+ def forward(self, x, x_lengths, g=None):
731
+ x_mask = torch.unsqueeze(commons.sequence_mask(x_lengths, x.size(2)), 1).to(
732
+ x.dtype
733
+ )
734
+ x = self.pre(x) * x_mask
735
+ x = self.enc(x, x_mask, g=g)
736
+ stats = self.proj(x) * x_mask
737
+ m, logs = torch.split(stats, self.out_channels, dim=1)
738
+ z = (m + torch.randn_like(m) * torch.exp(logs)) * x_mask
739
+ return z, m, logs, x_mask
740
+
741
+
742
+ class Generator(torch.nn.Module):
743
+ def __init__(
744
+ self,
745
+ initial_channel,
746
+ resblock,
747
+ resblock_kernel_sizes,
748
+ resblock_dilation_sizes,
749
+ upsample_rates,
750
+ upsample_initial_channel,
751
+ upsample_kernel_sizes,
752
+ gin_channels=0,
753
+ ):
754
+ super(Generator, self).__init__()
755
+ self.num_kernels = len(resblock_kernel_sizes)
756
+ self.num_upsamples = len(upsample_rates)
757
+ self.conv_pre = Conv1d(
758
+ initial_channel, upsample_initial_channel, 7, 1, padding=3
759
+ )
760
+ resblock = modules.ResBlock1 if resblock == "1" else modules.ResBlock2
761
+
762
+ self.ups = nn.ModuleList()
763
+ for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)):
764
+ self.ups.append(
765
+ weight_norm(
766
+ ConvTranspose1d(
767
+ upsample_initial_channel // (2**i),
768
+ upsample_initial_channel // (2 ** (i + 1)),
769
+ k,
770
+ u,
771
+ padding=(k - u) // 2,
772
+ )
773
+ )
774
+ )
775
+
776
+ self.resblocks = nn.ModuleList()
777
+ for i in range(len(self.ups)):
778
+ ch = upsample_initial_channel // (2 ** (i + 1))
779
+ for j, (k, d) in enumerate(
780
+ zip(resblock_kernel_sizes, resblock_dilation_sizes)
781
+ ):
782
+ self.resblocks.append(resblock(ch, k, d))
783
+
784
+ self.conv_post = Conv1d(ch, 1, 7, 1, padding=3, bias=False)
785
+ self.ups.apply(init_weights)
786
+
787
+ if gin_channels != 0:
788
+ self.cond = nn.Conv1d(gin_channels, upsample_initial_channel, 1)
789
+
790
+ def forward(self, x, g=None):
791
+ x = self.conv_pre(x)
792
+ if g is not None:
793
+ x = x + self.cond(g)
794
+
795
+ for i in range(self.num_upsamples):
796
+ x = F.leaky_relu(x, modules.LRELU_SLOPE)
797
+ x = self.ups[i](x)
798
+ xs = None
799
+ for j in range(self.num_kernels):
800
+ if xs is None:
801
+ xs = self.resblocks[i * self.num_kernels + j](x)
802
+ else:
803
+ xs += self.resblocks[i * self.num_kernels + j](x)
804
+ x = xs / self.num_kernels
805
+ x = F.leaky_relu(x)
806
+ x = self.conv_post(x)
807
+ x = torch.tanh(x)
808
+
809
+ return x
810
+
811
+ def remove_weight_norm(self):
812
+ print("Removing weight norm...")
813
+ for l in self.ups:
814
+ remove_weight_norm(l)
815
+ for l in self.resblocks:
816
+ l.remove_weight_norm()
817
+
818
+
819
+ class DiscriminatorP(torch.nn.Module):
820
+ def __init__(self, period, kernel_size=5, stride=3, use_spectral_norm=False):
821
+ super(DiscriminatorP, self).__init__()
822
+ self.period = period
823
+ self.use_spectral_norm = use_spectral_norm
824
+ norm_f = weight_norm if use_spectral_norm == False else spectral_norm
825
+ self.convs = nn.ModuleList(
826
+ [
827
+ norm_f(
828
+ Conv2d(
829
+ 1,
830
+ 32,
831
+ (kernel_size, 1),
832
+ (stride, 1),
833
+ padding=(get_padding(kernel_size, 1), 0),
834
+ )
835
+ ),
836
+ norm_f(
837
+ Conv2d(
838
+ 32,
839
+ 128,
840
+ (kernel_size, 1),
841
+ (stride, 1),
842
+ padding=(get_padding(kernel_size, 1), 0),
843
+ )
844
+ ),
845
+ norm_f(
846
+ Conv2d(
847
+ 128,
848
+ 512,
849
+ (kernel_size, 1),
850
+ (stride, 1),
851
+ padding=(get_padding(kernel_size, 1), 0),
852
+ )
853
+ ),
854
+ norm_f(
855
+ Conv2d(
856
+ 512,
857
+ 1024,
858
+ (kernel_size, 1),
859
+ (stride, 1),
860
+ padding=(get_padding(kernel_size, 1), 0),
861
+ )
862
+ ),
863
+ norm_f(
864
+ Conv2d(
865
+ 1024,
866
+ 1024,
867
+ (kernel_size, 1),
868
+ 1,
869
+ padding=(get_padding(kernel_size, 1), 0),
870
+ )
871
+ ),
872
+ ]
873
+ )
874
+ self.conv_post = norm_f(Conv2d(1024, 1, (3, 1), 1, padding=(1, 0)))
875
+
876
+ def forward(self, x):
877
+ fmap = []
878
+
879
+ # 1d to 2d
880
+ b, c, t = x.shape
881
+ if t % self.period != 0: # pad first
882
+ n_pad = self.period - (t % self.period)
883
+ x = F.pad(x, (0, n_pad), "reflect")
884
+ t = t + n_pad
885
+ x = x.view(b, c, t // self.period, self.period)
886
+
887
+ for l in self.convs:
888
+ x = l(x)
889
+ x = F.leaky_relu(x, modules.LRELU_SLOPE)
890
+ fmap.append(x)
891
+ x = self.conv_post(x)
892
+ fmap.append(x)
893
+ x = torch.flatten(x, 1, -1)
894
+
895
+ return x, fmap
896
+
897
+
898
+ class DiscriminatorS(torch.nn.Module):
899
+ def __init__(self, use_spectral_norm=False):
900
+ super(DiscriminatorS, self).__init__()
901
+ norm_f = weight_norm if use_spectral_norm == False else spectral_norm
902
+ self.convs = nn.ModuleList(
903
+ [
904
+ norm_f(Conv1d(1, 16, 15, 1, padding=7)),
905
+ norm_f(Conv1d(16, 64, 41, 4, groups=4, padding=20)),
906
+ norm_f(Conv1d(64, 256, 41, 4, groups=16, padding=20)),
907
+ norm_f(Conv1d(256, 1024, 41, 4, groups=64, padding=20)),
908
+ norm_f(Conv1d(1024, 1024, 41, 4, groups=256, padding=20)),
909
+ norm_f(Conv1d(1024, 1024, 5, 1, padding=2)),
910
+ ]
911
+ )
912
+ self.conv_post = norm_f(Conv1d(1024, 1, 3, 1, padding=1))
913
+
914
+ def forward(self, x):
915
+ fmap = []
916
+
917
+ for l in self.convs:
918
+ x = l(x)
919
+ x = F.leaky_relu(x, modules.LRELU_SLOPE)
920
+ fmap.append(x)
921
+ x = self.conv_post(x)
922
+ fmap.append(x)
923
+ x = torch.flatten(x, 1, -1)
924
+
925
+ return x, fmap
926
+
927
+
928
+ class MultiPeriodDiscriminator(torch.nn.Module):
929
+ def __init__(self, use_spectral_norm=False):
930
+ super(MultiPeriodDiscriminator, self).__init__()
931
+ periods = [2, 3, 5, 7, 11]
932
+
933
+ discs = [DiscriminatorS(use_spectral_norm=use_spectral_norm)]
934
+ discs = discs + [
935
+ DiscriminatorP(i, use_spectral_norm=use_spectral_norm) for i in periods
936
+ ]
937
+ self.discriminators = nn.ModuleList(discs)
938
+
939
+ def forward(self, y, y_hat):
940
+ y_d_rs = []
941
+ y_d_gs = []
942
+ fmap_rs = []
943
+ fmap_gs = []
944
+ for i, d in enumerate(self.discriminators):
945
+ y_d_r, fmap_r = d(y)
946
+ y_d_g, fmap_g = d(y_hat)
947
+ y_d_rs.append(y_d_r)
948
+ y_d_gs.append(y_d_g)
949
+ fmap_rs.append(fmap_r)
950
+ fmap_gs.append(fmap_g)
951
+
952
+ return y_d_rs, y_d_gs, fmap_rs, fmap_gs
953
+
954
+
955
+ class SynthesizerTrn(nn.Module):
956
+ """
957
+ Synthesizer for Training
958
+ """
959
+
960
+ def __init__(
961
+ self,
962
+ n_vocab,
963
+ spec_channels,
964
+ segment_size,
965
+ inter_channels,
966
+ hidden_channels,
967
+ filter_channels,
968
+ n_heads,
969
+ n_layers,
970
+ kernel_size,
971
+ p_dropout,
972
+ resblock,
973
+ resblock_kernel_sizes,
974
+ resblock_dilation_sizes,
975
+ upsample_rates,
976
+ upsample_initial_channel,
977
+ upsample_kernel_sizes,
978
+ n_speakers=0,
979
+ gin_channels=0,
980
+ use_sdp=True,
981
+ **kwargs,
982
+ ):
983
+ super().__init__()
984
+ self.n_vocab = n_vocab
985
+ self.spec_channels = spec_channels
986
+ self.inter_channels = inter_channels
987
+ self.hidden_channels = hidden_channels
988
+ self.filter_channels = filter_channels
989
+ self.n_heads = n_heads
990
+ self.n_layers = n_layers
991
+ self.kernel_size = kernel_size
992
+ self.p_dropout = p_dropout
993
+ self.resblock = resblock
994
+ self.resblock_kernel_sizes = resblock_kernel_sizes
995
+ self.resblock_dilation_sizes = resblock_dilation_sizes
996
+ self.upsample_rates = upsample_rates
997
+ self.upsample_initial_channel = upsample_initial_channel
998
+ self.upsample_kernel_sizes = upsample_kernel_sizes
999
+ self.segment_size = segment_size
1000
+ self.n_speakers = n_speakers
1001
+ self.gin_channels = gin_channels
1002
+ self.use_spk_conditioned_encoder = kwargs.get(
1003
+ "use_spk_conditioned_encoder", False
1004
+ )
1005
+ self.use_transformer_flows = kwargs.get("use_transformer_flows", False)
1006
+ self.transformer_flow_type = kwargs.get(
1007
+ "transformer_flow_type", "mono_layer_post_residual"
1008
+ )
1009
+ if self.use_transformer_flows:
1010
+ assert (
1011
+ self.transformer_flow_type in AVAILABLE_FLOW_TYPES
1012
+ ), f"transformer_flow_type must be one of {AVAILABLE_FLOW_TYPES}"
1013
+ self.use_sdp = use_sdp
1014
+ # self.use_duration_discriminator = kwargs.get("use_duration_discriminator", False)
1015
+ self.use_noise_scaled_mas = kwargs.get("use_noise_scaled_mas", False)
1016
+ self.mas_noise_scale_initial = kwargs.get("mas_noise_scale_initial", 0.01)
1017
+ self.noise_scale_delta = kwargs.get("noise_scale_delta", 2e-6)
1018
+
1019
+ self.current_mas_noise_scale = self.mas_noise_scale_initial
1020
+ if self.use_spk_conditioned_encoder and gin_channels > 0:
1021
+ self.enc_gin_channels = gin_channels
1022
+ else:
1023
+ self.enc_gin_channels = 0
1024
+ self.enc_p = TextEncoder(
1025
+ n_vocab,
1026
+ inter_channels,
1027
+ hidden_channels,
1028
+ filter_channels,
1029
+ n_heads,
1030
+ n_layers,
1031
+ kernel_size,
1032
+ p_dropout,
1033
+ gin_channels=self.enc_gin_channels,
1034
+ )
1035
+
1036
+ self.dec = Generator(
1037
+ inter_channels,
1038
+ resblock,
1039
+ resblock_kernel_sizes,
1040
+ resblock_dilation_sizes,
1041
+ upsample_rates,
1042
+ upsample_initial_channel,
1043
+ upsample_kernel_sizes,
1044
+ gin_channels=gin_channels,
1045
+ )
1046
+ self.enc_q = PosteriorEncoder(
1047
+ spec_channels,
1048
+ inter_channels,
1049
+ hidden_channels,
1050
+ 5,
1051
+ 1,
1052
+ 16,
1053
+ gin_channels=gin_channels,
1054
+ )
1055
+ # self.flow = ResidualCouplingBlock(inter_channels, hidden_channels, 5, 1, 4, gin_channels=gin_channels)
1056
+ self.flow = ResidualCouplingTransformersBlock(
1057
+ inter_channels,
1058
+ hidden_channels,
1059
+ 5,
1060
+ 1,
1061
+ 4,
1062
+ gin_channels=gin_channels,
1063
+ use_transformer_flows=self.use_transformer_flows,
1064
+ transformer_flow_type=self.transformer_flow_type,
1065
+ )
1066
+
1067
+ if use_sdp:
1068
+ self.dp = StochasticDurationPredictor(
1069
+ hidden_channels, 192, 3, 0.5, 4, gin_channels=gin_channels
1070
+ )
1071
+ else:
1072
+ self.dp = DurationPredictor(
1073
+ hidden_channels, 256, 3, 0.5, gin_channels=gin_channels
1074
+ )
1075
+
1076
+ if n_speakers > 1:
1077
+ self.emb_g = nn.Embedding(n_speakers, gin_channels)
1078
+
1079
+ def forward(self, x, x_lengths, y, y_lengths, sid=None):
1080
+ if self.n_speakers > 0:
1081
+ g = self.emb_g(sid).unsqueeze(-1) # [b, h, 1]
1082
+ else:
1083
+ g = None
1084
+
1085
+ x, m_p, logs_p, x_mask = self.enc_p(x, x_lengths, g=g)
1086
+ z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g)
1087
+ z_p = self.flow(z, y_mask, g=g)
1088
+
1089
+ with torch.no_grad():
1090
+ # negative cross-entropy
1091
+ s_p_sq_r = torch.exp(-2 * logs_p) # [b, d, t]
1092
+ neg_cent1 = torch.sum(
1093
+ -0.5 * math.log(2 * math.pi) - logs_p, [1], keepdim=True
1094
+ ) # [b, 1, t_s]
1095
+ neg_cent2 = torch.matmul(
1096
+ -0.5 * (z_p**2).transpose(1, 2), s_p_sq_r
1097
+ ) # [b, t_t, d] x [b, d, t_s] = [b, t_t, t_s]
1098
+ neg_cent3 = torch.matmul(
1099
+ z_p.transpose(1, 2), (m_p * s_p_sq_r)
1100
+ ) # [b, t_t, d] x [b, d, t_s] = [b, t_t, t_s]
1101
+ neg_cent4 = torch.sum(
1102
+ -0.5 * (m_p**2) * s_p_sq_r, [1], keepdim=True
1103
+ ) # [b, 1, t_s]
1104
+ neg_cent = neg_cent1 + neg_cent2 + neg_cent3 + neg_cent4
1105
+
1106
+ if self.use_noise_scaled_mas:
1107
+ epsilon = (
1108
+ torch.std(neg_cent)
1109
+ * torch.randn_like(neg_cent)
1110
+ * self.current_mas_noise_scale
1111
+ )
1112
+ neg_cent = neg_cent + epsilon
1113
+
1114
+ attn_mask = torch.unsqueeze(x_mask, 2) * torch.unsqueeze(y_mask, -1)
1115
+ attn = (
1116
+ monotonic_align.maximum_path(neg_cent, attn_mask.squeeze(1))
1117
+ .unsqueeze(1)
1118
+ .detach()
1119
+ )
1120
+
1121
+ w = attn.sum(2)
1122
+ if self.use_sdp:
1123
+ l_length = self.dp(x, x_mask, w, g=g)
1124
+ l_length = l_length / torch.sum(x_mask)
1125
+ logw = self.dp(x, x_mask, g=g, reverse=True, noise_scale=1.0)
1126
+ logw_ = torch.log(w + 1e-6) * x_mask
1127
+ else:
1128
+ logw_ = torch.log(w + 1e-6) * x_mask
1129
+ logw = self.dp(x, x_mask, g=g)
1130
+ l_length = torch.sum((logw - logw_) ** 2, [1, 2]) / torch.sum(
1131
+ x_mask
1132
+ ) # for averaging
1133
+
1134
+ # expand prior
1135
+ m_p = torch.matmul(attn.squeeze(1), m_p.transpose(1, 2)).transpose(1, 2)
1136
+ logs_p = torch.matmul(attn.squeeze(1), logs_p.transpose(1, 2)).transpose(1, 2)
1137
+
1138
+ z_slice, ids_slice = commons.rand_slice_segments(
1139
+ z, y_lengths, self.segment_size
1140
+ )
1141
+ o = self.dec(z_slice, g=g)
1142
+ return (
1143
+ o,
1144
+ l_length,
1145
+ attn,
1146
+ ids_slice,
1147
+ x_mask,
1148
+ y_mask,
1149
+ (z, z_p, m_p, logs_p, m_q, logs_q),
1150
+ (x, logw, logw_),
1151
+ )
1152
+
1153
+ def infer(
1154
+ self,
1155
+ x,
1156
+ x_lengths,
1157
+ sid=None,
1158
+ noise_scale=1,
1159
+ length_scale=1,
1160
+ noise_scale_w=1.0,
1161
+ max_len=None,
1162
+ ):
1163
+ if self.n_speakers > 0:
1164
+ g = self.emb_g(sid).unsqueeze(-1) # [b, h, 1]
1165
+ else:
1166
+ g = None
1167
+ x, m_p, logs_p, x_mask = self.enc_p(x, x_lengths, g=g)
1168
+ if self.use_sdp:
1169
+ logw = self.dp(x, x_mask, g=g, reverse=True, noise_scale=noise_scale_w)
1170
+ else:
1171
+ logw = self.dp(x, x_mask, g=g)
1172
+ w = torch.exp(logw) * x_mask * length_scale
1173
+ w_ceil = torch.ceil(w)
1174
+ y_lengths = torch.clamp_min(torch.sum(w_ceil, [1, 2]), 1).long()
1175
+ y_mask = torch.unsqueeze(commons.sequence_mask(y_lengths, None), 1).to(
1176
+ x_mask.dtype
1177
+ )
1178
+ attn_mask = torch.unsqueeze(x_mask, 2) * torch.unsqueeze(y_mask, -1)
1179
+ attn = commons.generate_path(w_ceil, attn_mask)
1180
+
1181
+ m_p = torch.matmul(attn.squeeze(1), m_p.transpose(1, 2)).transpose(
1182
+ 1, 2
1183
+ ) # [b, t', t], [b, t, d] -> [b, d, t']
1184
+ logs_p = torch.matmul(attn.squeeze(1), logs_p.transpose(1, 2)).transpose(
1185
+ 1, 2
1186
+ ) # [b, t', t], [b, t, d] -> [b, d, t']
1187
+
1188
+ z_p = m_p + torch.randn_like(m_p) * torch.exp(logs_p) * noise_scale
1189
+ z = self.flow(z_p, y_mask, g=g, reverse=True)
1190
+ o = self.dec((z * y_mask)[:, :, :max_len], g=g)
1191
+ return o, attn, y_mask, (z, z_p, m_p, logs_p)
1192
+
1193
+ ## currently vits-2 is not capable of voice conversion
1194
+ # def voice_conversion(self, y, y_lengths, sid_src, sid_tgt):
1195
+ # assert self.n_speakers > 0, "n_speakers have to be larger than 0."
1196
+ # g_src = self.emb_g(sid_src).unsqueeze(-1)
1197
+ # g_tgt = self.emb_g(sid_tgt).unsqueeze(-1)
1198
+ # z, m_q, logs_q, y_mask = self.enc_q(y, y_lengths, g=g_src)
1199
+ # z_p = self.flow(z, y_mask, g=g_src)
1200
+ # z_hat = self.flow(z_p, y_mask, g=g_tgt, reverse=True)
1201
+ # o_hat = self.dec(z_hat * y_mask, g=g_tgt)
1202
+ # return o_hat, y_mask, (z, z_p, z_hat)
modules.py ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import math
3
+ import numpy as np
4
+ import scipy
5
+ import torch
6
+ from torch import nn
7
+ from torch.nn import functional as F
8
+
9
+ from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
10
+ from torch.nn.utils import weight_norm, remove_weight_norm
11
+
12
+ import commons
13
+ from commons import init_weights, get_padding
14
+ from transforms import piecewise_rational_quadratic_transform
15
+
16
+
17
+ LRELU_SLOPE = 0.1
18
+
19
+
20
+ class LayerNorm(nn.Module):
21
+ def __init__(self, channels, eps=1e-5):
22
+ super().__init__()
23
+ self.channels = channels
24
+ self.eps = eps
25
+
26
+ self.gamma = nn.Parameter(torch.ones(channels))
27
+ self.beta = nn.Parameter(torch.zeros(channels))
28
+
29
+ def forward(self, x):
30
+ x = x.transpose(1, -1)
31
+ x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps)
32
+ return x.transpose(1, -1)
33
+
34
+
35
+ class ConvReluNorm(nn.Module):
36
+ def __init__(
37
+ self,
38
+ in_channels,
39
+ hidden_channels,
40
+ out_channels,
41
+ kernel_size,
42
+ n_layers,
43
+ p_dropout,
44
+ ):
45
+ super().__init__()
46
+ self.in_channels = in_channels
47
+ self.hidden_channels = hidden_channels
48
+ self.out_channels = out_channels
49
+ self.kernel_size = kernel_size
50
+ self.n_layers = n_layers
51
+ self.p_dropout = p_dropout
52
+ assert n_layers > 1, "Number of layers should be larger than 0."
53
+
54
+ self.conv_layers = nn.ModuleList()
55
+ self.norm_layers = nn.ModuleList()
56
+ self.conv_layers.append(
57
+ nn.Conv1d(
58
+ in_channels, hidden_channels, kernel_size, padding=kernel_size // 2
59
+ )
60
+ )
61
+ self.norm_layers.append(LayerNorm(hidden_channels))
62
+ self.relu_drop = nn.Sequential(nn.ReLU(), nn.Dropout(p_dropout))
63
+ for _ in range(n_layers - 1):
64
+ self.conv_layers.append(
65
+ nn.Conv1d(
66
+ hidden_channels,
67
+ hidden_channels,
68
+ kernel_size,
69
+ padding=kernel_size // 2,
70
+ )
71
+ )
72
+ self.norm_layers.append(LayerNorm(hidden_channels))
73
+ self.proj = nn.Conv1d(hidden_channels, out_channels, 1)
74
+ self.proj.weight.data.zero_()
75
+ self.proj.bias.data.zero_()
76
+
77
+ def forward(self, x, x_mask):
78
+ x_org = x
79
+ for i in range(self.n_layers):
80
+ x = self.conv_layers[i](x * x_mask)
81
+ x = self.norm_layers[i](x)
82
+ x = self.relu_drop(x)
83
+ x = x_org + self.proj(x)
84
+ return x * x_mask
85
+
86
+
87
+ class DDSConv(nn.Module):
88
+ """
89
+ Dialted and Depth-Separable Convolution
90
+ """
91
+
92
+ def __init__(self, channels, kernel_size, n_layers, p_dropout=0.0):
93
+ super().__init__()
94
+ self.channels = channels
95
+ self.kernel_size = kernel_size
96
+ self.n_layers = n_layers
97
+ self.p_dropout = p_dropout
98
+
99
+ self.drop = nn.Dropout(p_dropout)
100
+ self.convs_sep = nn.ModuleList()
101
+ self.convs_1x1 = nn.ModuleList()
102
+ self.norms_1 = nn.ModuleList()
103
+ self.norms_2 = nn.ModuleList()
104
+ for i in range(n_layers):
105
+ dilation = kernel_size**i
106
+ padding = (kernel_size * dilation - dilation) // 2
107
+ self.convs_sep.append(
108
+ nn.Conv1d(
109
+ channels,
110
+ channels,
111
+ kernel_size,
112
+ groups=channels,
113
+ dilation=dilation,
114
+ padding=padding,
115
+ )
116
+ )
117
+ self.convs_1x1.append(nn.Conv1d(channels, channels, 1))
118
+ self.norms_1.append(LayerNorm(channels))
119
+ self.norms_2.append(LayerNorm(channels))
120
+
121
+ def forward(self, x, x_mask, g=None):
122
+ if g is not None:
123
+ x = x + g
124
+ for i in range(self.n_layers):
125
+ y = self.convs_sep[i](x * x_mask)
126
+ y = self.norms_1[i](y)
127
+ y = F.gelu(y)
128
+ y = self.convs_1x1[i](y)
129
+ y = self.norms_2[i](y)
130
+ y = F.gelu(y)
131
+ y = self.drop(y)
132
+ x = x + y
133
+ return x * x_mask
134
+
135
+
136
+ class WN(torch.nn.Module):
137
+ def __init__(
138
+ self,
139
+ hidden_channels,
140
+ kernel_size,
141
+ dilation_rate,
142
+ n_layers,
143
+ gin_channels=0,
144
+ p_dropout=0,
145
+ ):
146
+ super(WN, self).__init__()
147
+ assert kernel_size % 2 == 1
148
+ self.hidden_channels = hidden_channels
149
+ self.kernel_size = (kernel_size,)
150
+ self.dilation_rate = dilation_rate
151
+ self.n_layers = n_layers
152
+ self.gin_channels = gin_channels
153
+ self.p_dropout = p_dropout
154
+
155
+ self.in_layers = torch.nn.ModuleList()
156
+ self.res_skip_layers = torch.nn.ModuleList()
157
+ self.drop = nn.Dropout(p_dropout)
158
+
159
+ if gin_channels != 0:
160
+ cond_layer = torch.nn.Conv1d(
161
+ gin_channels, 2 * hidden_channels * n_layers, 1
162
+ )
163
+ self.cond_layer = torch.nn.utils.weight_norm(cond_layer, name="weight")
164
+
165
+ for i in range(n_layers):
166
+ dilation = dilation_rate**i
167
+ padding = int((kernel_size * dilation - dilation) / 2)
168
+ in_layer = torch.nn.Conv1d(
169
+ hidden_channels,
170
+ 2 * hidden_channels,
171
+ kernel_size,
172
+ dilation=dilation,
173
+ padding=padding,
174
+ )
175
+ in_layer = torch.nn.utils.weight_norm(in_layer, name="weight")
176
+ self.in_layers.append(in_layer)
177
+
178
+ # last one is not necessary
179
+ if i < n_layers - 1:
180
+ res_skip_channels = 2 * hidden_channels
181
+ else:
182
+ res_skip_channels = hidden_channels
183
+
184
+ res_skip_layer = torch.nn.Conv1d(hidden_channels, res_skip_channels, 1)
185
+ res_skip_layer = torch.nn.utils.weight_norm(res_skip_layer, name="weight")
186
+ self.res_skip_layers.append(res_skip_layer)
187
+
188
+ def forward(self, x, x_mask, g=None, **kwargs):
189
+ output = torch.zeros_like(x)
190
+ n_channels_tensor = torch.IntTensor([self.hidden_channels])
191
+
192
+ if g is not None:
193
+ g = self.cond_layer(g)
194
+
195
+ for i in range(self.n_layers):
196
+ x_in = self.in_layers[i](x)
197
+ if g is not None:
198
+ cond_offset = i * 2 * self.hidden_channels
199
+ g_l = g[:, cond_offset : cond_offset + 2 * self.hidden_channels, :]
200
+ else:
201
+ g_l = torch.zeros_like(x_in)
202
+
203
+ acts = commons.fused_add_tanh_sigmoid_multiply(x_in, g_l, n_channels_tensor)
204
+ acts = self.drop(acts)
205
+
206
+ res_skip_acts = self.res_skip_layers[i](acts)
207
+ if i < self.n_layers - 1:
208
+ res_acts = res_skip_acts[:, : self.hidden_channels, :]
209
+ x = (x + res_acts) * x_mask
210
+ output = output + res_skip_acts[:, self.hidden_channels :, :]
211
+ else:
212
+ output = output + res_skip_acts
213
+ return output * x_mask
214
+
215
+ def remove_weight_norm(self):
216
+ if self.gin_channels != 0:
217
+ torch.nn.utils.remove_weight_norm(self.cond_layer)
218
+ for l in self.in_layers:
219
+ torch.nn.utils.remove_weight_norm(l)
220
+ for l in self.res_skip_layers:
221
+ torch.nn.utils.remove_weight_norm(l)
222
+
223
+
224
+ class ResBlock1(torch.nn.Module):
225
+ def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)):
226
+ super(ResBlock1, self).__init__()
227
+ self.convs1 = nn.ModuleList(
228
+ [
229
+ weight_norm(
230
+ Conv1d(
231
+ channels,
232
+ channels,
233
+ kernel_size,
234
+ 1,
235
+ dilation=dilation[0],
236
+ padding=get_padding(kernel_size, dilation[0]),
237
+ )
238
+ ),
239
+ weight_norm(
240
+ Conv1d(
241
+ channels,
242
+ channels,
243
+ kernel_size,
244
+ 1,
245
+ dilation=dilation[1],
246
+ padding=get_padding(kernel_size, dilation[1]),
247
+ )
248
+ ),
249
+ weight_norm(
250
+ Conv1d(
251
+ channels,
252
+ channels,
253
+ kernel_size,
254
+ 1,
255
+ dilation=dilation[2],
256
+ padding=get_padding(kernel_size, dilation[2]),
257
+ )
258
+ ),
259
+ ]
260
+ )
261
+ self.convs1.apply(init_weights)
262
+
263
+ self.convs2 = nn.ModuleList(
264
+ [
265
+ weight_norm(
266
+ Conv1d(
267
+ channels,
268
+ channels,
269
+ kernel_size,
270
+ 1,
271
+ dilation=1,
272
+ padding=get_padding(kernel_size, 1),
273
+ )
274
+ ),
275
+ weight_norm(
276
+ Conv1d(
277
+ channels,
278
+ channels,
279
+ kernel_size,
280
+ 1,
281
+ dilation=1,
282
+ padding=get_padding(kernel_size, 1),
283
+ )
284
+ ),
285
+ weight_norm(
286
+ Conv1d(
287
+ channels,
288
+ channels,
289
+ kernel_size,
290
+ 1,
291
+ dilation=1,
292
+ padding=get_padding(kernel_size, 1),
293
+ )
294
+ ),
295
+ ]
296
+ )
297
+ self.convs2.apply(init_weights)
298
+
299
+ def forward(self, x, x_mask=None):
300
+ for c1, c2 in zip(self.convs1, self.convs2):
301
+ xt = F.leaky_relu(x, LRELU_SLOPE)
302
+ if x_mask is not None:
303
+ xt = xt * x_mask
304
+ xt = c1(xt)
305
+ xt = F.leaky_relu(xt, LRELU_SLOPE)
306
+ if x_mask is not None:
307
+ xt = xt * x_mask
308
+ xt = c2(xt)
309
+ x = xt + x
310
+ if x_mask is not None:
311
+ x = x * x_mask
312
+ return x
313
+
314
+ def remove_weight_norm(self):
315
+ for l in self.convs1:
316
+ remove_weight_norm(l)
317
+ for l in self.convs2:
318
+ remove_weight_norm(l)
319
+
320
+
321
+ class ResBlock2(torch.nn.Module):
322
+ def __init__(self, channels, kernel_size=3, dilation=(1, 3)):
323
+ super(ResBlock2, self).__init__()
324
+ self.convs = nn.ModuleList(
325
+ [
326
+ weight_norm(
327
+ Conv1d(
328
+ channels,
329
+ channels,
330
+ kernel_size,
331
+ 1,
332
+ dilation=dilation[0],
333
+ padding=get_padding(kernel_size, dilation[0]),
334
+ )
335
+ ),
336
+ weight_norm(
337
+ Conv1d(
338
+ channels,
339
+ channels,
340
+ kernel_size,
341
+ 1,
342
+ dilation=dilation[1],
343
+ padding=get_padding(kernel_size, dilation[1]),
344
+ )
345
+ ),
346
+ ]
347
+ )
348
+ self.convs.apply(init_weights)
349
+
350
+ def forward(self, x, x_mask=None):
351
+ for c in self.convs:
352
+ xt = F.leaky_relu(x, LRELU_SLOPE)
353
+ if x_mask is not None:
354
+ xt = xt * x_mask
355
+ xt = c(xt)
356
+ x = xt + x
357
+ if x_mask is not None:
358
+ x = x * x_mask
359
+ return x
360
+
361
+ def remove_weight_norm(self):
362
+ for l in self.convs:
363
+ remove_weight_norm(l)
364
+
365
+
366
+ class Log(nn.Module):
367
+ def forward(self, x, x_mask, reverse=False, **kwargs):
368
+ if not reverse:
369
+ y = torch.log(torch.clamp_min(x, 1e-5)) * x_mask
370
+ logdet = torch.sum(-y, [1, 2])
371
+ return y, logdet
372
+ else:
373
+ x = torch.exp(x) * x_mask
374
+ return x
375
+
376
+
377
+ class Flip(nn.Module):
378
+ def forward(self, x, *args, reverse=False, **kwargs):
379
+ x = torch.flip(x, [1])
380
+ if not reverse:
381
+ logdet = torch.zeros(x.size(0)).to(dtype=x.dtype, device=x.device)
382
+ return x, logdet
383
+ else:
384
+ return x
385
+
386
+
387
+ class ElementwiseAffine(nn.Module):
388
+ def __init__(self, channels):
389
+ super().__init__()
390
+ self.channels = channels
391
+ self.m = nn.Parameter(torch.zeros(channels, 1))
392
+ self.logs = nn.Parameter(torch.zeros(channels, 1))
393
+
394
+ def forward(self, x, x_mask, reverse=False, **kwargs):
395
+ if not reverse:
396
+ y = self.m + torch.exp(self.logs) * x
397
+ y = y * x_mask
398
+ logdet = torch.sum(self.logs * x_mask, [1, 2])
399
+ return y, logdet
400
+ else:
401
+ x = (x - self.m) * torch.exp(-self.logs) * x_mask
402
+ return x
403
+
404
+
405
+ class ResidualCouplingLayer(nn.Module):
406
+ def __init__(
407
+ self,
408
+ channels,
409
+ hidden_channels,
410
+ kernel_size,
411
+ dilation_rate,
412
+ n_layers,
413
+ p_dropout=0,
414
+ gin_channels=0,
415
+ mean_only=False,
416
+ ):
417
+ assert channels % 2 == 0, "channels should be divisible by 2"
418
+ super().__init__()
419
+ self.channels = channels
420
+ self.hidden_channels = hidden_channels
421
+ self.kernel_size = kernel_size
422
+ self.dilation_rate = dilation_rate
423
+ self.n_layers = n_layers
424
+ self.half_channels = channels // 2
425
+ self.mean_only = mean_only
426
+
427
+ self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1)
428
+ self.enc = WN(
429
+ hidden_channels,
430
+ kernel_size,
431
+ dilation_rate,
432
+ n_layers,
433
+ p_dropout=p_dropout,
434
+ gin_channels=gin_channels,
435
+ )
436
+ self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1)
437
+ self.post.weight.data.zero_()
438
+ self.post.bias.data.zero_()
439
+
440
+ def forward(self, x, x_mask, g=None, reverse=False):
441
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
442
+ h = self.pre(x0) * x_mask
443
+ h = self.enc(h, x_mask, g=g)
444
+ stats = self.post(h) * x_mask
445
+ if not self.mean_only:
446
+ m, logs = torch.split(stats, [self.half_channels] * 2, 1)
447
+ else:
448
+ m = stats
449
+ logs = torch.zeros_like(m)
450
+
451
+ if not reverse:
452
+ x1 = m + x1 * torch.exp(logs) * x_mask
453
+ x = torch.cat([x0, x1], 1)
454
+ logdet = torch.sum(logs, [1, 2])
455
+ return x, logdet
456
+ else:
457
+ x1 = (x1 - m) * torch.exp(-logs) * x_mask
458
+ x = torch.cat([x0, x1], 1)
459
+ return x
460
+
461
+
462
+ class ConvFlow(nn.Module):
463
+ def __init__(
464
+ self,
465
+ in_channels,
466
+ filter_channels,
467
+ kernel_size,
468
+ n_layers,
469
+ num_bins=10,
470
+ tail_bound=5.0,
471
+ ):
472
+ super().__init__()
473
+ self.in_channels = in_channels
474
+ self.filter_channels = filter_channels
475
+ self.kernel_size = kernel_size
476
+ self.n_layers = n_layers
477
+ self.num_bins = num_bins
478
+ self.tail_bound = tail_bound
479
+ self.half_channels = in_channels // 2
480
+
481
+ self.pre = nn.Conv1d(self.half_channels, filter_channels, 1)
482
+ self.convs = DDSConv(filter_channels, kernel_size, n_layers, p_dropout=0.0)
483
+ self.proj = nn.Conv1d(
484
+ filter_channels, self.half_channels * (num_bins * 3 - 1), 1
485
+ )
486
+ self.proj.weight.data.zero_()
487
+ self.proj.bias.data.zero_()
488
+
489
+ def forward(self, x, x_mask, g=None, reverse=False):
490
+ x0, x1 = torch.split(x, [self.half_channels] * 2, 1)
491
+ h = self.pre(x0)
492
+ h = self.convs(h, x_mask, g=g)
493
+ h = self.proj(h) * x_mask
494
+
495
+ b, c, t = x0.shape
496
+ h = h.reshape(b, c, -1, t).permute(0, 1, 3, 2) # [b, cx?, t] -> [b, c, t, ?]
497
+
498
+ unnormalized_widths = h[..., : self.num_bins] / math.sqrt(self.filter_channels)
499
+ unnormalized_heights = h[..., self.num_bins : 2 * self.num_bins] / math.sqrt(
500
+ self.filter_channels
501
+ )
502
+ unnormalized_derivatives = h[..., 2 * self.num_bins :]
503
+
504
+ x1, logabsdet = piecewise_rational_quadratic_transform(
505
+ x1,
506
+ unnormalized_widths,
507
+ unnormalized_heights,
508
+ unnormalized_derivatives,
509
+ inverse=reverse,
510
+ tails="linear",
511
+ tail_bound=self.tail_bound,
512
+ )
513
+
514
+ x = torch.cat([x0, x1], 1) * x_mask
515
+ logdet = torch.sum(logabsdet * x_mask, [1, 2])
516
+ if not reverse:
517
+ return x, logdet
518
+ else:
519
+ return x
monotonic_align/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import torch
3
+ from .monotonic_align.core import maximum_path_c
4
+
5
+
6
+ def maximum_path(neg_cent, mask):
7
+ """Cython optimized version.
8
+ neg_cent: [b, t_t, t_s]
9
+ mask: [b, t_t, t_s]
10
+ """
11
+ device = neg_cent.device
12
+ dtype = neg_cent.dtype
13
+ neg_cent = neg_cent.data.cpu().numpy().astype(np.float32)
14
+ path = np.zeros(neg_cent.shape, dtype=np.int32)
15
+
16
+ t_t_max = mask.sum(1)[:, 0].data.cpu().numpy().astype(np.int32)
17
+ t_s_max = mask.sum(2)[:, 0].data.cpu().numpy().astype(np.int32)
18
+ maximum_path_c(path, neg_cent, t_t_max, t_s_max)
19
+ return torch.from_numpy(path).to(device=device, dtype=dtype)
monotonic_align/core.pyx ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cimport cython
2
+ from cython.parallel import prange
3
+
4
+
5
+ @cython.boundscheck(False)
6
+ @cython.wraparound(False)
7
+ cdef void maximum_path_each(int[:,::1] path, float[:,::1] value, int t_y, int t_x, float max_neg_val=-1e9) nogil:
8
+ cdef int x
9
+ cdef int y
10
+ cdef float v_prev
11
+ cdef float v_cur
12
+ cdef float tmp
13
+ cdef int index = t_x - 1
14
+
15
+ for y in range(t_y):
16
+ for x in range(max(0, t_x + y - t_y), min(t_x, y + 1)):
17
+ if x == y:
18
+ v_cur = max_neg_val
19
+ else:
20
+ v_cur = value[y-1, x]
21
+ if x == 0:
22
+ if y == 0:
23
+ v_prev = 0.
24
+ else:
25
+ v_prev = max_neg_val
26
+ else:
27
+ v_prev = value[y-1, x-1]
28
+ value[y, x] += max(v_prev, v_cur)
29
+
30
+ for y in range(t_y - 1, -1, -1):
31
+ path[y, index] = 1
32
+ if index != 0 and (index == y or value[y-1, index] < value[y-1, index-1]):
33
+ index = index - 1
34
+
35
+
36
+ @cython.boundscheck(False)
37
+ @cython.wraparound(False)
38
+ cpdef void maximum_path_c(int[:,:,::1] paths, float[:,:,::1] values, int[::1] t_ys, int[::1] t_xs) nogil:
39
+ cdef int b = paths.shape[0]
40
+ cdef int i
41
+ for i in prange(b, nogil=True):
42
+ maximum_path_each(paths[i], values[i], t_ys[i], t_xs[i])
monotonic_align/monotonic_align/.gitkeep ADDED
@@ -0,0 +1 @@
 
 
1
+
monotonic_align/setup.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from distutils.core import setup
2
+ from Cython.Build import cythonize
3
+ import numpy
4
+
5
+ setup(
6
+ name="monotonic_align",
7
+ ext_modules=cythonize("core.pyx"),
8
+ include_dirs=[numpy.get_include()],
9
+ )
preprocess.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import argparse
3
+ import json
4
+ import sys
5
+ sys.setrecursionlimit(500000) # Fix the error message of RecursionError: maximum recursion depth exceeded while calling a Python object. You can change the number as you want.
6
+
7
+ if __name__ == "__main__":
8
+ parser = argparse.ArgumentParser()
9
+ parser.add_argument("--add_auxiliary_data", type=bool, default="False", help="Whether to add extra data as fine-tuning helper")
10
+ parser.add_argument("--languages", default="C")
11
+ args = parser.parse_args()
12
+ if args.languages == "CJE":
13
+ langs = ["[ZH]", "[JA]", "[EN]"]
14
+ elif args.languages == "CJ":
15
+ langs = ["[ZH]", "[JA]"]
16
+ elif args.languages == "C":
17
+ langs = ["[ZH]"]
18
+ new_annos = []
19
+ # Source 1: transcribed short audios
20
+ if os.path.exists("./filelists/short_character_anno.list"):
21
+ with open("./filelists/short_character_anno.list", 'r', encoding='utf-8') as f:
22
+ short_character_anno = f.readlines()
23
+ new_annos += short_character_anno
24
+
25
+ # Get all speaker names
26
+ speakers = []
27
+ for line in new_annos:
28
+ path, speaker, text = line.split("|")
29
+ if speaker not in speakers:
30
+ speakers.append(speaker)
31
+ assert (len(speakers) != 0), "No audio file found. Please check your uploaded file structure."
32
+ if True:
33
+ # Do not add extra helper data
34
+ # STEP 1: modify config file
35
+ with open("./configs/finetune_speaker.json", 'r', encoding='utf-8') as f:
36
+ hps = json.load(f)
37
+
38
+ # assign ids to new speakers
39
+ speaker2id = {}
40
+ for i, speaker in enumerate(speakers):
41
+ speaker2id[speaker] = i
42
+ # modify n_speakers
43
+ hps['data']["n_speakers"] = len(speakers)
44
+ # overwrite speaker names
45
+ hps['speakers'] = speaker2id
46
+ hps['train']['log_interval'] = 10
47
+ hps['train']['eval_interval'] = 100
48
+ hps['train']['batch_size'] = 16
49
+ hps['data']['training_files'] = "final_annotation_train.txt"
50
+ hps['data']['validation_files'] = "final_annotation_val.txt"
51
+ # save modified config
52
+ with open("./configs/modified_finetune_speaker.json", 'w', encoding='utf-8') as f:
53
+ json.dump(hps, f, indent=2)
54
+
55
+ # STEP 2: clean annotations, replace speaker names with assigned speaker IDs
56
+ import text
57
+
58
+ cleaned_new_annos = []
59
+ for i, line in enumerate(new_annos):
60
+ path, speaker, txt = line.split("|")
61
+ if len(txt) > 150:
62
+ continue
63
+ cleaned_text = text._clean_text(txt, hps['data']['text_cleaners']).replace("[ZH]", "")
64
+ cleaned_text += "\n" if not cleaned_text.endswith("\n") else ""
65
+ cleaned_new_annos.append(path + "|" + cleaned_text)
66
+
67
+ final_annos = cleaned_new_annos
68
+ # save annotation file
69
+ with open("./filelists/final_annotation_train.txt", 'w', encoding='utf-8') as f:
70
+ for line in final_annos:
71
+ f.write(line)
72
+ # save annotation file for validation
73
+ with open("./filelists/final_annotation_val.txt", 'w', encoding='utf-8') as f:
74
+ for line in cleaned_new_annos:
75
+ f.write(line)
76
+ print("finished")
requirements.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ librosa==0.10.1
2
+ onnx==1.14.1
3
+ onnxruntime==1.15.1
4
+ matplotlib
5
+ numpy
6
+ numba
7
+ phonemizer
8
+ scipy
9
+ tensorboard
10
+ torch
11
+ torchaudio
12
+ torchvision
13
+ Unidecode
14
+ amfm_decompy
15
+ jieba
16
+ transformers
17
+ pypinyin
18
+ cn2an
19
+ gradio
20
+ av
21
+ mecab-python3
22
+ loguru
23
+ unidic-lite
24
+ cmudict
25
+ fugashi
26
+ num2words
27
+ Cython==0.29.21
28
+ openai-whisper
29
+ protobuf==3.20.*
short_audio_transcribe.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import whisper
2
+ import os
3
+ import json
4
+ import torchaudio
5
+ import argparse
6
+ import torch
7
+
8
+ lang2token = {
9
+ 'zh': "[ZH]",
10
+ 'ja': "[JA]",
11
+ "en": "[EN]",
12
+ }
13
+ def transcribe_one(audio_path):
14
+ # load audio and pad/trim it to fit 30 seconds
15
+ audio = whisper.load_audio(audio_path)
16
+ audio = whisper.pad_or_trim(audio)
17
+
18
+ # make log-Mel spectrogram and move to the same device as the model
19
+ mel = whisper.log_mel_spectrogram(audio).to(model.device)
20
+
21
+ # detect the spoken language
22
+ _, probs = model.detect_language(mel)
23
+ print(f"Detected language: {max(probs, key=probs.get)}")
24
+ lang = max(probs, key=probs.get)
25
+ # decode the audio
26
+ options = whisper.DecodingOptions(beam_size=5)
27
+ result = whisper.decode(model, mel, options)
28
+
29
+ # print the recognized text
30
+ print(result.text)
31
+ return lang, result.text
32
+ if __name__ == "__main__":
33
+ parser = argparse.ArgumentParser()
34
+ parser.add_argument("--languages", default="CJE")
35
+ parser.add_argument("--whisper_size", default="medium")
36
+ args = parser.parse_args()
37
+ if args.languages == "CJE":
38
+ lang2token = {
39
+ 'zh': "[ZH]",
40
+ 'ja': "[JA]",
41
+ "en": "[EN]",
42
+ }
43
+ elif args.languages == "CJ":
44
+ lang2token = {
45
+ 'zh': "[ZH]",
46
+ 'ja': "[JA]",
47
+ }
48
+ elif args.languages == "C":
49
+ lang2token = {
50
+ 'zh': "[ZH]",
51
+ }
52
+ assert (torch.cuda.is_available()), "Please enable GPU in order to run Whisper!"
53
+ model = whisper.load_model(args.whisper_size)
54
+ parent_dir = "./custom_character_voice/"
55
+ speaker_names = list(os.walk(parent_dir))[0][1]
56
+ speaker_annos = []
57
+ total_files = sum([len(files) for r, d, files in os.walk(parent_dir)])
58
+ # resample audios
59
+ # 2023/4/21: Get the target sampling rate
60
+ with open("./configs/config.json", 'r', encoding='utf-8') as f:
61
+ hps = json.load(f)
62
+ target_sr = hps['data']['sampling_rate']
63
+ processed_files = 0
64
+ for speaker in speaker_names:
65
+ for i, wavfile in enumerate(list(os.walk(parent_dir + speaker))[0][2]):
66
+ # try to load file as audio
67
+ if wavfile.startswith("processed_"):
68
+ continue
69
+ try:
70
+ wav, sr = torchaudio.load(parent_dir + speaker + "/" + wavfile, frame_offset=0, num_frames=-1, normalize=True,
71
+ channels_first=True)
72
+ wav = wav.mean(dim=0).unsqueeze(0)
73
+ if sr != target_sr:
74
+ wav = torchaudio.transforms.Resample(orig_freq=sr, new_freq=target_sr)(wav)
75
+ if wav.shape[1] / sr > 20:
76
+ print(f"{wavfile} too long, ignoring\n")
77
+ save_path = parent_dir + speaker + "/" + f"processed_{i}.wav"
78
+ torchaudio.save(save_path, wav, target_sr, channels_first=True)
79
+ # transcribe text
80
+ lang, text = transcribe_one(save_path)
81
+ if lang not in list(lang2token.keys()):
82
+ print(f"{lang} not supported, ignoring\n")
83
+ continue
84
+ text = text + "\n"#
85
+ #text = lang2token[lang] + text + lang2token[lang] + "\n"
86
+ speaker_annos.append(save_path + "|" + "0" + "|" + text)
87
+
88
+ processed_files += 1
89
+ print(f"Processed: {processed_files}/{total_files}")
90
+ except:
91
+ continue
92
+
93
+ # # clean annotation
94
+ # import argparse
95
+ # import text
96
+ # from utils import load_filepaths_and_text
97
+ # for i, line in enumerate(speaker_annos):
98
+ # path, sid, txt = line.split("|")
99
+ # cleaned_text = text._clean_text(txt, ["cjke_cleaners2"])
100
+ # cleaned_text += "\n" if not cleaned_text.endswith("\n") else ""
101
+ # speaker_annos[i] = path + "|" + sid + "|" + cleaned_text
102
+ # write into annotation
103
+ if len(speaker_annos) == 0:
104
+ print("Warning: no short audios found, this IS expected if you have only uploaded long audios, videos or video links.")
105
+ print("this IS NOT expected if you have uploaded a zip file of short audios. Please check your file structure or make sure your audio language is supported.")
106
+ with open("./filelists/short_character_anno.list", 'w', encoding='utf-8') as f:
107
+ for line in speaker_annos:
108
+ f.write(line)
109
+
110
+ # import json
111
+ # # generate new config
112
+ # with open("./configs/finetune_speaker.json", 'r', encoding='utf-8') as f:
113
+ # hps = json.load(f)
114
+ # # modify n_speakers
115
+ # hps['data']["n_speakers"] = 1000 + len(speaker2id)
116
+ # # add speaker names
117
+ # for speaker in speaker_names:
118
+ # hps['speakers'][speaker] = speaker2id[speaker]
119
+ # # save modified config
120
+ # with open("./configs/modified_finetune_speaker.json", 'w', encoding='utf-8') as f:
121
+ # json.dump(hps, f, indent=2)
122
+ # print("finished")
text/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2017 Keith Ito
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
text/__init__.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ from https://github.com/keithito/tacotron """
2
+ from text import cleaners
3
+ from text.symbols import symbols
4
+
5
+
6
+ # Mappings from symbol to numeric ID and vice versa:
7
+ _symbol_to_id = {s: i for i, s in enumerate(symbols)}
8
+ _id_to_symbol = {i: s for i, s in enumerate(symbols)}
9
+
10
+
11
+ def text_to_sequence(text, cleaner_names):
12
+ """Converts a string of text to a sequence of IDs corresponding to the symbols in the text.
13
+ Args:
14
+ text: string to convert to a sequence
15
+ cleaner_names: names of the cleaner functions to run the text through
16
+ Returns:
17
+ List of integers corresponding to the symbols in the text
18
+ """
19
+ sequence = []
20
+
21
+ clean_text = _clean_text(text, cleaner_names)
22
+ for symbol in clean_text:
23
+ if symbol in _symbol_to_id.keys():
24
+ symbol_id = _symbol_to_id[symbol]
25
+ sequence += [symbol_id]
26
+ else:
27
+ continue
28
+ return sequence
29
+
30
+
31
+ def cleaned_text_to_sequence(cleaned_text):
32
+ """Converts a string of text to a sequence of IDs corresponding to the symbols in the text.
33
+ Args:
34
+ text: string to convert to a sequence
35
+ Returns:
36
+ List of integers corresponding to the symbols in the text
37
+ """
38
+ sequence = []
39
+
40
+ for symbol in cleaned_text:
41
+ if symbol in _symbol_to_id.keys():
42
+ symbol_id = _symbol_to_id[symbol]
43
+ sequence += [symbol_id]
44
+ else:
45
+ continue
46
+ return sequence
47
+
48
+
49
+ def sequence_to_text(sequence):
50
+ """Converts a sequence of IDs back to a string"""
51
+ result = ""
52
+ for symbol_id in sequence:
53
+ s = _id_to_symbol[symbol_id]
54
+ result += s
55
+ return result
56
+
57
+
58
+ def _clean_text(text, cleaner_names):
59
+ for name in cleaner_names:
60
+ cleaner = getattr(cleaners, name)
61
+ if not cleaner:
62
+ raise Exception("Unknown cleaner: %s" % name)
63
+ text = cleaner(text)
64
+ return text
text/__pycache__/__init__.cpython-37.pyc ADDED
Binary file (2.34 kB). View file
 
text/__pycache__/mandarin.cpython-37.pyc ADDED
Binary file (7.51 kB). View file
 
text/cleaners.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ from text.mandarin import number_to_chinese, chinese_to_bopomofo, latin_to_bopomofo, chinese_to_romaji, chinese_to_lazy_ipa, chinese_to_ipa, chinese_to_ipa2
4
+
5
+
6
+ def chinese_cleaners(text):
7
+ '''Pipeline for Chinese text'''
8
+ text = text.replace("[ZH]", "")
9
+ text = number_to_chinese(text)
10
+ text = chinese_to_bopomofo(text)
11
+ text = latin_to_bopomofo(text)
12
+ text = re.sub(r'([ˉˊˇˋ˙])$', r'\1。', text)
13
+ return text
text/mandarin.py ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import re
4
+ from pypinyin import lazy_pinyin, BOPOMOFO
5
+ import jieba
6
+ import cn2an
7
+ import logging
8
+
9
+
10
+ # List of (Latin alphabet, bopomofo) pairs:
11
+ _latin_to_bopomofo = [(re.compile('%s' % x[0], re.IGNORECASE), x[1]) for x in [
12
+ ('a', 'ㄟˉ'),
13
+ ('b', 'ㄅㄧˋ'),
14
+ ('c', 'ㄙㄧˉ'),
15
+ ('d', 'ㄉㄧˋ'),
16
+ ('e', 'ㄧˋ'),
17
+ ('f', 'ㄝˊㄈㄨˋ'),
18
+ ('g', 'ㄐㄧˋ'),
19
+ ('h', 'ㄝˇㄑㄩˋ'),
20
+ ('i', 'ㄞˋ'),
21
+ ('j', 'ㄐㄟˋ'),
22
+ ('k', 'ㄎㄟˋ'),
23
+ ('l', 'ㄝˊㄛˋ'),
24
+ ('m', 'ㄝˊㄇㄨˋ'),
25
+ ('n', 'ㄣˉ'),
26
+ ('o', 'ㄡˉ'),
27
+ ('p', 'ㄆㄧˉ'),
28
+ ('q', 'ㄎㄧㄡˉ'),
29
+ ('r', 'ㄚˋ'),
30
+ ('s', 'ㄝˊㄙˋ'),
31
+ ('t', 'ㄊㄧˋ'),
32
+ ('u', 'ㄧㄡˉ'),
33
+ ('v', 'ㄨㄧˉ'),
34
+ ('w', 'ㄉㄚˋㄅㄨˋㄌㄧㄡˋ'),
35
+ ('x', 'ㄝˉㄎㄨˋㄙˋ'),
36
+ ('y', 'ㄨㄞˋ'),
37
+ ('z', 'ㄗㄟˋ')
38
+ ]]
39
+
40
+ # List of (bopomofo, romaji) pairs:
41
+ _bopomofo_to_romaji = [(re.compile('%s' % x[0]), x[1]) for x in [
42
+ ('ㄅㄛ', 'p⁼wo'),
43
+ ('ㄆㄛ', 'pʰwo'),
44
+ ('ㄇㄛ', 'mwo'),
45
+ ('ㄈㄛ', 'fwo'),
46
+ ('ㄅ', 'p⁼'),
47
+ ('ㄆ', 'pʰ'),
48
+ ('ㄇ', 'm'),
49
+ ('ㄈ', 'f'),
50
+ ('ㄉ', 't⁼'),
51
+ ('ㄊ', 'tʰ'),
52
+ ('ㄋ', 'n'),
53
+ ('ㄌ', 'l'),
54
+ ('ㄍ', 'k⁼'),
55
+ ('ㄎ', 'kʰ'),
56
+ ('ㄏ', 'h'),
57
+ ('ㄐ', 'ʧ⁼'),
58
+ ('ㄑ', 'ʧʰ'),
59
+ ('ㄒ', 'ʃ'),
60
+ ('ㄓ', 'ʦ`⁼'),
61
+ ('ㄔ', 'ʦ`ʰ'),
62
+ ('ㄕ', 's`'),
63
+ ('ㄖ', 'ɹ`'),
64
+ ('ㄗ', 'ʦ⁼'),
65
+ ('ㄘ', 'ʦʰ'),
66
+ ('ㄙ', 's'),
67
+ ('ㄚ', 'a'),
68
+ ('ㄛ', 'o'),
69
+ ('ㄜ', 'ə'),
70
+ ('ㄝ', 'e'),
71
+ ('ㄞ', 'ai'),
72
+ ('ㄟ', 'ei'),
73
+ ('ㄠ', 'au'),
74
+ ('ㄡ', 'ou'),
75
+ ('ㄧㄢ', 'yeNN'),
76
+ ('ㄢ', 'aNN'),
77
+ ('ㄧㄣ', 'iNN'),
78
+ ('ㄣ', 'əNN'),
79
+ ('ㄤ', 'aNg'),
80
+ ('ㄧㄥ', 'iNg'),
81
+ ('ㄨㄥ', 'uNg'),
82
+ ('ㄩㄥ', 'yuNg'),
83
+ ('ㄥ', 'əNg'),
84
+ ('ㄦ', 'əɻ'),
85
+ ('ㄧ', 'i'),
86
+ ('ㄨ', 'u'),
87
+ ('ㄩ', 'ɥ'),
88
+ ('ˉ', '→'),
89
+ ('ˊ', '↑'),
90
+ ('ˇ', '↓↑'),
91
+ ('ˋ', '↓'),
92
+ ('˙', ''),
93
+ (',', ','),
94
+ ('。', '.'),
95
+ ('!', '!'),
96
+ ('?', '?'),
97
+ ('—', '-')
98
+ ]]
99
+
100
+ # List of (romaji, ipa) pairs:
101
+ _romaji_to_ipa = [(re.compile('%s' % x[0], re.IGNORECASE), x[1]) for x in [
102
+ ('ʃy', 'ʃ'),
103
+ ('ʧʰy', 'ʧʰ'),
104
+ ('ʧ⁼y', 'ʧ⁼'),
105
+ ('NN', 'n'),
106
+ ('Ng', 'ŋ'),
107
+ ('y', 'j'),
108
+ ('h', 'x')
109
+ ]]
110
+
111
+ # List of (bopomofo, ipa) pairs:
112
+ _bopomofo_to_ipa = [(re.compile('%s' % x[0]), x[1]) for x in [
113
+ ('ㄅㄛ', 'p⁼wo'),
114
+ ('ㄆㄛ', 'pʰwo'),
115
+ ('ㄇㄛ', 'mwo'),
116
+ ('ㄈㄛ', 'fwo'),
117
+ ('ㄅ', 'p⁼'),
118
+ ('ㄆ', 'pʰ'),
119
+ ('ㄇ', 'm'),
120
+ ('ㄈ', 'f'),
121
+ ('ㄉ', 't⁼'),
122
+ ('ㄊ', 'tʰ'),
123
+ ('ㄋ', 'n'),
124
+ ('ㄌ', 'l'),
125
+ ('ㄍ', 'k⁼'),
126
+ ('ㄎ', 'kʰ'),
127
+ ('ㄏ', 'x'),
128
+ ('ㄐ', 'tʃ⁼'),
129
+ ('ㄑ', 'tʃʰ'),
130
+ ('ㄒ', 'ʃ'),
131
+ ('ㄓ', 'ts`⁼'),
132
+ ('ㄔ', 'ts`ʰ'),
133
+ ('ㄕ', 's`'),
134
+ ('ㄖ', 'ɹ`'),
135
+ ('ㄗ', 'ts⁼'),
136
+ ('ㄘ', 'tsʰ'),
137
+ ('ㄙ', 's'),
138
+ ('ㄚ', 'a'),
139
+ ('ㄛ', 'o'),
140
+ ('ㄜ', 'ə'),
141
+ ('ㄝ', 'ɛ'),
142
+ ('ㄞ', 'aɪ'),
143
+ ('ㄟ', 'eɪ'),
144
+ ('ㄠ', 'ɑʊ'),
145
+ ('ㄡ', 'oʊ'),
146
+ ('ㄧㄢ', 'jɛn'),
147
+ ('ㄩㄢ', 'ɥæn'),
148
+ ('ㄢ', 'an'),
149
+ ('ㄧㄣ', 'in'),
150
+ ('ㄩㄣ', 'ɥn'),
151
+ ('ㄣ', 'ən'),
152
+ ('ㄤ', 'ɑŋ'),
153
+ ('ㄧㄥ', 'iŋ'),
154
+ ('ㄨㄥ', 'ʊŋ'),
155
+ ('ㄩㄥ', 'jʊŋ'),
156
+ ('ㄥ', 'əŋ'),
157
+ ('ㄦ', 'əɻ'),
158
+ ('ㄧ', 'i'),
159
+ ('ㄨ', 'u'),
160
+ ('ㄩ', 'ɥ'),
161
+ ('ˉ', '→'),
162
+ ('ˊ', '↑'),
163
+ ('ˇ', '↓↑'),
164
+ ('ˋ', '↓'),
165
+ ('˙', ''),
166
+ (',', ','),
167
+ ('。', '.'),
168
+ ('!', '!'),
169
+ ('?', '?'),
170
+ ('—', '-')
171
+ ]]
172
+
173
+ # List of (bopomofo, ipa2) pairs:
174
+ _bopomofo_to_ipa2 = [(re.compile('%s' % x[0]), x[1]) for x in [
175
+ ('ㄅㄛ', 'pwo'),
176
+ ('ㄆㄛ', 'pʰwo'),
177
+ ('ㄇㄛ', 'mwo'),
178
+ ('ㄈㄛ', 'fwo'),
179
+ ('ㄅ', 'p'),
180
+ ('ㄆ', 'pʰ'),
181
+ ('ㄇ', 'm'),
182
+ ('ㄈ', 'f'),
183
+ ('ㄉ', 't'),
184
+ ('ㄊ', 'tʰ'),
185
+ ('ㄋ', 'n'),
186
+ ('ㄌ', 'l'),
187
+ ('ㄍ', 'k'),
188
+ ('ㄎ', 'kʰ'),
189
+ ('ㄏ', 'h'),
190
+ ('ㄐ', 'tɕ'),
191
+ ('ㄑ', 'tɕʰ'),
192
+ ('ㄒ', 'ɕ'),
193
+ ('ㄓ', 'tʂ'),
194
+ ('ㄔ', 'tʂʰ'),
195
+ ('ㄕ', 'ʂ'),
196
+ ('ㄖ', 'ɻ'),
197
+ ('ㄗ', 'ts'),
198
+ ('ㄘ', 'tsʰ'),
199
+ ('ㄙ', 's'),
200
+ ('ㄚ', 'a'),
201
+ ('ㄛ', 'o'),
202
+ ('ㄜ', 'ɤ'),
203
+ ('ㄝ', 'ɛ'),
204
+ ('ㄞ', 'aɪ'),
205
+ ('ㄟ', 'eɪ'),
206
+ ('ㄠ', 'ɑʊ'),
207
+ ('ㄡ', 'oʊ'),
208
+ ('ㄧㄢ', 'jɛn'),
209
+ ('ㄩㄢ', 'yæn'),
210
+ ('ㄢ', 'an'),
211
+ ('ㄧㄣ', 'in'),
212
+ ('ㄩㄣ', 'yn'),
213
+ ('ㄣ', 'ən'),
214
+ ('ㄤ', 'ɑŋ'),
215
+ ('ㄧㄥ', 'iŋ'),
216
+ ('ㄨㄥ', 'ʊŋ'),
217
+ ('ㄩㄥ', 'jʊŋ'),
218
+ ('ㄥ', 'ɤŋ'),
219
+ ('ㄦ', 'əɻ'),
220
+ ('ㄧ', 'i'),
221
+ ('ㄨ', 'u'),
222
+ ('ㄩ', 'y'),
223
+ ('ˉ', '˥'),
224
+ ('ˊ', '˧˥'),
225
+ ('ˇ', '˨˩˦'),
226
+ ('ˋ', '˥˩'),
227
+ ('˙', ''),
228
+ (',', ','),
229
+ ('。', '.'),
230
+ ('!', '!'),
231
+ ('?', '?'),
232
+ ('—', '-')
233
+ ]]
234
+
235
+
236
+ def number_to_chinese(text):
237
+ numbers = re.findall(r'\d+(?:\.?\d+)?', text)
238
+ for number in numbers:
239
+ text = text.replace(number, cn2an.an2cn(number), 1)
240
+ return text
241
+
242
+
243
+ def chinese_to_bopomofo(text):
244
+ text = text.replace('、', ',').replace(';', ',').replace(':', ',')
245
+ words = jieba.lcut(text, cut_all=False)
246
+ text = ''
247
+ for word in words:
248
+ bopomofos = lazy_pinyin(word, BOPOMOFO)
249
+ if not re.search('[\u4e00-\u9fff]', word):
250
+ text += word
251
+ continue
252
+ for i in range(len(bopomofos)):
253
+ bopomofos[i] = re.sub(r'([\u3105-\u3129])$', r'\1ˉ', bopomofos[i])
254
+ if text != '':
255
+ text += ' '
256
+ text += ''.join(bopomofos)
257
+ return text
258
+
259
+
260
+ def latin_to_bopomofo(text):
261
+ for regex, replacement in _latin_to_bopomofo:
262
+ text = re.sub(regex, replacement, text)
263
+ return text
264
+
265
+
266
+ def bopomofo_to_romaji(text):
267
+ for regex, replacement in _bopomofo_to_romaji:
268
+ text = re.sub(regex, replacement, text)
269
+ return text
270
+
271
+
272
+ def bopomofo_to_ipa(text):
273
+ for regex, replacement in _bopomofo_to_ipa:
274
+ text = re.sub(regex, replacement, text)
275
+ return text
276
+
277
+
278
+ def bopomofo_to_ipa2(text):
279
+ for regex, replacement in _bopomofo_to_ipa2:
280
+ text = re.sub(regex, replacement, text)
281
+ return text
282
+
283
+
284
+ def chinese_to_romaji(text):
285
+ text = number_to_chinese(text)
286
+ text = chinese_to_bopomofo(text)
287
+ text = latin_to_bopomofo(text)
288
+ text = bopomofo_to_romaji(text)
289
+ text = re.sub('i([aoe])', r'y\1', text)
290
+ text = re.sub('u([aoəe])', r'w\1', text)
291
+ text = re.sub('([ʦsɹ]`[⁼ʰ]?)([→↓↑ ]+|$)',
292
+ r'\1ɹ`\2', text).replace('ɻ', 'ɹ`')
293
+ text = re.sub('([ʦs][⁼ʰ]?)([→↓↑ ]+|$)', r'\1ɹ\2', text)
294
+ return text
295
+
296
+
297
+ def chinese_to_lazy_ipa(text):
298
+ text = chinese_to_romaji(text)
299
+ for regex, replacement in _romaji_to_ipa:
300
+ text = re.sub(regex, replacement, text)
301
+ return text
302
+
303
+
304
+ def chinese_to_ipa(text):
305
+ text = number_to_chinese(text)
306
+ text = chinese_to_bopomofo(text)
307
+ text = latin_to_bopomofo(text)
308
+ text = bopomofo_to_ipa(text)
309
+ text = re.sub('i([aoe])', r'j\1', text)
310
+ text = re.sub('u([aoəe])', r'w\1', text)
311
+ text = re.sub('([sɹ]`[⁼ʰ]?)([→↓↑ ]+|$)',
312
+ r'\1ɹ`\2', text).replace('ɻ', 'ɹ`')
313
+ text = re.sub('([s][⁼ʰ]?)([→↓↑ ]+|$)', r'\1ɹ\2', text)
314
+ return text
315
+
316
+
317
+ def chinese_to_ipa2(text):
318
+ text = number_to_chinese(text)
319
+ text = chinese_to_bopomofo(text)
320
+ text = latin_to_bopomofo(text)
321
+ text = bopomofo_to_ipa2(text)
322
+ text = re.sub(r'i([aoe])', r'j\1', text)
323
+ text = re.sub(r'u([aoəe])', r'w\1', text)
324
+ text = re.sub(r'([ʂɹ]ʰ?)([˩˨˧˦˥ ]+|$)', r'\1ʅ\2', text)
325
+ text = re.sub(r'(sʰ?)([˩˨˧˦˥ ]+|$)', r'\1ɿ\2', text)
326
+ return text
text/symbols.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''
2
+ Defines the set of symbols used in text input to the model.
3
+ '''
4
+
5
+ # chinese_cleaners
6
+ _pad = '_'
7
+ _punctuation = ',,。!?—…'
8
+ _letters = 'ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩˉˊˇˋ˙ '
9
+
10
+ # Export all symbols:
11
+ symbols = [_pad] + list(_punctuation) + list(_letters)
12
+
13
+ # Special symbol ids
14
+ SPACE_ID = symbols.index(" ")
train.py ADDED
@@ -0,0 +1,585 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import argparse
4
+ import itertools
5
+ import math
6
+ import torch
7
+ from torch import nn, optim
8
+ from torch.nn import functional as F
9
+ from torch.utils.data import DataLoader
10
+ from torch.utils.tensorboard import SummaryWriter
11
+
12
+ # from tensorboardX import SummaryWriter
13
+ import torch.multiprocessing as mp
14
+ import torch.distributed as dist
15
+ from torch.nn.parallel import DistributedDataParallel as DDP
16
+ from torch.cuda.amp import autocast, GradScaler
17
+ import tqdm
18
+
19
+ import commons
20
+ import utils
21
+ from data_utils import TextAudioLoader, TextAudioCollate, DistributedBucketSampler
22
+ from models import (
23
+ SynthesizerTrn,
24
+ MultiPeriodDiscriminator,
25
+ DurationDiscriminator,
26
+ AVAILABLE_FLOW_TYPES,
27
+ )
28
+ from losses import generator_loss, discriminator_loss, feature_loss, kl_loss
29
+ from mel_processing import mel_spectrogram_torch, spec_to_mel_torch
30
+ from text.symbols import symbols
31
+
32
+
33
+ torch.backends.cudnn.benchmark = True
34
+ global_step = 0
35
+
36
+
37
+ def main():
38
+ """Assume Single Node Multi GPUs Training Only"""
39
+ assert torch.cuda.is_available(), "CPU training is not allowed."
40
+
41
+ n_gpus = torch.cuda.device_count()
42
+ os.environ["MASTER_ADDR"] = "localhost"
43
+ os.environ["MASTER_PORT"] = "6060"
44
+
45
+ hps = utils.get_hparams()
46
+ mp.spawn(
47
+ run,
48
+ nprocs=n_gpus,
49
+ args=(
50
+ n_gpus,
51
+ hps,
52
+ ),
53
+ )
54
+
55
+
56
+ def run(rank, n_gpus, hps):
57
+ global global_step
58
+ if rank == 0:
59
+ logger = utils.get_logger(hps.model_dir)
60
+ logger.info(hps)
61
+ utils.check_git_hash(hps.model_dir)
62
+ writer = SummaryWriter(log_dir=hps.model_dir)
63
+ writer_eval = SummaryWriter(log_dir=os.path.join(hps.model_dir, "eval"))
64
+
65
+ dist.init_process_group(
66
+ backend="nccl", init_method="env://", world_size=n_gpus, rank=rank
67
+ )
68
+ torch.manual_seed(hps.train.seed)
69
+ torch.cuda.set_device(rank)
70
+
71
+ if (
72
+ "use_mel_posterior_encoder" in hps.model.keys()
73
+ and hps.model.use_mel_posterior_encoder == True
74
+ ):
75
+ print("Using mel posterior encoder for VITS2")
76
+ posterior_channels = 80 # vits2
77
+ hps.data.use_mel_posterior_encoder = True
78
+ else:
79
+ print("Using lin posterior encoder for VITS1")
80
+ posterior_channels = hps.data.filter_length // 2 + 1
81
+ hps.data.use_mel_posterior_encoder = False
82
+
83
+ train_dataset = TextAudioLoader(hps.data.training_files, hps.data)
84
+ train_sampler = DistributedBucketSampler(
85
+ train_dataset,
86
+ hps.train.batch_size,
87
+ [32, 300, 400, 500, 600, 700, 800, 900, 1000],
88
+ num_replicas=n_gpus,
89
+ rank=rank,
90
+ shuffle=True,
91
+ )
92
+
93
+ collate_fn = TextAudioCollate()
94
+ train_loader = DataLoader(
95
+ train_dataset,
96
+ num_workers=8,
97
+ shuffle=False,
98
+ pin_memory=True,
99
+ collate_fn=collate_fn,
100
+ batch_sampler=train_sampler,
101
+ )
102
+ if rank == 0:
103
+ eval_dataset = TextAudioLoader(hps.data.validation_files, hps.data)
104
+ eval_loader = DataLoader(
105
+ eval_dataset,
106
+ num_workers=8,
107
+ shuffle=False,
108
+ batch_size=hps.train.batch_size,
109
+ pin_memory=True,
110
+ drop_last=False,
111
+ collate_fn=collate_fn,
112
+ )
113
+ # some of these flags are not being used in the code and directly set in hps json file.
114
+ # they are kept here for reference and prototyping.
115
+
116
+ if (
117
+ "use_transformer_flows" in hps.model.keys()
118
+ and hps.model.use_transformer_flows == True
119
+ ):
120
+ use_transformer_flows = True
121
+ transformer_flow_type = hps.model.transformer_flow_type
122
+ print(f"Using transformer flows {transformer_flow_type} for VITS2")
123
+ assert (
124
+ transformer_flow_type in AVAILABLE_FLOW_TYPES
125
+ ), f"transformer_flow_type must be one of {AVAILABLE_FLOW_TYPES}"
126
+ else:
127
+ print("Using normal flows for VITS1")
128
+ use_transformer_flows = False
129
+
130
+ if (
131
+ "use_spk_conditioned_encoder" in hps.model.keys()
132
+ and hps.model.use_spk_conditioned_encoder == True
133
+ ):
134
+ if hps.data.n_speakers == 0:
135
+ print("Warning: use_spk_conditioned_encoder is True but n_speakers is 0")
136
+ print(
137
+ "Setting use_spk_conditioned_encoder to False as model is a single speaker model"
138
+ )
139
+ use_spk_conditioned_encoder = False
140
+ else:
141
+ print("Using normal encoder for VITS1")
142
+ use_spk_conditioned_encoder = False
143
+
144
+ if (
145
+ "use_noise_scaled_mas" in hps.model.keys()
146
+ and hps.model.use_noise_scaled_mas == True
147
+ ):
148
+ print("Using noise scaled MAS for VITS2")
149
+ use_noise_scaled_mas = True
150
+ mas_noise_scale_initial = 0.01
151
+ noise_scale_delta = 2e-6
152
+ else:
153
+ print("Using normal MAS for VITS1")
154
+ use_noise_scaled_mas = False
155
+ mas_noise_scale_initial = 0.0
156
+ noise_scale_delta = 0.0
157
+
158
+ if (
159
+ "use_duration_discriminator" in hps.model.keys()
160
+ and hps.model.use_duration_discriminator == True
161
+ ):
162
+ print("Using duration discriminator for VITS2")
163
+ use_duration_discriminator = True
164
+ net_dur_disc = DurationDiscriminator(
165
+ hps.model.hidden_channels,
166
+ hps.model.hidden_channels,
167
+ 3,
168
+ 0.1,
169
+ gin_channels=hps.model.gin_channels if hps.data.n_speakers != 0 else 0,
170
+ ).cuda(rank)
171
+ else:
172
+ print("NOT using any duration discriminator like VITS1")
173
+ net_dur_disc = None
174
+ use_duration_discriminator = False
175
+
176
+ net_g = SynthesizerTrn(
177
+ len(symbols),
178
+ posterior_channels,
179
+ hps.train.segment_size // hps.data.hop_length,
180
+ mas_noise_scale_initial=mas_noise_scale_initial,
181
+ noise_scale_delta=noise_scale_delta,
182
+ **hps.model,
183
+ ).cuda(rank)
184
+ net_d = MultiPeriodDiscriminator(hps.model.use_spectral_norm).cuda(rank)
185
+ optim_g = torch.optim.AdamW(
186
+ net_g.parameters(),
187
+ hps.train.learning_rate,
188
+ betas=hps.train.betas,
189
+ eps=hps.train.eps,
190
+ )
191
+ optim_d = torch.optim.AdamW(
192
+ net_d.parameters(),
193
+ hps.train.learning_rate,
194
+ betas=hps.train.betas,
195
+ eps=hps.train.eps,
196
+ )
197
+ if net_dur_disc is not None:
198
+ optim_dur_disc = torch.optim.AdamW(
199
+ net_dur_disc.parameters(),
200
+ hps.train.learning_rate,
201
+ betas=hps.train.betas,
202
+ eps=hps.train.eps,
203
+ )
204
+ else:
205
+ optim_dur_disc = None
206
+
207
+ net_g = DDP(net_g, device_ids=[rank], find_unused_parameters=True)
208
+ net_d = DDP(net_d, device_ids=[rank], find_unused_parameters=True)
209
+ if net_dur_disc is not None:
210
+ net_dur_disc = DDP(net_dur_disc, device_ids=[rank], find_unused_parameters=True)
211
+
212
+ try:
213
+ _, _, _, epoch_str = utils.load_checkpoint(
214
+ utils.latest_checkpoint_path(hps.model_dir, "G_*.pth"), net_g, optim_g
215
+ )
216
+ _, _, _, epoch_str = utils.load_checkpoint(
217
+ utils.latest_checkpoint_path(hps.model_dir, "D_*.pth"), net_d, optim_d
218
+ )
219
+ if net_dur_disc is not None:
220
+ _, _, _, epoch_str = utils.load_checkpoint(
221
+ utils.latest_checkpoint_path(hps.model_dir, "DUR_*.pth"),
222
+ net_dur_disc,
223
+ optim_dur_disc,
224
+ )
225
+ global_step = (epoch_str - 1) * len(train_loader)
226
+ except:
227
+ epoch_str = 1
228
+ global_step = 0
229
+
230
+ scheduler_g = torch.optim.lr_scheduler.ExponentialLR(
231
+ optim_g, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
232
+ )
233
+ scheduler_d = torch.optim.lr_scheduler.ExponentialLR(
234
+ optim_d, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
235
+ )
236
+ if net_dur_disc is not None:
237
+ scheduler_dur_disc = torch.optim.lr_scheduler.ExponentialLR(
238
+ optim_dur_disc, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
239
+ )
240
+ else:
241
+ scheduler_dur_disc = None
242
+
243
+ scaler = GradScaler(enabled=hps.train.fp16_run)
244
+
245
+ for epoch in range(epoch_str, hps.train.epochs + 1):
246
+ if rank == 0:
247
+ train_and_evaluate(
248
+ rank,
249
+ epoch,
250
+ hps,
251
+ [net_g, net_d, net_dur_disc],
252
+ [optim_g, optim_d, optim_dur_disc],
253
+ [scheduler_g, scheduler_d, scheduler_dur_disc],
254
+ scaler,
255
+ [train_loader, eval_loader],
256
+ logger,
257
+ [writer, writer_eval],
258
+ )
259
+ else:
260
+ train_and_evaluate(
261
+ rank,
262
+ epoch,
263
+ hps,
264
+ [net_g, net_d, net_dur_disc],
265
+ [optim_g, optim_d, optim_dur_disc],
266
+ [scheduler_g, scheduler_d, scheduler_dur_disc],
267
+ scaler,
268
+ [train_loader, None],
269
+ None,
270
+ None,
271
+ )
272
+ scheduler_g.step()
273
+ scheduler_d.step()
274
+ if net_dur_disc is not None:
275
+ scheduler_dur_disc.step()
276
+
277
+
278
+ def train_and_evaluate(
279
+ rank, epoch, hps, nets, optims, schedulers, scaler, loaders, logger, writers
280
+ ):
281
+ net_g, net_d, net_dur_disc = nets
282
+ optim_g, optim_d, optim_dur_disc = optims
283
+ scheduler_g, scheduler_d, scheduler_dur_disc = schedulers
284
+ train_loader, eval_loader = loaders
285
+ if writers is not None:
286
+ writer, writer_eval = writers
287
+
288
+ train_loader.batch_sampler.set_epoch(epoch)
289
+ global global_step
290
+
291
+ net_g.train()
292
+ net_d.train()
293
+ if net_dur_disc is not None:
294
+ net_dur_disc.train()
295
+
296
+ if rank == 0:
297
+ loader = tqdm.tqdm(train_loader, desc="Loading train data")
298
+ else:
299
+ loader = train_loader
300
+ for batch_idx, (x, x_lengths, spec, spec_lengths, y, y_lengths) in enumerate(
301
+ loader
302
+ ):
303
+ if net_g.module.use_noise_scaled_mas:
304
+ current_mas_noise_scale = (
305
+ net_g.module.mas_noise_scale_initial
306
+ - net_g.module.noise_scale_delta * global_step
307
+ )
308
+ net_g.module.current_mas_noise_scale = max(current_mas_noise_scale, 0.0)
309
+ x, x_lengths = x.cuda(rank, non_blocking=True), x_lengths.cuda(
310
+ rank, non_blocking=True
311
+ )
312
+ spec, spec_lengths = spec.cuda(rank, non_blocking=True), spec_lengths.cuda(
313
+ rank, non_blocking=True
314
+ )
315
+ y, y_lengths = y.cuda(rank, non_blocking=True), y_lengths.cuda(
316
+ rank, non_blocking=True
317
+ )
318
+
319
+ with autocast(enabled=hps.train.fp16_run):
320
+ (
321
+ y_hat,
322
+ l_length,
323
+ attn,
324
+ ids_slice,
325
+ x_mask,
326
+ z_mask,
327
+ (z, z_p, m_p, logs_p, m_q, logs_q),
328
+ (hidden_x, logw, logw_),
329
+ ) = net_g(x, x_lengths, spec, spec_lengths)
330
+
331
+ if (
332
+ hps.model.use_mel_posterior_encoder
333
+ or hps.data.use_mel_posterior_encoder
334
+ ):
335
+ mel = spec
336
+ else:
337
+ mel = spec_to_mel_torch(
338
+ spec,
339
+ hps.data.filter_length,
340
+ hps.data.n_mel_channels,
341
+ hps.data.sampling_rate,
342
+ hps.data.mel_fmin,
343
+ hps.data.mel_fmax,
344
+ )
345
+ y_mel = commons.slice_segments(
346
+ mel, ids_slice, hps.train.segment_size // hps.data.hop_length
347
+ )
348
+ y_hat_mel = mel_spectrogram_torch(
349
+ y_hat.squeeze(1),
350
+ hps.data.filter_length,
351
+ hps.data.n_mel_channels,
352
+ hps.data.sampling_rate,
353
+ hps.data.hop_length,
354
+ hps.data.win_length,
355
+ hps.data.mel_fmin,
356
+ hps.data.mel_fmax,
357
+ )
358
+
359
+ y = commons.slice_segments(
360
+ y, ids_slice * hps.data.hop_length, hps.train.segment_size
361
+ ) # slice
362
+
363
+ # Discriminator
364
+ y_d_hat_r, y_d_hat_g, _, _ = net_d(y, y_hat.detach())
365
+ with autocast(enabled=False):
366
+ loss_disc, losses_disc_r, losses_disc_g = discriminator_loss(
367
+ y_d_hat_r, y_d_hat_g
368
+ )
369
+ loss_disc_all = loss_disc
370
+
371
+ # Duration Discriminator
372
+ if net_dur_disc is not None:
373
+ y_dur_hat_r, y_dur_hat_g = net_dur_disc(
374
+ hidden_x.detach(), x_mask.detach(), logw_.detach(), logw.detach()
375
+ )
376
+ with autocast(enabled=False):
377
+ # TODO: I think need to mean using the mask, but for now, just mean all
378
+ (
379
+ loss_dur_disc,
380
+ losses_dur_disc_r,
381
+ losses_dur_disc_g,
382
+ ) = discriminator_loss(y_dur_hat_r, y_dur_hat_g)
383
+ loss_dur_disc_all = loss_dur_disc
384
+ optim_dur_disc.zero_grad()
385
+ scaler.scale(loss_dur_disc_all).backward()
386
+ scaler.unscale_(optim_dur_disc)
387
+ grad_norm_dur_disc = commons.clip_grad_value_(
388
+ net_dur_disc.parameters(), None
389
+ )
390
+ scaler.step(optim_dur_disc)
391
+
392
+ optim_d.zero_grad()
393
+ scaler.scale(loss_disc_all).backward()
394
+ scaler.unscale_(optim_d)
395
+ grad_norm_d = commons.clip_grad_value_(net_d.parameters(), None)
396
+ scaler.step(optim_d)
397
+
398
+ with autocast(enabled=hps.train.fp16_run):
399
+ # Generator
400
+ y_d_hat_r, y_d_hat_g, fmap_r, fmap_g = net_d(y, y_hat)
401
+ if net_dur_disc is not None:
402
+ y_dur_hat_r, y_dur_hat_g = net_dur_disc(hidden_x, x_mask, logw_, logw)
403
+ with autocast(enabled=False):
404
+ loss_dur = torch.sum(l_length.float())
405
+ loss_mel = F.l1_loss(y_mel, y_hat_mel) * hps.train.c_mel
406
+ loss_kl = kl_loss(z_p, logs_q, m_p, logs_p, z_mask) * hps.train.c_kl
407
+
408
+ loss_fm = feature_loss(fmap_r, fmap_g)
409
+ loss_gen, losses_gen = generator_loss(y_d_hat_g)
410
+ loss_gen_all = loss_gen + loss_fm + loss_mel + loss_dur + loss_kl
411
+ if net_dur_disc is not None:
412
+ loss_dur_gen, losses_dur_gen = generator_loss(y_dur_hat_g)
413
+ loss_gen_all += loss_dur_gen
414
+
415
+ optim_g.zero_grad()
416
+ scaler.scale(loss_gen_all).backward()
417
+ scaler.unscale_(optim_g)
418
+ grad_norm_g = commons.clip_grad_value_(net_g.parameters(), None)
419
+ scaler.step(optim_g)
420
+ scaler.update()
421
+
422
+ if rank == 0:
423
+ if global_step % hps.train.log_interval == 0:
424
+ lr = optim_g.param_groups[0]["lr"]
425
+ losses = [loss_disc, loss_gen, loss_fm, loss_mel, loss_dur, loss_kl]
426
+ logger.info(
427
+ "Train Epoch: {} [{:.0f}%]".format(
428
+ epoch, 100.0 * batch_idx / len(train_loader)
429
+ )
430
+ )
431
+ logger.info([x.item() for x in losses] + [global_step, lr])
432
+
433
+ scalar_dict = {
434
+ "loss/g/total": loss_gen_all,
435
+ "loss/d/total": loss_disc_all,
436
+ "learning_rate": lr,
437
+ "grad_norm_d": grad_norm_d,
438
+ "grad_norm_g": grad_norm_g,
439
+ }
440
+ if net_dur_disc is not None:
441
+ scalar_dict.update(
442
+ {
443
+ "loss/dur_disc/total": loss_dur_disc_all,
444
+ "grad_norm_dur_disc": grad_norm_dur_disc,
445
+ }
446
+ )
447
+ scalar_dict.update(
448
+ {
449
+ "loss/g/fm": loss_fm,
450
+ "loss/g/mel": loss_mel,
451
+ "loss/g/dur": loss_dur,
452
+ "loss/g/kl": loss_kl,
453
+ }
454
+ )
455
+
456
+ scalar_dict.update(
457
+ {"loss/g/{}".format(i): v for i, v in enumerate(losses_gen)}
458
+ )
459
+ scalar_dict.update(
460
+ {"loss/d_r/{}".format(i): v for i, v in enumerate(losses_disc_r)}
461
+ )
462
+ scalar_dict.update(
463
+ {"loss/d_g/{}".format(i): v for i, v in enumerate(losses_disc_g)}
464
+ )
465
+
466
+ # if net_dur_disc is not None:
467
+ # scalar_dict.update({"loss/dur_disc_r" : f"{losses_dur_disc_r}"})
468
+ # scalar_dict.update({"loss/dur_disc_g" : f"{losses_dur_disc_g}"})
469
+ # scalar_dict.update({"loss/dur_gen" : f"{loss_dur_gen}"})
470
+
471
+ image_dict = {
472
+ "slice/mel_org": utils.plot_spectrogram_to_numpy(
473
+ y_mel[0].data.cpu().numpy()
474
+ ),
475
+ "slice/mel_gen": utils.plot_spectrogram_to_numpy(
476
+ y_hat_mel[0].data.cpu().numpy()
477
+ ),
478
+ "all/mel": utils.plot_spectrogram_to_numpy(
479
+ mel[0].data.cpu().numpy()
480
+ ),
481
+ "all/attn": utils.plot_alignment_to_numpy(
482
+ attn[0, 0].data.cpu().numpy()
483
+ ),
484
+ }
485
+ utils.summarize(
486
+ writer=writer,
487
+ global_step=global_step,
488
+ images=image_dict,
489
+ scalars=scalar_dict,
490
+ )
491
+
492
+ if global_step % hps.train.eval_interval == 0:
493
+ evaluate(hps, net_g, eval_loader, writer_eval)
494
+ utils.save_checkpoint(
495
+ net_g,
496
+ optim_g,
497
+ hps.train.learning_rate,
498
+ epoch,
499
+ os.path.join(hps.model_dir, "G_{}.pth".format(global_step)),
500
+ )
501
+ utils.save_checkpoint(
502
+ net_d,
503
+ optim_d,
504
+ hps.train.learning_rate,
505
+ epoch,
506
+ os.path.join(hps.model_dir, "D_{}.pth".format(global_step)),
507
+ )
508
+ if net_dur_disc is not None:
509
+ utils.save_checkpoint(
510
+ net_dur_disc,
511
+ optim_dur_disc,
512
+ hps.train.learning_rate,
513
+ epoch,
514
+ os.path.join(hps.model_dir, "DUR_{}.pth".format(global_step)),
515
+ )
516
+ global_step += 1
517
+
518
+ if rank == 0:
519
+ logger.info("====> Epoch: {}".format(epoch))
520
+
521
+
522
+ def evaluate(hps, generator, eval_loader, writer_eval):
523
+ generator.eval()
524
+ with torch.no_grad():
525
+ for batch_idx, (x, x_lengths, spec, spec_lengths, y, y_lengths) in enumerate(
526
+ eval_loader
527
+ ):
528
+ x, x_lengths = x.cuda(0), x_lengths.cuda(0)
529
+ spec, spec_lengths = spec.cuda(0), spec_lengths.cuda(0)
530
+ y, y_lengths = y.cuda(0), y_lengths.cuda(0)
531
+
532
+ # remove else
533
+ x = x[:1]
534
+ x_lengths = x_lengths[:1]
535
+ spec = spec[:1]
536
+ spec_lengths = spec_lengths[:1]
537
+ y = y[:1]
538
+ y_lengths = y_lengths[:1]
539
+ break
540
+ y_hat, attn, mask, *_ = generator.module.infer(x, x_lengths, max_len=1000)
541
+ y_hat_lengths = mask.sum([1, 2]).long() * hps.data.hop_length
542
+
543
+ if hps.model.use_mel_posterior_encoder or hps.data.use_mel_posterior_encoder:
544
+ mel = spec
545
+ else:
546
+ mel = spec_to_mel_torch(
547
+ spec,
548
+ hps.data.filter_length,
549
+ hps.data.n_mel_channels,
550
+ hps.data.sampling_rate,
551
+ hps.data.mel_fmin,
552
+ hps.data.mel_fmax,
553
+ )
554
+ y_hat_mel = mel_spectrogram_torch(
555
+ y_hat.squeeze(1).float(),
556
+ hps.data.filter_length,
557
+ hps.data.n_mel_channels,
558
+ hps.data.sampling_rate,
559
+ hps.data.hop_length,
560
+ hps.data.win_length,
561
+ hps.data.mel_fmin,
562
+ hps.data.mel_fmax,
563
+ )
564
+ image_dict = {
565
+ "gen/mel": utils.plot_spectrogram_to_numpy(y_hat_mel[0].cpu().numpy())
566
+ }
567
+ audio_dict = {"gen/audio": y_hat[0, :, : y_hat_lengths[0]]}
568
+ if global_step == 0:
569
+ image_dict.update(
570
+ {"gt/mel": utils.plot_spectrogram_to_numpy(mel[0].cpu().numpy())}
571
+ )
572
+ audio_dict.update({"gt/audio": y[0, :, : y_lengths[0]]})
573
+
574
+ utils.summarize(
575
+ writer=writer_eval,
576
+ global_step=global_step,
577
+ images=image_dict,
578
+ audios=audio_dict,
579
+ audio_sampling_rate=hps.data.sampling_rate,
580
+ )
581
+ generator.train()
582
+
583
+
584
+ if __name__ == "__main__":
585
+ main()
train_ms.py ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import argparse
4
+ import itertools
5
+ import math
6
+ import torch
7
+ from torch import nn, optim
8
+ from torch.nn import functional as F
9
+ from torch.utils.data import DataLoader
10
+ from torch.utils.tensorboard import SummaryWriter
11
+
12
+ # from tensorboardX import SummaryWriter
13
+ import torch.multiprocessing as mp
14
+ import torch.distributed as dist
15
+ from torch.nn.parallel import DistributedDataParallel as DDP
16
+ from torch.cuda.amp import autocast, GradScaler
17
+ import tqdm
18
+
19
+ import commons
20
+ import utils
21
+ from data_utils import (
22
+ TextAudioSpeakerLoader,
23
+ TextAudioSpeakerCollate,
24
+ DistributedBucketSampler,
25
+ )
26
+ from models import (
27
+ SynthesizerTrn,
28
+ MultiPeriodDiscriminator,
29
+ DurationDiscriminator,
30
+ AVAILABLE_FLOW_TYPES,
31
+ )
32
+ from losses import generator_loss, discriminator_loss, feature_loss, kl_loss
33
+ from mel_processing import mel_spectrogram_torch, spec_to_mel_torch
34
+ from text.symbols import symbols
35
+
36
+
37
+ torch.backends.cudnn.benchmark = True
38
+ global_step = 0
39
+
40
+
41
+ def main():
42
+ """Assume Single Node Multi GPUs Training Only"""
43
+ assert torch.cuda.is_available(), "CPU training is not allowed."
44
+
45
+ n_gpus = torch.cuda.device_count()
46
+ os.environ["MASTER_ADDR"] = "localhost"
47
+ os.environ["MASTER_PORT"] = "6060"
48
+
49
+ hps = utils.get_hparams()
50
+ mp.spawn(
51
+ run,
52
+ nprocs=n_gpus,
53
+ args=(
54
+ n_gpus,
55
+ hps,
56
+ ),
57
+ )
58
+
59
+
60
+ def run(rank, n_gpus, hps):
61
+ global global_step
62
+ if rank == 0:
63
+ logger = utils.get_logger(hps.model_dir)
64
+ logger.info(hps)
65
+ utils.check_git_hash(hps.model_dir)
66
+ writer = SummaryWriter(log_dir=hps.model_dir)
67
+ writer_eval = SummaryWriter(log_dir=os.path.join(hps.model_dir, "eval"))
68
+
69
+ dist.init_process_group(
70
+ backend="nccl", init_method="env://", world_size=n_gpus, rank=rank
71
+ )
72
+ torch.manual_seed(hps.train.seed)
73
+ torch.cuda.set_device(rank)
74
+
75
+ if (
76
+ "use_mel_posterior_encoder" in hps.model.keys()
77
+ and hps.model.use_mel_posterior_encoder == True
78
+ ):
79
+ print("Using mel posterior encoder for VITS2")
80
+ posterior_channels = 80 # vits2
81
+ hps.data.use_mel_posterior_encoder = True
82
+ else:
83
+ print("Using lin posterior encoder for VITS1")
84
+ posterior_channels = hps.data.filter_length // 2 + 1
85
+ hps.data.use_mel_posterior_encoder = False
86
+
87
+ train_dataset = TextAudioSpeakerLoader(hps.data.training_files, hps.data)
88
+ train_sampler = DistributedBucketSampler(
89
+ train_dataset,
90
+ hps.train.batch_size,
91
+ [32, 300, 400, 500, 600, 700, 800, 900, 1000],
92
+ num_replicas=n_gpus,
93
+ rank=rank,
94
+ shuffle=True,
95
+ )
96
+ collate_fn = TextAudioSpeakerCollate()
97
+ train_loader = DataLoader(
98
+ train_dataset,
99
+ num_workers=8,
100
+ shuffle=False,
101
+ pin_memory=True,
102
+ collate_fn=collate_fn,
103
+ batch_sampler=train_sampler,
104
+ )
105
+ if rank == 0:
106
+ eval_dataset = TextAudioSpeakerLoader(hps.data.validation_files, hps.data)
107
+ eval_loader = DataLoader(
108
+ eval_dataset,
109
+ num_workers=8,
110
+ shuffle=False,
111
+ batch_size=hps.train.batch_size,
112
+ pin_memory=True,
113
+ drop_last=False,
114
+ collate_fn=collate_fn,
115
+ )
116
+ # some of these flags are not being used in the code and directly set in hps json file.
117
+ # they are kept here for reference and prototyping.
118
+ if (
119
+ "use_transformer_flows" in hps.model.keys()
120
+ and hps.model.use_transformer_flows == True
121
+ ):
122
+ use_transformer_flows = True
123
+ transformer_flow_type = hps.model.transformer_flow_type
124
+ print(f"Using transformer flows {transformer_flow_type} for VITS2")
125
+ assert (
126
+ transformer_flow_type in AVAILABLE_FLOW_TYPES
127
+ ), f"transformer_flow_type must be one of {AVAILABLE_FLOW_TYPES}"
128
+ else:
129
+ print("Using normal flows for VITS1")
130
+ use_transformer_flows = False
131
+
132
+ if (
133
+ "use_spk_conditioned_encoder" in hps.model.keys()
134
+ and hps.model.use_spk_conditioned_encoder == True
135
+ ):
136
+ if hps.data.n_speakers == 0:
137
+ raise ValueError(
138
+ "n_speakers must be > 0 when using spk conditioned encoder to train multi-speaker model"
139
+ )
140
+ use_spk_conditioned_encoder = True
141
+ else:
142
+ print("Using normal encoder for VITS1")
143
+ use_spk_conditioned_encoder = False
144
+
145
+ if (
146
+ "use_noise_scaled_mas" in hps.model.keys()
147
+ and hps.model.use_noise_scaled_mas == True
148
+ ):
149
+ print("Using noise scaled MAS for VITS2")
150
+ use_noise_scaled_mas = True
151
+ mas_noise_scale_initial = 0.01
152
+ noise_scale_delta = 2e-6
153
+ else:
154
+ print("Using normal MAS for VITS1")
155
+ use_noise_scaled_mas = False
156
+ mas_noise_scale_initial = 0.0
157
+ noise_scale_delta = 0.0
158
+
159
+ if (
160
+ "use_duration_discriminator" in hps.model.keys()
161
+ and hps.model.use_duration_discriminator == True
162
+ ):
163
+ print("Using duration discriminator for VITS2")
164
+ use_duration_discriminator = True
165
+ net_dur_disc = DurationDiscriminator(
166
+ hps.model.hidden_channels,
167
+ hps.model.hidden_channels,
168
+ 3,
169
+ 0.1,
170
+ gin_channels=hps.model.gin_channels if hps.data.n_speakers != 0 else 0,
171
+ ).cuda(rank)
172
+ else:
173
+ print("NOT using any duration discriminator like VITS1")
174
+ net_dur_disc = None
175
+ use_duration_discriminator = False
176
+
177
+ net_g = SynthesizerTrn(
178
+ len(symbols),
179
+ posterior_channels,
180
+ hps.train.segment_size // hps.data.hop_length,
181
+ n_speakers=hps.data.n_speakers,
182
+ mas_noise_scale_initial=mas_noise_scale_initial,
183
+ noise_scale_delta=noise_scale_delta,
184
+ **hps.model,
185
+ ).cuda(rank)
186
+ net_d = MultiPeriodDiscriminator(hps.model.use_spectral_norm).cuda(rank)
187
+ optim_g = torch.optim.AdamW(
188
+ net_g.parameters(),
189
+ hps.train.learning_rate,
190
+ betas=hps.train.betas,
191
+ eps=hps.train.eps,
192
+ )
193
+ optim_d = torch.optim.AdamW(
194
+ net_d.parameters(),
195
+ hps.train.learning_rate,
196
+ betas=hps.train.betas,
197
+ eps=hps.train.eps,
198
+ )
199
+ if net_dur_disc is not None:
200
+ optim_dur_disc = torch.optim.AdamW(
201
+ net_dur_disc.parameters(),
202
+ hps.train.learning_rate,
203
+ betas=hps.train.betas,
204
+ eps=hps.train.eps,
205
+ )
206
+ else:
207
+ optim_dur_disc = None
208
+
209
+ net_g = DDP(net_g, device_ids=[rank], find_unused_parameters=True)
210
+ net_d = DDP(net_d, device_ids=[rank], find_unused_parameters=True)
211
+ if net_dur_disc is not None:
212
+ net_dur_disc = DDP(net_dur_disc, device_ids=[rank], find_unused_parameters=True)
213
+
214
+ try:
215
+ _, _, _, epoch_str = utils.load_checkpoint(
216
+ utils.latest_checkpoint_path(hps.model_dir, "G_*.pth"), net_g, optim_g
217
+ )
218
+ _, _, _, epoch_str = utils.load_checkpoint(
219
+ utils.latest_checkpoint_path(hps.model_dir, "D_*.pth"), net_d, optim_d
220
+ )
221
+ if net_dur_disc is not None:
222
+ _, _, _, epoch_str = utils.load_checkpoint(
223
+ utils.latest_checkpoint_path(hps.model_dir, "DUR_*.pth"),
224
+ net_dur_disc,
225
+ optim_dur_disc,
226
+ )
227
+ global_step = (epoch_str - 1) * len(train_loader)
228
+ except:
229
+ epoch_str = 1
230
+ global_step = 0
231
+
232
+ scheduler_g = torch.optim.lr_scheduler.ExponentialLR(
233
+ optim_g, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
234
+ )
235
+ scheduler_d = torch.optim.lr_scheduler.ExponentialLR(
236
+ optim_d, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
237
+ )
238
+ if net_dur_disc is not None:
239
+ scheduler_dur_disc = torch.optim.lr_scheduler.ExponentialLR(
240
+ optim_dur_disc, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2
241
+ )
242
+ else:
243
+ scheduler_dur_disc = None
244
+
245
+ scaler = GradScaler(enabled=hps.train.fp16_run)
246
+
247
+ for epoch in range(epoch_str, hps.train.epochs + 1):
248
+ if rank == 0:
249
+ train_and_evaluate(
250
+ rank,
251
+ epoch,
252
+ hps,
253
+ [net_g, net_d, net_dur_disc],
254
+ [optim_g, optim_d, optim_dur_disc],
255
+ [scheduler_g, scheduler_d, scheduler_dur_disc],
256
+ scaler,
257
+ [train_loader, eval_loader],
258
+ logger,
259
+ [writer, writer_eval],
260
+ )
261
+ else:
262
+ train_and_evaluate(
263
+ rank,
264
+ epoch,
265
+ hps,
266
+ [net_g, net_d, net_dur_disc],
267
+ [optim_g, optim_d, optim_dur_disc],
268
+ [scheduler_g, scheduler_d, scheduler_dur_disc],
269
+ scaler,
270
+ [train_loader, None],
271
+ None,
272
+ None,
273
+ )
274
+ scheduler_g.step()
275
+ scheduler_d.step()
276
+ if net_dur_disc is not None:
277
+ scheduler_dur_disc.step()
278
+
279
+
280
+ def train_and_evaluate(
281
+ rank, epoch, hps, nets, optims, schedulers, scaler, loaders, logger, writers
282
+ ):
283
+ net_g, net_d, net_dur_disc = nets
284
+ optim_g, optim_d, optim_dur_disc = optims
285
+ scheduler_g, scheduler_d, scheduler_dur_disc = schedulers
286
+ train_loader, eval_loader = loaders
287
+ if writers is not None:
288
+ writer, writer_eval = writers
289
+
290
+ train_loader.batch_sampler.set_epoch(epoch)
291
+ global global_step
292
+
293
+ net_g.train()
294
+ net_d.train()
295
+ if net_dur_disc is not None:
296
+ net_dur_disc.train()
297
+
298
+ if rank == 0:
299
+ loader = tqdm.tqdm(train_loader, desc="Loading train data")
300
+ else:
301
+ loader = train_loader
302
+ for batch_idx, (
303
+ x,
304
+ x_lengths,
305
+ spec,
306
+ spec_lengths,
307
+ y,
308
+ y_lengths,
309
+ speakers,
310
+ ) in enumerate(loader):
311
+ if net_g.module.use_noise_scaled_mas:
312
+ current_mas_noise_scale = (
313
+ net_g.module.mas_noise_scale_initial
314
+ - net_g.module.noise_scale_delta * global_step
315
+ )
316
+ net_g.module.current_mas_noise_scale = max(current_mas_noise_scale, 0.0)
317
+ x, x_lengths = x.cuda(rank, non_blocking=True), x_lengths.cuda(
318
+ rank, non_blocking=True
319
+ )
320
+ spec, spec_lengths = spec.cuda(rank, non_blocking=True), spec_lengths.cuda(
321
+ rank, non_blocking=True
322
+ )
323
+ y, y_lengths = y.cuda(rank, non_blocking=True), y_lengths.cuda(
324
+ rank, non_blocking=True
325
+ )
326
+ speakers = speakers.cuda(rank, non_blocking=True)
327
+
328
+ with autocast(enabled=hps.train.fp16_run):
329
+ (
330
+ y_hat,
331
+ l_length,
332
+ attn,
333
+ ids_slice,
334
+ x_mask,
335
+ z_mask,
336
+ (z, z_p, m_p, logs_p, m_q, logs_q),
337
+ (hidden_x, logw, logw_),
338
+ ) = net_g(x, x_lengths, spec, spec_lengths, speakers)
339
+
340
+ if (
341
+ hps.model.use_mel_posterior_encoder
342
+ or hps.data.use_mel_posterior_encoder
343
+ ):
344
+ mel = spec
345
+ else:
346
+ mel = spec_to_mel_torch(
347
+ spec,
348
+ hps.data.filter_length,
349
+ hps.data.n_mel_channels,
350
+ hps.data.sampling_rate,
351
+ hps.data.mel_fmin,
352
+ hps.data.mel_fmax,
353
+ )
354
+ y_mel = commons.slice_segments(
355
+ mel, ids_slice, hps.train.segment_size // hps.data.hop_length
356
+ )
357
+ y_hat_mel = mel_spectrogram_torch(
358
+ y_hat.squeeze(1),
359
+ hps.data.filter_length,
360
+ hps.data.n_mel_channels,
361
+ hps.data.sampling_rate,
362
+ hps.data.hop_length,
363
+ hps.data.win_length,
364
+ hps.data.mel_fmin,
365
+ hps.data.mel_fmax,
366
+ )
367
+
368
+ y = commons.slice_segments(
369
+ y, ids_slice * hps.data.hop_length, hps.train.segment_size
370
+ ) # slice
371
+
372
+ # Discriminator
373
+ y_d_hat_r, y_d_hat_g, _, _ = net_d(y, y_hat.detach())
374
+ with autocast(enabled=False):
375
+ loss_disc, losses_disc_r, losses_disc_g = discriminator_loss(
376
+ y_d_hat_r, y_d_hat_g
377
+ )
378
+ loss_disc_all = loss_disc
379
+
380
+ # Duration Discriminator
381
+ if net_dur_disc is not None:
382
+ y_dur_hat_r, y_dur_hat_g = net_dur_disc(
383
+ hidden_x.detach(), x_mask.detach(), logw_.detach(), logw.detach()
384
+ )
385
+ with autocast(enabled=False):
386
+ # TODO: I think need to mean using the mask, but for now, just mean all
387
+ (
388
+ loss_dur_disc,
389
+ losses_dur_disc_r,
390
+ losses_dur_disc_g,
391
+ ) = discriminator_loss(y_dur_hat_r, y_dur_hat_g)
392
+ loss_dur_disc_all = loss_dur_disc
393
+ optim_dur_disc.zero_grad()
394
+ scaler.scale(loss_dur_disc_all).backward()
395
+ scaler.unscale_(optim_dur_disc)
396
+ grad_norm_dur_disc = commons.clip_grad_value_(
397
+ net_dur_disc.parameters(), None
398
+ )
399
+ scaler.step(optim_dur_disc)
400
+
401
+ optim_d.zero_grad()
402
+ scaler.scale(loss_disc_all).backward()
403
+ scaler.unscale_(optim_d)
404
+ grad_norm_d = commons.clip_grad_value_(net_d.parameters(), None)
405
+ scaler.step(optim_d)
406
+
407
+ with autocast(enabled=hps.train.fp16_run):
408
+ # Generator
409
+ y_d_hat_r, y_d_hat_g, fmap_r, fmap_g = net_d(y, y_hat)
410
+ if net_dur_disc is not None:
411
+ y_dur_hat_r, y_dur_hat_g = net_dur_disc(hidden_x, x_mask, logw_, logw)
412
+ with autocast(enabled=False):
413
+ loss_dur = torch.sum(l_length.float())
414
+ loss_mel = F.l1_loss(y_mel, y_hat_mel) * hps.train.c_mel
415
+ loss_kl = kl_loss(z_p, logs_q, m_p, logs_p, z_mask) * hps.train.c_kl
416
+
417
+ loss_fm = feature_loss(fmap_r, fmap_g)
418
+ loss_gen, losses_gen = generator_loss(y_d_hat_g)
419
+ loss_gen_all = loss_gen + loss_fm + loss_mel + loss_dur + loss_kl
420
+ if net_dur_disc is not None:
421
+ loss_dur_gen, losses_dur_gen = generator_loss(y_dur_hat_g)
422
+ loss_gen_all += loss_dur_gen
423
+
424
+ optim_g.zero_grad()
425
+ scaler.scale(loss_gen_all).backward()
426
+ scaler.unscale_(optim_g)
427
+ grad_norm_g = commons.clip_grad_value_(net_g.parameters(), None)
428
+ scaler.step(optim_g)
429
+ scaler.update()
430
+
431
+ if rank == 0:
432
+ if global_step % hps.train.log_interval == 0:
433
+ lr = optim_g.param_groups[0]["lr"]
434
+ losses = [loss_disc, loss_gen, loss_fm, loss_mel, loss_dur, loss_kl]
435
+ logger.info(
436
+ "Train Epoch: {} [{:.0f}%]".format(
437
+ epoch, 100.0 * batch_idx / len(train_loader)
438
+ )
439
+ )
440
+ logger.info([x.item() for x in losses] + [global_step, lr])
441
+
442
+ scalar_dict = {
443
+ "loss/g/total": loss_gen_all,
444
+ "loss/d/total": loss_disc_all,
445
+ "learning_rate": lr,
446
+ "grad_norm_d": grad_norm_d,
447
+ "grad_norm_g": grad_norm_g,
448
+ }
449
+ if net_dur_disc is not None:
450
+ scalar_dict.update(
451
+ {
452
+ "loss/dur_disc/total": loss_dur_disc_all,
453
+ "grad_norm_dur_disc": grad_norm_dur_disc,
454
+ }
455
+ )
456
+ scalar_dict.update(
457
+ {
458
+ "loss/g/fm": loss_fm,
459
+ "loss/g/mel": loss_mel,
460
+ "loss/g/dur": loss_dur,
461
+ "loss/g/kl": loss_kl,
462
+ }
463
+ )
464
+
465
+ scalar_dict.update(
466
+ {"loss/g/{}".format(i): v for i, v in enumerate(losses_gen)}
467
+ )
468
+ scalar_dict.update(
469
+ {"loss/d_r/{}".format(i): v for i, v in enumerate(losses_disc_r)}
470
+ )
471
+ scalar_dict.update(
472
+ {"loss/d_g/{}".format(i): v for i, v in enumerate(losses_disc_g)}
473
+ )
474
+
475
+ # if net_dur_disc is not None:
476
+ # scalar_dict.update({"loss/dur_disc_r" : f"{losses_dur_disc_r}"})
477
+ # scalar_dict.update({"loss/dur_disc_g" : f"{losses_dur_disc_g}"})
478
+ # scalar_dict.update({"loss/dur_gen" : f"{loss_dur_gen}"})
479
+
480
+ image_dict = {
481
+ "slice/mel_org": utils.plot_spectrogram_to_numpy(
482
+ y_mel[0].data.cpu().numpy()
483
+ ),
484
+ "slice/mel_gen": utils.plot_spectrogram_to_numpy(
485
+ y_hat_mel[0].data.cpu().numpy()
486
+ ),
487
+ "all/mel": utils.plot_spectrogram_to_numpy(
488
+ mel[0].data.cpu().numpy()
489
+ ),
490
+ "all/attn": utils.plot_alignment_to_numpy(
491
+ attn[0, 0].data.cpu().numpy()
492
+ ),
493
+ }
494
+ utils.summarize(
495
+ writer=writer,
496
+ global_step=global_step,
497
+ images=image_dict,
498
+ scalars=scalar_dict,
499
+ )
500
+
501
+ if global_step % hps.train.eval_interval == 0:
502
+ evaluate(hps, net_g, eval_loader, writer_eval)
503
+ utils.save_checkpoint(
504
+ net_g,
505
+ optim_g,
506
+ hps.train.learning_rate,
507
+ epoch,
508
+ os.path.join(hps.model_dir, "G_{}.pth".format(global_step)),
509
+ )
510
+ utils.save_checkpoint(
511
+ net_d,
512
+ optim_d,
513
+ hps.train.learning_rate,
514
+ epoch,
515
+ os.path.join(hps.model_dir, "D_{}.pth".format(global_step)),
516
+ )
517
+ if net_dur_disc is not None:
518
+ utils.save_checkpoint(
519
+ net_dur_disc,
520
+ optim_dur_disc,
521
+ hps.train.learning_rate,
522
+ epoch,
523
+ os.path.join(hps.model_dir, "DUR_{}.pth".format(global_step)),
524
+ )
525
+ global_step += 1
526
+
527
+ if rank == 0:
528
+ logger.info("====> Epoch: {}".format(epoch))
529
+
530
+
531
+ def evaluate(hps, generator, eval_loader, writer_eval):
532
+ generator.eval()
533
+ with torch.no_grad():
534
+ for batch_idx, (
535
+ x,
536
+ x_lengths,
537
+ spec,
538
+ spec_lengths,
539
+ y,
540
+ y_lengths,
541
+ speakers,
542
+ ) in enumerate(eval_loader):
543
+ x, x_lengths = x.cuda(0), x_lengths.cuda(0)
544
+ spec, spec_lengths = spec.cuda(0), spec_lengths.cuda(0)
545
+ y, y_lengths = y.cuda(0), y_lengths.cuda(0)
546
+ speakers = speakers.cuda(0)
547
+
548
+ # remove else
549
+ x = x[:1]
550
+ x_lengths = x_lengths[:1]
551
+ spec = spec[:1]
552
+ spec_lengths = spec_lengths[:1]
553
+ y = y[:1]
554
+ y_lengths = y_lengths[:1]
555
+ speakers = speakers[:1]
556
+ break
557
+ y_hat, attn, mask, *_ = generator.module.infer(
558
+ x, x_lengths, speakers, max_len=1000
559
+ )
560
+ y_hat_lengths = mask.sum([1, 2]).long() * hps.data.hop_length
561
+
562
+ if hps.model.use_mel_posterior_encoder or hps.data.use_mel_posterior_encoder:
563
+ mel = spec
564
+ else:
565
+ mel = spec_to_mel_torch(
566
+ spec,
567
+ hps.data.filter_length,
568
+ hps.data.n_mel_channels,
569
+ hps.data.sampling_rate,
570
+ hps.data.mel_fmin,
571
+ hps.data.mel_fmax,
572
+ )
573
+ y_hat_mel = mel_spectrogram_torch(
574
+ y_hat.squeeze(1).float(),
575
+ hps.data.filter_length,
576
+ hps.data.n_mel_channels,
577
+ hps.data.sampling_rate,
578
+ hps.data.hop_length,
579
+ hps.data.win_length,
580
+ hps.data.mel_fmin,
581
+ hps.data.mel_fmax,
582
+ )
583
+ image_dict = {
584
+ "gen/mel": utils.plot_spectrogram_to_numpy(y_hat_mel[0].cpu().numpy())
585
+ }
586
+ audio_dict = {"gen/audio": y_hat[0, :, : y_hat_lengths[0]]}
587
+ if global_step == 0:
588
+ image_dict.update(
589
+ {"gt/mel": utils.plot_spectrogram_to_numpy(mel[0].cpu().numpy())}
590
+ )
591
+ audio_dict.update({"gt/audio": y[0, :, : y_lengths[0]]})
592
+
593
+ utils.summarize(
594
+ writer=writer_eval,
595
+ global_step=global_step,
596
+ images=image_dict,
597
+ audios=audio_dict,
598
+ audio_sampling_rate=hps.data.sampling_rate,
599
+ )
600
+ generator.train()
601
+
602
+
603
+ if __name__ == "__main__":
604
+ main()
transforms.py ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch.nn import functional as F
3
+
4
+ import numpy as np
5
+
6
+
7
+ DEFAULT_MIN_BIN_WIDTH = 1e-3
8
+ DEFAULT_MIN_BIN_HEIGHT = 1e-3
9
+ DEFAULT_MIN_DERIVATIVE = 1e-3
10
+
11
+
12
+ def piecewise_rational_quadratic_transform(
13
+ inputs,
14
+ unnormalized_widths,
15
+ unnormalized_heights,
16
+ unnormalized_derivatives,
17
+ inverse=False,
18
+ tails=None,
19
+ tail_bound=1.0,
20
+ min_bin_width=DEFAULT_MIN_BIN_WIDTH,
21
+ min_bin_height=DEFAULT_MIN_BIN_HEIGHT,
22
+ min_derivative=DEFAULT_MIN_DERIVATIVE,
23
+ ):
24
+ if tails is None:
25
+ spline_fn = rational_quadratic_spline
26
+ spline_kwargs = {}
27
+ else:
28
+ spline_fn = unconstrained_rational_quadratic_spline
29
+ spline_kwargs = {"tails": tails, "tail_bound": tail_bound}
30
+
31
+ outputs, logabsdet = spline_fn(
32
+ inputs=inputs,
33
+ unnormalized_widths=unnormalized_widths,
34
+ unnormalized_heights=unnormalized_heights,
35
+ unnormalized_derivatives=unnormalized_derivatives,
36
+ inverse=inverse,
37
+ min_bin_width=min_bin_width,
38
+ min_bin_height=min_bin_height,
39
+ min_derivative=min_derivative,
40
+ **spline_kwargs
41
+ )
42
+ return outputs, logabsdet
43
+
44
+
45
+ def searchsorted(bin_locations, inputs, eps=1e-6):
46
+ bin_locations[..., -1] += eps
47
+ return torch.sum(inputs[..., None] >= bin_locations, dim=-1) - 1
48
+
49
+
50
+ def unconstrained_rational_quadratic_spline(
51
+ inputs,
52
+ unnormalized_widths,
53
+ unnormalized_heights,
54
+ unnormalized_derivatives,
55
+ inverse=False,
56
+ tails="linear",
57
+ tail_bound=1.0,
58
+ min_bin_width=DEFAULT_MIN_BIN_WIDTH,
59
+ min_bin_height=DEFAULT_MIN_BIN_HEIGHT,
60
+ min_derivative=DEFAULT_MIN_DERIVATIVE,
61
+ ):
62
+ inside_interval_mask = (inputs >= -tail_bound) & (inputs <= tail_bound)
63
+ outside_interval_mask = ~inside_interval_mask
64
+
65
+ outputs = torch.zeros_like(inputs)
66
+ logabsdet = torch.zeros_like(inputs)
67
+
68
+ if tails == "linear":
69
+ unnormalized_derivatives = F.pad(unnormalized_derivatives, pad=(1, 1))
70
+ constant = np.log(np.exp(1 - min_derivative) - 1)
71
+ unnormalized_derivatives[..., 0] = constant
72
+ unnormalized_derivatives[..., -1] = constant
73
+
74
+ outputs[outside_interval_mask] = inputs[outside_interval_mask]
75
+ logabsdet[outside_interval_mask] = 0
76
+ else:
77
+ raise RuntimeError("{} tails are not implemented.".format(tails))
78
+
79
+ (
80
+ outputs[inside_interval_mask],
81
+ logabsdet[inside_interval_mask],
82
+ ) = rational_quadratic_spline(
83
+ inputs=inputs[inside_interval_mask],
84
+ unnormalized_widths=unnormalized_widths[inside_interval_mask, :],
85
+ unnormalized_heights=unnormalized_heights[inside_interval_mask, :],
86
+ unnormalized_derivatives=unnormalized_derivatives[inside_interval_mask, :],
87
+ inverse=inverse,
88
+ left=-tail_bound,
89
+ right=tail_bound,
90
+ bottom=-tail_bound,
91
+ top=tail_bound,
92
+ min_bin_width=min_bin_width,
93
+ min_bin_height=min_bin_height,
94
+ min_derivative=min_derivative,
95
+ )
96
+
97
+ return outputs, logabsdet
98
+
99
+
100
+ def rational_quadratic_spline(
101
+ inputs,
102
+ unnormalized_widths,
103
+ unnormalized_heights,
104
+ unnormalized_derivatives,
105
+ inverse=False,
106
+ left=0.0,
107
+ right=1.0,
108
+ bottom=0.0,
109
+ top=1.0,
110
+ min_bin_width=DEFAULT_MIN_BIN_WIDTH,
111
+ min_bin_height=DEFAULT_MIN_BIN_HEIGHT,
112
+ min_derivative=DEFAULT_MIN_DERIVATIVE,
113
+ ):
114
+ if torch.min(inputs) < left or torch.max(inputs) > right:
115
+ raise ValueError("Input to a transform is not within its domain")
116
+
117
+ num_bins = unnormalized_widths.shape[-1]
118
+
119
+ if min_bin_width * num_bins > 1.0:
120
+ raise ValueError("Minimal bin width too large for the number of bins")
121
+ if min_bin_height * num_bins > 1.0:
122
+ raise ValueError("Minimal bin height too large for the number of bins")
123
+
124
+ widths = F.softmax(unnormalized_widths, dim=-1)
125
+ widths = min_bin_width + (1 - min_bin_width * num_bins) * widths
126
+ cumwidths = torch.cumsum(widths, dim=-1)
127
+ cumwidths = F.pad(cumwidths, pad=(1, 0), mode="constant", value=0.0)
128
+ cumwidths = (right - left) * cumwidths + left
129
+ cumwidths[..., 0] = left
130
+ cumwidths[..., -1] = right
131
+ widths = cumwidths[..., 1:] - cumwidths[..., :-1]
132
+
133
+ derivatives = min_derivative + F.softplus(unnormalized_derivatives)
134
+
135
+ heights = F.softmax(unnormalized_heights, dim=-1)
136
+ heights = min_bin_height + (1 - min_bin_height * num_bins) * heights
137
+ cumheights = torch.cumsum(heights, dim=-1)
138
+ cumheights = F.pad(cumheights, pad=(1, 0), mode="constant", value=0.0)
139
+ cumheights = (top - bottom) * cumheights + bottom
140
+ cumheights[..., 0] = bottom
141
+ cumheights[..., -1] = top
142
+ heights = cumheights[..., 1:] - cumheights[..., :-1]
143
+
144
+ if inverse:
145
+ bin_idx = searchsorted(cumheights, inputs)[..., None]
146
+ else:
147
+ bin_idx = searchsorted(cumwidths, inputs)[..., None]
148
+
149
+ input_cumwidths = cumwidths.gather(-1, bin_idx)[..., 0]
150
+ input_bin_widths = widths.gather(-1, bin_idx)[..., 0]
151
+
152
+ input_cumheights = cumheights.gather(-1, bin_idx)[..., 0]
153
+ delta = heights / widths
154
+ input_delta = delta.gather(-1, bin_idx)[..., 0]
155
+
156
+ input_derivatives = derivatives.gather(-1, bin_idx)[..., 0]
157
+ input_derivatives_plus_one = derivatives[..., 1:].gather(-1, bin_idx)[..., 0]
158
+
159
+ input_heights = heights.gather(-1, bin_idx)[..., 0]
160
+
161
+ if inverse:
162
+ a = (inputs - input_cumheights) * (
163
+ input_derivatives + input_derivatives_plus_one - 2 * input_delta
164
+ ) + input_heights * (input_delta - input_derivatives)
165
+ b = input_heights * input_derivatives - (inputs - input_cumheights) * (
166
+ input_derivatives + input_derivatives_plus_one - 2 * input_delta
167
+ )
168
+ c = -input_delta * (inputs - input_cumheights)
169
+
170
+ discriminant = b.pow(2) - 4 * a * c
171
+ assert (discriminant >= 0).all()
172
+
173
+ root = (2 * c) / (-b - torch.sqrt(discriminant))
174
+ outputs = root * input_bin_widths + input_cumwidths
175
+
176
+ theta_one_minus_theta = root * (1 - root)
177
+ denominator = input_delta + (
178
+ (input_derivatives + input_derivatives_plus_one - 2 * input_delta)
179
+ * theta_one_minus_theta
180
+ )
181
+ derivative_numerator = input_delta.pow(2) * (
182
+ input_derivatives_plus_one * root.pow(2)
183
+ + 2 * input_delta * theta_one_minus_theta
184
+ + input_derivatives * (1 - root).pow(2)
185
+ )
186
+ logabsdet = torch.log(derivative_numerator) - 2 * torch.log(denominator)
187
+
188
+ return outputs, -logabsdet
189
+ else:
190
+ theta = (inputs - input_cumwidths) / input_bin_widths
191
+ theta_one_minus_theta = theta * (1 - theta)
192
+
193
+ numerator = input_heights * (
194
+ input_delta * theta.pow(2) + input_derivatives * theta_one_minus_theta
195
+ )
196
+ denominator = input_delta + (
197
+ (input_derivatives + input_derivatives_plus_one - 2 * input_delta)
198
+ * theta_one_minus_theta
199
+ )
200
+ outputs = input_cumheights + numerator / denominator
201
+
202
+ derivative_numerator = input_delta.pow(2) * (
203
+ input_derivatives_plus_one * theta.pow(2)
204
+ + 2 * input_delta * theta_one_minus_theta
205
+ + input_derivatives * (1 - theta).pow(2)
206
+ )
207
+ logabsdet = torch.log(derivative_numerator) - 2 * torch.log(denominator)
208
+
209
+ return outputs, logabsdet
utils.py ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import glob
3
+ import sys
4
+ import argparse
5
+ import logging
6
+ import json
7
+ import subprocess
8
+ import numpy as np
9
+ from scipy.io.wavfile import read
10
+ import torch
11
+
12
+ MATPLOTLIB_FLAG = False
13
+
14
+ logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
15
+ logger = logging
16
+
17
+
18
+ def load_checkpoint(checkpoint_path, model, optimizer=None):
19
+ assert os.path.isfile(checkpoint_path)
20
+ checkpoint_dict = torch.load(checkpoint_path, map_location="cpu")
21
+ iteration = checkpoint_dict["iteration"]
22
+ learning_rate = checkpoint_dict["learning_rate"]
23
+ if optimizer is not None:
24
+ optimizer.load_state_dict(checkpoint_dict["optimizer"])
25
+ saved_state_dict = checkpoint_dict["model"]
26
+ if hasattr(model, "module"):
27
+ state_dict = model.module.state_dict()
28
+ else:
29
+ state_dict = model.state_dict()
30
+ new_state_dict = {}
31
+ for k, v in state_dict.items():
32
+ try:
33
+ new_state_dict[k] = saved_state_dict[k]
34
+ except:
35
+ logger.info("%s is not in the checkpoint" % k)
36
+ new_state_dict[k] = v
37
+ if hasattr(model, "module"):
38
+ model.module.load_state_dict(new_state_dict)
39
+ else:
40
+ model.load_state_dict(new_state_dict)
41
+ logger.info(
42
+ "Loaded checkpoint '{}' (iteration {})".format(checkpoint_path, iteration)
43
+ )
44
+ return model, optimizer, learning_rate, iteration
45
+
46
+
47
+ def save_checkpoint(model, optimizer, learning_rate, iteration, checkpoint_path):
48
+ logger.info(
49
+ "Saving model and optimizer state at iteration {} to {}".format(
50
+ iteration, checkpoint_path
51
+ )
52
+ )
53
+ if hasattr(model, "module"):
54
+ state_dict = model.module.state_dict()
55
+ else:
56
+ state_dict = model.state_dict()
57
+ torch.save(
58
+ {
59
+ "model": state_dict,
60
+ "iteration": iteration,
61
+ "optimizer": optimizer.state_dict(),
62
+ "learning_rate": learning_rate,
63
+ },
64
+ checkpoint_path,
65
+ )
66
+
67
+
68
+ def summarize(
69
+ writer,
70
+ global_step,
71
+ scalars={},
72
+ histograms={},
73
+ images={},
74
+ audios={},
75
+ audio_sampling_rate=22050,
76
+ ):
77
+ for k, v in scalars.items():
78
+ writer.add_scalar(k, v, global_step)
79
+ for k, v in histograms.items():
80
+ writer.add_histogram(k, v, global_step)
81
+ for k, v in images.items():
82
+ writer.add_image(k, v, global_step, dataformats="HWC")
83
+ for k, v in audios.items():
84
+ writer.add_audio(k, v, global_step, audio_sampling_rate)
85
+
86
+
87
+ def latest_checkpoint_path(dir_path, regex="G_*.pth"):
88
+ f_list = glob.glob(os.path.join(dir_path, regex))
89
+ f_list.sort(key=lambda f: int("".join(filter(str.isdigit, f))))
90
+ x = f_list[-1]
91
+ print(x)
92
+ return x
93
+
94
+
95
+ def plot_spectrogram_to_numpy(spectrogram):
96
+ global MATPLOTLIB_FLAG
97
+ if not MATPLOTLIB_FLAG:
98
+ import matplotlib
99
+
100
+ matplotlib.use("Agg")
101
+ MATPLOTLIB_FLAG = True
102
+ mpl_logger = logging.getLogger("matplotlib")
103
+ mpl_logger.setLevel(logging.WARNING)
104
+ import matplotlib.pylab as plt
105
+ import numpy as np
106
+
107
+ fig, ax = plt.subplots(figsize=(10, 2))
108
+ im = ax.imshow(spectrogram, aspect="auto", origin="lower", interpolation="none")
109
+ plt.colorbar(im, ax=ax)
110
+ plt.xlabel("Frames")
111
+ plt.ylabel("Channels")
112
+ plt.tight_layout()
113
+
114
+ fig.canvas.draw()
115
+ data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep="")
116
+ data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
117
+ plt.close()
118
+ return data
119
+
120
+
121
+ def plot_alignment_to_numpy(alignment, info=None):
122
+ global MATPLOTLIB_FLAG
123
+ if not MATPLOTLIB_FLAG:
124
+ import matplotlib
125
+
126
+ matplotlib.use("Agg")
127
+ MATPLOTLIB_FLAG = True
128
+ mpl_logger = logging.getLogger("matplotlib")
129
+ mpl_logger.setLevel(logging.WARNING)
130
+ import matplotlib.pylab as plt
131
+ import numpy as np
132
+
133
+ fig, ax = plt.subplots(figsize=(6, 4))
134
+ im = ax.imshow(
135
+ alignment.transpose(), aspect="auto", origin="lower", interpolation="none"
136
+ )
137
+ fig.colorbar(im, ax=ax)
138
+ xlabel = "Decoder timestep"
139
+ if info is not None:
140
+ xlabel += "\n\n" + info
141
+ plt.xlabel(xlabel)
142
+ plt.ylabel("Encoder timestep")
143
+ plt.tight_layout()
144
+
145
+ fig.canvas.draw()
146
+ data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep="")
147
+ data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
148
+ plt.close()
149
+ return data
150
+
151
+
152
+ def load_wav_to_torch(full_path):
153
+ sampling_rate, data = read(full_path)
154
+ return torch.FloatTensor(data.astype(np.float32)), sampling_rate
155
+
156
+
157
+ def load_filepaths_and_text(filename, split="|"):
158
+ with open(filename, encoding="utf-8") as f:
159
+ filepaths_and_text = [line.strip().split(split) for line in f]
160
+ return filepaths_and_text
161
+
162
+
163
+ def get_hparams(init=True):
164
+ parser = argparse.ArgumentParser()
165
+ parser.add_argument(
166
+ "-c",
167
+ "--config",
168
+ type=str,
169
+ default="./configs/base.json",
170
+ help="JSON file for configuration",
171
+ )
172
+ parser.add_argument("-m", "--model", type=str, required=True, help="Model name")
173
+
174
+ args = parser.parse_args()
175
+ model_dir = os.path.join("./logs", args.model)
176
+
177
+ if not os.path.exists(model_dir):
178
+ os.makedirs(model_dir)
179
+
180
+ config_path = args.config
181
+ config_save_path = os.path.join(model_dir, "config.json")
182
+ if init:
183
+ with open(config_path, "r") as f:
184
+ data = f.read()
185
+ with open(config_save_path, "w") as f:
186
+ f.write(data)
187
+ else:
188
+ with open(config_save_path, "r") as f:
189
+ data = f.read()
190
+ config = json.loads(data)
191
+
192
+ hparams = HParams(**config)
193
+ hparams.model_dir = model_dir
194
+ return hparams
195
+
196
+
197
+ def get_hparams_from_dir(model_dir):
198
+ config_save_path = os.path.join(model_dir, "config.json")
199
+ with open(config_save_path, "r") as f:
200
+ data = f.read()
201
+ config = json.loads(data)
202
+
203
+ hparams = HParams(**config)
204
+ hparams.model_dir = model_dir
205
+ return hparams
206
+
207
+
208
+ def get_hparams_from_file(config_path):
209
+ with open(config_path, "r") as f:
210
+ data = f.read()
211
+ config = json.loads(data)
212
+
213
+ hparams = HParams(**config)
214
+ return hparams
215
+
216
+
217
+ def check_git_hash(model_dir):
218
+ source_dir = os.path.dirname(os.path.realpath(__file__))
219
+ if not os.path.exists(os.path.join(source_dir, ".git")):
220
+ logger.warn(
221
+ "{} is not a git repository, therefore hash value comparison will be ignored.".format(
222
+ source_dir
223
+ )
224
+ )
225
+ return
226
+
227
+ cur_hash = subprocess.getoutput("git rev-parse HEAD")
228
+
229
+ path = os.path.join(model_dir, "githash")
230
+ if os.path.exists(path):
231
+ saved_hash = open(path).read()
232
+ if saved_hash != cur_hash:
233
+ logger.warn(
234
+ "git hash values are different. {}(saved) != {}(current)".format(
235
+ saved_hash[:8], cur_hash[:8]
236
+ )
237
+ )
238
+ else:
239
+ open(path, "w").write(cur_hash)
240
+
241
+
242
+ def get_logger(model_dir, filename="train.log"):
243
+ global logger
244
+ logger = logging.getLogger(os.path.basename(model_dir))
245
+ logger.setLevel(logging.DEBUG)
246
+
247
+ formatter = logging.Formatter("%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s")
248
+ if not os.path.exists(model_dir):
249
+ os.makedirs(model_dir)
250
+ h = logging.FileHandler(os.path.join(model_dir, filename))
251
+ h.setLevel(logging.DEBUG)
252
+ h.setFormatter(formatter)
253
+ logger.addHandler(h)
254
+ return logger
255
+
256
+
257
+ class HParams:
258
+ def __init__(self, **kwargs):
259
+ for k, v in kwargs.items():
260
+ if type(v) == dict:
261
+ v = HParams(**v)
262
+ self[k] = v
263
+
264
+ def keys(self):
265
+ return self.__dict__.keys()
266
+
267
+ def items(self):
268
+ return self.__dict__.items()
269
+
270
+ def values(self):
271
+ return self.__dict__.values()
272
+
273
+ def __len__(self):
274
+ return len(self.__dict__)
275
+
276
+ def __getitem__(self, key):
277
+ return getattr(self, key)
278
+
279
+ def __setitem__(self, key, value):
280
+ return setattr(self, key, value)
281
+
282
+ def __contains__(self, key):
283
+ return key in self.__dict__
284
+
285
+ def __repr__(self):
286
+ return self.__dict__.__repr__()
webui.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import gradio as gr
3
+ from gradio import components
4
+ import os
5
+ import torch
6
+ import commons
7
+ import utils
8
+ from models import SynthesizerTrn
9
+ from text.symbols import symbols
10
+ from text import text_to_sequence
11
+ from scipy.io.wavfile import write
12
+
13
+ def get_text(text, hps):
14
+ text_norm = text_to_sequence(text, hps.data.text_cleaners)
15
+ if hps.data.add_blank:
16
+ text_norm = commons.intersperse(text_norm, 0)
17
+ text_norm = torch.LongTensor(text_norm)
18
+ return text_norm
19
+
20
+ def tts(model_path, config_path, text):
21
+ model_path = './logs/' + model_path
22
+ config_path = './configs/' + config_path
23
+ hps = utils.get_hparams_from_file(config_path)
24
+
25
+ if "use_mel_posterior_encoder" in hps.model.keys() and hps.model.use_mel_posterior_encoder == True:
26
+ posterior_channels = 80
27
+ hps.data.use_mel_posterior_encoder = True
28
+ else:
29
+ posterior_channels = hps.data.filter_length // 2 + 1
30
+ hps.data.use_mel_posterior_encoder = False
31
+
32
+ net_g = SynthesizerTrn(
33
+ len(symbols),
34
+ posterior_channels,
35
+ hps.train.segment_size // hps.data.hop_length,
36
+ **hps.model).cuda()
37
+ _ = net_g.eval()
38
+ _ = utils.load_checkpoint(model_path, net_g, None)
39
+
40
+ stn_tst = get_text(text, hps)
41
+ x_tst = stn_tst.cuda().unsqueeze(0)
42
+ x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).cuda()
43
+
44
+ with torch.no_grad():
45
+ audio = net_g.infer(x_tst, x_tst_lengths, noise_scale=.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy()
46
+
47
+ output_wav_path = "output.wav"
48
+ write(output_wav_path, hps.data.sampling_rate, audio)
49
+
50
+ return output_wav_path
51
+
52
+ if __name__ == "__main__":
53
+ parser = argparse.ArgumentParser()
54
+ parser.add_argument('--model_path', type=str, default=None, help='Path to the model file.')
55
+ parser.add_argument('--config_path', type=str, default=None, help='Path to the config file.')
56
+ args = parser.parse_args()
57
+
58
+ model_files = [f for f in os.listdir('./logs/') if f.endswith('.pth')]
59
+ model_files.sort(key=lambda x: int(x.split('_')[-1].split('.')[0]), reverse=True)
60
+ config_files = [f for f in os.listdir('./configs/') if f.endswith('.json')]
61
+
62
+ default_model_file = args.model_path if args.model_path else (model_files[0] if model_files else None)
63
+ default_config_file = args.config_path if args.config_path else 'config.json'
64
+
65
+ gr.Interface(
66
+ fn=tts,
67
+ inputs=[components.Dropdown(model_files,value=default_model_file, label="Model File"), components.Dropdown(config_files,value=default_config_file, label="Config File"), components.Textbox(label="Text Input")],
68
+ outputs=components.Audio(type='filepath', label="Generated Speech"),
69
+ live=False
70
+ ).launch()