Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,8 @@ import models
|
|
20 |
from text import text_to_sequence, _clean_text
|
21 |
from text.symbols import symbols
|
22 |
from mel_processing import spectrogram_torch
|
|
|
|
|
23 |
|
24 |
language_marks = {
|
25 |
"Japanese": "",
|
@@ -122,23 +124,23 @@ models_info = [
|
|
122 |
若需要在同一个句子中混合多种语言,使用相应的语言标记包裹句子。
|
123 |
(日语用[JA], 中文用[ZH], 英文用[EN]),参考Examples中的示例。
|
124 |
""",
|
125 |
-
"model_path": "./pretrained_models/
|
126 |
"config_path": "./configs/uma_trilingual.json",
|
127 |
"examples": [['你好,训练员先生,很高兴见到你。', '草上飞 Grass Wonder (Umamusume Pretty Derby)', '简体中文', 1, False],
|
128 |
['To be honest, I have no idea what to say as examples.', '派蒙 Paimon (Genshin Impact)', 'English',
|
129 |
1, False],
|
130 |
['授業中に出しだら,学校生活終わるですわ。', '綾地 寧々 Ayachi Nene (Sanoba Witch)', '日本語', 1, False],
|
131 |
['[JA]こんにちわ。[JA][ZH]你好![ZH][EN]Hello![EN]', '綾地 寧々 Ayachi Nene (Sanoba Witch)', 'Mix', 1, False]],
|
132 |
-
"
|
133 |
},
|
134 |
{
|
135 |
"title": "Japanese",
|
136 |
"languages": ["Japanese"],
|
137 |
"description": """
|
138 |
-
This model contains 87 characters from Umamusume: Pretty Derby, Japanese only
|
139 |
-
这个模型包含赛马娘的所有87
|
140 |
""",
|
141 |
-
"model_path": "./pretrained_models/
|
142 |
"config_path": "./configs/uma87.json",
|
143 |
"examples": [['お疲れ様です,トレーナーさん。', '无声铃鹿 Silence Suzuka (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
144 |
['張り切っていこう!', '北部玄驹 Kitasan Black (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
@@ -146,7 +148,7 @@ models_info = [
|
|
146 |
['授業中に出しだら,学校生活終わるですわ。', '目白麦昆 Mejiro Mcqueen (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
147 |
['お帰りなさい,お兄様!', '米浴 Rice Shower (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
148 |
['私の処女をもらっでください!', '米浴 Rice Shower (Umamusume Pretty Derby)', 'Japanese', 1, False]],
|
149 |
-
"
|
150 |
},
|
151 |
]
|
152 |
|
@@ -160,23 +162,16 @@ if __name__ == "__main__":
|
|
160 |
examples = info['examples']
|
161 |
config_path = info['config_path']
|
162 |
model_path = info['model_path']
|
163 |
-
type = info['type']
|
164 |
description = info['description']
|
|
|
165 |
hps = utils.get_hparams_from_file(config_path)
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
else:
|
174 |
-
model = models.SynthesizerTrn(
|
175 |
-
len(hps.symbols),
|
176 |
-
hps.data.filter_length // 2 + 1,
|
177 |
-
hps.train.segment_size // hps.data.hop_length,
|
178 |
-
n_speakers=hps.data.n_speakers,
|
179 |
-
**hps.model)
|
180 |
utils.load_checkpoint(model_path, model, None)
|
181 |
model.eval()
|
182 |
speaker_ids = hps.speakers
|
|
|
20 |
from text import text_to_sequence, _clean_text
|
21 |
from text.symbols import symbols
|
22 |
from mel_processing import spectrogram_torch
|
23 |
+
import psutil
|
24 |
+
from datetime import datetime
|
25 |
|
26 |
language_marks = {
|
27 |
"Japanese": "",
|
|
|
124 |
若需要在同一个句子中混合多种语言,使用相应的语言标记包裹句子。
|
125 |
(日语用[JA], 中文用[ZH], 英文用[EN]),参考Examples中的示例。
|
126 |
""",
|
127 |
+
"model_path": "./pretrained_models/G_trilingual.pth",
|
128 |
"config_path": "./configs/uma_trilingual.json",
|
129 |
"examples": [['你好,训练员先生,很高兴见到你。', '草上飞 Grass Wonder (Umamusume Pretty Derby)', '简体中文', 1, False],
|
130 |
['To be honest, I have no idea what to say as examples.', '派蒙 Paimon (Genshin Impact)', 'English',
|
131 |
1, False],
|
132 |
['授業中に出しだら,学校生活終わるですわ。', '綾地 寧々 Ayachi Nene (Sanoba Witch)', '日本語', 1, False],
|
133 |
['[JA]こんにちわ。[JA][ZH]你好![ZH][EN]Hello![EN]', '綾地 寧々 Ayachi Nene (Sanoba Witch)', 'Mix', 1, False]],
|
134 |
+
"onnx_dir": "./ONNX_net/G_trilingual/"
|
135 |
},
|
136 |
{
|
137 |
"title": "Japanese",
|
138 |
"languages": ["Japanese"],
|
139 |
"description": """
|
140 |
+
This model contains 87 characters from Umamusume: Pretty Derby, Japanese only.\n\n
|
141 |
+
这个模型包含赛马娘的所有87名角色,只能合成日语。
|
142 |
""",
|
143 |
+
"model_path": "./pretrained_models/G_jp.pth",
|
144 |
"config_path": "./configs/uma87.json",
|
145 |
"examples": [['お疲れ様です,トレーナーさん。', '无声铃鹿 Silence Suzuka (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
146 |
['張り切っていこう!', '北部玄驹 Kitasan Black (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
|
|
148 |
['授業中に出しだら,学校生活終わるですわ。', '目白麦昆 Mejiro Mcqueen (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
149 |
['お帰りなさい,お兄様!', '米浴 Rice Shower (Umamusume Pretty Derby)', 'Japanese', 1, False],
|
150 |
['私の処女をもらっでください!', '米浴 Rice Shower (Umamusume Pretty Derby)', 'Japanese', 1, False]],
|
151 |
+
"onnx_dir": "./ONNX_net/G_jp/"
|
152 |
},
|
153 |
]
|
154 |
|
|
|
162 |
examples = info['examples']
|
163 |
config_path = info['config_path']
|
164 |
model_path = info['model_path']
|
|
|
165 |
description = info['description']
|
166 |
+
onnx_dir = info["onnx_dir"]
|
167 |
hps = utils.get_hparams_from_file(config_path)
|
168 |
+
model = ONNXVITS_infer.SynthesizerTrn(
|
169 |
+
len(hps.symbols),
|
170 |
+
hps.data.filter_length // 2 + 1,
|
171 |
+
hps.train.segment_size // hps.data.hop_length,
|
172 |
+
n_speakers=hps.data.n_speakers,
|
173 |
+
ONNX_dir=onnx_dir,
|
174 |
+
**hps.model)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
utils.load_checkpoint(model_path, model, None)
|
176 |
model.eval()
|
177 |
speaker_ids = hps.speakers
|