TheStinger commited on
Commit
43af790
1 Parent(s): a6c3559

Upload 9 files

Browse files
Files changed (9) hide show
  1. .gitattributes +36 -2
  2. app.py +354 -1884
  3. gitattributes +36 -0
  4. model.index +3 -0
  5. model.pth +3 -0
  6. packages.txt +1 -3
  7. requirements.txt +10 -23
  8. test.ogg +0 -0
  9. tts_voice.py +230 -0
.gitattributes CHANGED
@@ -1,2 +1,36 @@
1
- ilariasuitewallpaper.jpg filter=lfs diff=lfs merge=lfs -text
2
- ilariaaisuite.png filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
+ model.index filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,1884 +1,354 @@
1
- import subprocess, torch, os, traceback, sys, warnings, shutil, numpy as np
2
- from mega import Mega
3
- os.environ["no_proxy"] = "localhost, 127.0.0.1, ::1"
4
- import threading
5
- from time import sleep
6
- from subprocess import Popen
7
- import faiss
8
- import spaces
9
- from random import shuffle
10
- import json, datetime, requests
11
- from gtts import gTTS
12
- now_dir = os.getcwd()
13
- sys.path.append(now_dir)
14
- tmp = os.path.join(now_dir, "TEMP")
15
- shutil.rmtree(tmp, ignore_errors=True)
16
- shutil.rmtree("%s/runtime/Lib/site-packages/infer_pack" % (now_dir), ignore_errors=True)
17
- os.makedirs(tmp, exist_ok=True)
18
- os.makedirs(os.path.join(now_dir, "logs"), exist_ok=True)
19
- os.makedirs(os.path.join(now_dir, "weights"), exist_ok=True)
20
- os.environ["TEMP"] = tmp
21
- warnings.filterwarnings("ignore")
22
- torch.manual_seed(114514)
23
- from i18n import I18nAuto
24
-
25
- import edge_tts, asyncio
26
- from ilariatts import tts_order_voice
27
- language_dict = tts_order_voice
28
- ilariavoices = language_dict.keys()
29
-
30
- import signal
31
-
32
- import math
33
-
34
- from utils import load_audio, CSVutil
35
-
36
- global DoFormant, Quefrency, Timbre
37
-
38
- if not os.path.isdir('csvdb/'):
39
- os.makedirs('csvdb')
40
- frmnt, stp = open("csvdb/formanting.csv", 'w'), open("csvdb/stop.csv", 'w')
41
- frmnt.close()
42
- stp.close()
43
-
44
- try:
45
- DoFormant, Quefrency, Timbre = CSVutil('csvdb/formanting.csv', 'r', 'formanting')
46
- DoFormant = (
47
- lambda DoFormant: True if DoFormant.lower() == 'true' else (False if DoFormant.lower() == 'false' else DoFormant)
48
- )(DoFormant)
49
- except (ValueError, TypeError, IndexError):
50
- DoFormant, Quefrency, Timbre = False, 1.0, 1.0
51
- CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, Quefrency, Timbre)
52
-
53
- def download_models():
54
- # Download hubert base model if not present
55
- if not os.path.isfile('./hubert_base.pt'):
56
- response = requests.get('https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/hubert_base.pt')
57
-
58
- if response.status_code == 200:
59
- with open('./hubert_base.pt', 'wb') as f:
60
- f.write(response.content)
61
- print("Downloaded hubert base model file successfully. File saved to ./hubert_base.pt.")
62
- else:
63
- raise Exception("Failed to download hubert base model file. Status code: " + str(response.status_code) + ".")
64
-
65
- # Download rmvpe model if not present
66
- if not os.path.isfile('./rmvpe.pt'):
67
- response = requests.get('https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/rmvpe.pt?download=true')
68
-
69
- if response.status_code == 200:
70
- with open('./rmvpe.pt', 'wb') as f:
71
- f.write(response.content)
72
- print("Downloaded rmvpe model file successfully. File saved to ./rmvpe.pt.")
73
- else:
74
- raise Exception("Failed to download rmvpe model file. Status code: " + str(response.status_code) + ".")
75
-
76
- download_models()
77
-
78
- print("\n-------------------------------\nRVC v2 Easy GUI (Local Edition)\n-------------------------------\n")
79
-
80
- def formant_apply(qfrency, tmbre):
81
- Quefrency = qfrency
82
- Timbre = tmbre
83
- DoFormant = True
84
- CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, qfrency, tmbre)
85
-
86
- return ({"value": Quefrency, "__type__": "update"}, {"value": Timbre, "__type__": "update"})
87
-
88
- def get_fshift_presets():
89
- fshift_presets_list = []
90
- for dirpath, _, filenames in os.walk("./formantshiftcfg/"):
91
- for filename in filenames:
92
- if filename.endswith(".txt"):
93
- fshift_presets_list.append(os.path.join(dirpath,filename).replace('\\','/'))
94
-
95
- if len(fshift_presets_list) > 0:
96
- return fshift_presets_list
97
- else:
98
- return ''
99
-
100
-
101
-
102
- def formant_enabled(cbox, qfrency, tmbre, frmntapply, formantpreset, formant_refresh_button):
103
-
104
- if (cbox):
105
-
106
- DoFormant = True
107
- CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, qfrency, tmbre)
108
- #print(f"is checked? - {cbox}\ngot {DoFormant}")
109
-
110
- return (
111
- {"value": True, "__type__": "update"},
112
- {"visible": True, "__type__": "update"},
113
- {"visible": True, "__type__": "update"},
114
- {"visible": True, "__type__": "update"},
115
- {"visible": True, "__type__": "update"},
116
- {"visible": True, "__type__": "update"},
117
- )
118
-
119
-
120
- else:
121
-
122
- DoFormant = False
123
- CSVutil('csvdb/formanting.csv', 'w+', 'formanting', DoFormant, qfrency, tmbre)
124
-
125
- #print(f"is checked? - {cbox}\ngot {DoFormant}")
126
- return (
127
- {"value": False, "__type__": "update"},
128
- {"visible": False, "__type__": "update"},
129
- {"visible": False, "__type__": "update"},
130
- {"visible": False, "__type__": "update"},
131
- {"visible": False, "__type__": "update"},
132
- {"visible": False, "__type__": "update"},
133
- {"visible": False, "__type__": "update"},
134
- )
135
-
136
-
137
-
138
- def preset_apply(preset, qfer, tmbr):
139
- if str(preset) != '':
140
- with open(str(preset), 'r') as p:
141
- content = p.readlines()
142
- qfer, tmbr = content[0].split('\n')[0], content[1]
143
-
144
- formant_apply(qfer, tmbr)
145
- else:
146
- pass
147
- return ({"value": qfer, "__type__": "update"}, {"value": tmbr, "__type__": "update"})
148
-
149
- def update_fshift_presets(preset, qfrency, tmbre):
150
-
151
- qfrency, tmbre = preset_apply(preset, qfrency, tmbre)
152
-
153
- if (str(preset) != ''):
154
- with open(str(preset), 'r') as p:
155
- content = p.readlines()
156
- qfrency, tmbre = content[0].split('\n')[0], content[1]
157
-
158
- formant_apply(qfrency, tmbre)
159
- else:
160
- pass
161
- return (
162
- {"choices": get_fshift_presets(), "__type__": "update"},
163
- {"value": qfrency, "__type__": "update"},
164
- {"value": tmbre, "__type__": "update"},
165
- )
166
-
167
- i18n = I18nAuto()
168
- #i18n.print()
169
- # 判断是否有能用来训练和加速推理的N卡
170
- ngpu = torch.cuda.device_count()
171
- gpu_infos = []
172
- mem = []
173
- if (not torch.cuda.is_available()) or ngpu == 0:
174
- if_gpu_ok = False
175
- else:
176
- if_gpu_ok = False
177
- for i in range(ngpu):
178
- gpu_name = torch.cuda.get_device_name(i)
179
- if (
180
- "10" in gpu_name
181
- or "16" in gpu_name
182
- or "20" in gpu_name
183
- or "30" in gpu_name
184
- or "40" in gpu_name
185
- or "A2" in gpu_name.upper()
186
- or "A3" in gpu_name.upper()
187
- or "A4" in gpu_name.upper()
188
- or "P4" in gpu_name.upper()
189
- or "A50" in gpu_name.upper()
190
- or "A60" in gpu_name.upper()
191
- or "70" in gpu_name
192
- or "80" in gpu_name
193
- or "90" in gpu_name
194
- or "M4" in gpu_name.upper()
195
- or "T4" in gpu_name.upper()
196
- or "TITAN" in gpu_name.upper()
197
- ): # A10#A100#V100#A40#P40#M40#K80#A4500
198
- if_gpu_ok = True # 至少有一张能用的N卡
199
- gpu_infos.append("%s\t%s" % (i, gpu_name))
200
- mem.append(
201
- int(
202
- torch.cuda.get_device_properties(i).total_memory
203
- / 1024
204
- / 1024
205
- / 1024
206
- + 0.4
207
- )
208
- )
209
- if if_gpu_ok == True and len(gpu_infos) > 0:
210
- gpu_info = "\n".join(gpu_infos)
211
- default_batch_size = min(mem) // 2
212
- else:
213
- gpu_info = i18n("很遗憾您这没有能用的显卡来支持您训练")
214
- default_batch_size = 1
215
- gpus = "-".join([i[0] for i in gpu_infos])
216
- from lib.infer_pack.models import (
217
- SynthesizerTrnMs256NSFsid,
218
- SynthesizerTrnMs256NSFsid_nono,
219
- SynthesizerTrnMs768NSFsid,
220
- SynthesizerTrnMs768NSFsid_nono,
221
- )
222
- import soundfile as sf
223
- import gradio as gr
224
- import logging
225
- from vc_infer_pipeline import VC
226
- from config import Config
227
- import torch.nn as nn
228
- import numpy as np
229
-
230
- config = Config()
231
- # from trainset_preprocess_pipeline import PreProcess
232
- logging.getLogger("numba").setLevel(logging.WARNING)
233
-
234
-
235
- class HuBERT(nn.Module):
236
- def __init__(self, model_path):
237
- super(HuBERT, self).__init__()
238
- self.model = torch.hub.load('pytorch/fairseq', 'hubert_base') # should load without using hubert_base.pt, and without fairseq.
239
-
240
- def extract_features(self, waveform):
241
- return self.model.extract_features(waveform)
242
-
243
- def load_hubert():
244
- model_path = "hubert_base.pt" # Your model path
245
- hubert_model = HuBERT(model_path)
246
- return hubert_model
247
-
248
- hubert_model = load_hubert()
249
-
250
- weight_root = "weights"
251
- index_root = "logs"
252
- names = []
253
- for name in os.listdir(weight_root):
254
- if name.endswith(".pth"):
255
- names.append(name)
256
- index_paths = []
257
- for root, dirs, files in os.walk(index_root, topdown=False):
258
- for name in files:
259
- if name.endswith(".index") and "trained" not in name:
260
- index_paths.append("%s/%s" % (root, name))
261
-
262
-
263
-
264
- def vc_single(
265
- sid,
266
- input_audio_path,
267
- f0_up_key,
268
- f0_file,
269
- f0_method,
270
- file_index,
271
- #file_index2,
272
- # file_big_npy,
273
- index_rate,
274
- filter_radius,
275
- resample_sr,
276
- rms_mix_rate,
277
- protect,
278
- crepe_hop_length,
279
- ): # spk_item, input_audio0, vc_transform0,f0_file,f0method0
280
- global tgt_sr, net_g, vc, hubert_model, version
281
- if input_audio_path is None:
282
- return "You need to upload an audio", None
283
- f0_up_key = int(f0_up_key)
284
- try:
285
- audio = load_audio(input_audio_path, 16000, DoFormant, Quefrency, Timbre)
286
- audio_max = np.abs(audio).max() / 0.95
287
- if audio_max > 1:
288
- audio /= audio_max
289
- times = [0, 0, 0]
290
- if hubert_model == None:
291
- load_hubert()
292
- if_f0 = cpt.get("f0", 1)
293
- file_index = (
294
- (
295
- file_index.strip(" ")
296
- .strip('"')
297
- .strip("\n")
298
- .strip('"')
299
- .strip(" ")
300
- .replace("trained", "added")
301
- )
302
- ) # 防止小白写错,自动帮他替换掉
303
- # file_big_npy = (
304
- # file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
305
- # )
306
- audio_opt = vc.pipeline(
307
- hubert_model,
308
- net_g,
309
- sid,
310
- audio,
311
- input_audio_path,
312
- times,
313
- f0_up_key,
314
- f0_method,
315
- file_index,
316
- # file_big_npy,
317
- index_rate,
318
- if_f0,
319
- filter_radius,
320
- tgt_sr,
321
- resample_sr,
322
- rms_mix_rate,
323
- version,
324
- protect,
325
- crepe_hop_length,
326
- f0_file=f0_file,
327
- )
328
- if resample_sr >= 16000 and tgt_sr != resample_sr:
329
- tgt_sr = resample_sr
330
- index_info = (
331
- "Using index:%s." % file_index
332
- if os.path.exists(file_index)
333
- else "Index not used."
334
- )
335
- return "Success.\n %s\nTime:\n npy:%ss, f0:%ss, infer:%ss" % (
336
- index_info,
337
- times[0],
338
- times[1],
339
- times[2],
340
- ), (tgt_sr, audio_opt)
341
- except:
342
- info = traceback.format_exc()
343
- print(info)
344
- return info, (None, None)
345
-
346
- @spaces.GPU(duration=60 * 2)
347
-
348
- def vc_multi(
349
- sid,
350
- dir_path,
351
- opt_root,
352
- paths,
353
- f0_up_key,
354
- f0_method,
355
- file_index,
356
- file_index2,
357
- # file_big_npy,
358
- index_rate,
359
- filter_radius,
360
- resample_sr,
361
- rms_mix_rate,
362
- protect,
363
- format1,
364
- crepe_hop_length,
365
- ):
366
- try:
367
- dir_path = (
368
- dir_path.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
369
- ) # 防止小白拷路径头尾带了空格和"和回车
370
- opt_root = opt_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
371
- os.makedirs(opt_root, exist_ok=True)
372
- try:
373
- if dir_path != "":
374
- paths = [os.path.join(dir_path, name) for name in os.listdir(dir_path)]
375
- else:
376
- paths = [path.name for path in paths]
377
- except:
378
- traceback.print_exc()
379
- paths = [path.name for path in paths]
380
- infos = []
381
- for path in paths:
382
- info, opt = vc_single(
383
- sid,
384
- path,
385
- f0_up_key,
386
- None,
387
- f0_method,
388
- file_index,
389
- # file_big_npy,
390
- index_rate,
391
- filter_radius,
392
- resample_sr,
393
- rms_mix_rate,
394
- protect,
395
- crepe_hop_length
396
- )
397
- if "Success" in info:
398
- try:
399
- tgt_sr, audio_opt = opt
400
- if format1 in ["wav", "flac"]:
401
- sf.write(
402
- "%s/%s.%s" % (opt_root, os.path.basename(path), format1),
403
- audio_opt,
404
- tgt_sr,
405
- )
406
- else:
407
- path = "%s/%s.wav" % (opt_root, os.path.basename(path))
408
- sf.write(
409
- path,
410
- audio_opt,
411
- tgt_sr,
412
- )
413
- if os.path.exists(path):
414
- os.system(
415
- "ffmpeg -i %s -vn %s -q:a 2 -y"
416
- % (path, path[:-4] + ".%s" % format1)
417
- )
418
- except:
419
- info += traceback.format_exc()
420
- infos.append("%s->%s" % (os.path.basename(path), info))
421
- yield "\n".join(infos)
422
- yield "\n".join(infos)
423
- except:
424
- yield traceback.format_exc()
425
-
426
- # 一个选项卡全局只能有一个音色
427
- def get_vc(sid):
428
- global n_spk, tgt_sr, net_g, vc, cpt, version
429
- if sid == "" or sid == []:
430
- global hubert_model
431
- if hubert_model != None: # 考虑到轮询, 需要加个判断看是否 sid 是由有模型切换到无模型的
432
- print("clean_empty_cache")
433
- del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
434
- hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
435
- if torch.cuda.is_available():
436
- torch.cuda.empty_cache()
437
- ###楼下不这么折腾清理不干净
438
- if_f0 = cpt.get("f0", 1)
439
- version = cpt.get("version", "v1")
440
- if version == "v1":
441
- if if_f0 == 1:
442
- net_g = SynthesizerTrnMs256NSFsid(
443
- *cpt["config"], is_half=config.is_half
444
- )
445
- else:
446
- net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
447
- elif version == "v2":
448
- if if_f0 == 1:
449
- net_g = SynthesizerTrnMs768NSFsid(
450
- *cpt["config"], is_half=config.is_half
451
- )
452
- else:
453
- net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
454
- del net_g, cpt
455
- if torch.cuda.is_available():
456
- torch.cuda.empty_cache()
457
- cpt = None
458
- return {"visible": False, "__type__": "update"}
459
- person = "%s/%s" % (weight_root, sid)
460
- print("loading %s" % person)
461
- cpt = torch.load(person, map_location="cpu")
462
- tgt_sr = cpt["config"][-1]
463
- cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
464
- if_f0 = cpt.get("f0", 1)
465
- version = cpt.get("version", "v1")
466
- if version == "v1":
467
- if if_f0 == 1:
468
- net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=config.is_half)
469
- else:
470
- net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
471
- elif version == "v2":
472
- if if_f0 == 1:
473
- net_g = SynthesizerTrnMs768NSFsid(*cpt["config"], is_half=config.is_half)
474
- else:
475
- net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
476
- del net_g.enc_q
477
- print(net_g.load_state_dict(cpt["weight"], strict=False))
478
- net_g.eval().to(config.device)
479
- if config.is_half:
480
- net_g = net_g.half()
481
- else:
482
- net_g = net_g.float()
483
- vc = VC(tgt_sr, config)
484
- n_spk = cpt["config"][-3]
485
- return {"visible": False, "maximum": n_spk, "__type__": "update"}
486
-
487
-
488
- def change_choices():
489
- names = []
490
- for name in os.listdir(weight_root):
491
- if name.endswith(".pth"):
492
- names.append(name)
493
- index_paths = []
494
- for root, dirs, files in os.walk(index_root, topdown=False):
495
- for name in files:
496
- if name.endswith(".index") and "trained" not in name:
497
- index_paths.append("%s/%s" % (root, name))
498
- return {"choices": sorted(names), "__type__": "update"}, {
499
- "choices": sorted(index_paths),
500
- "__type__": "update",
501
- }
502
-
503
-
504
- def clean():
505
- return {"value": "", "__type__": "update"}
506
-
507
-
508
- sr_dict = {
509
- "32k": 32000,
510
- "40k": 40000,
511
- "48k": 48000,
512
- }
513
-
514
-
515
- def if_done(done, p):
516
- while 1:
517
- if p.poll() == None:
518
- sleep(0.5)
519
- else:
520
- break
521
- done[0] = True
522
-
523
-
524
- def if_done_multi(done, ps):
525
- while 1:
526
- # poll==None代表进程未结束
527
- # 只要有一个进程未结束都不停
528
- flag = 1
529
- for p in ps:
530
- if p.poll() == None:
531
- flag = 0
532
- sleep(0.5)
533
- break
534
- if flag == 1:
535
- break
536
- done[0] = True
537
-
538
-
539
- def preprocess_dataset(trainset_dir, exp_dir, sr, n_p):
540
- sr = sr_dict[sr]
541
- os.makedirs("%s/logs/%s" % (now_dir, exp_dir), exist_ok=True)
542
- f = open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir), "w")
543
- f.close()
544
- cmd = (
545
- config.python_cmd
546
- + " trainset_preprocess_pipeline_print.py %s %s %s %s/logs/%s "
547
- % (trainset_dir, sr, n_p, now_dir, exp_dir)
548
- + str(config.noparallel)
549
- )
550
- print(cmd)
551
- p = Popen(cmd, shell=True) # , stdin=PIPE, stdout=PIPE,stderr=PIPE,cwd=now_dir
552
- ###煞笔gr, popen read都非得全跑完了再一次性读取, 不用gr就正常读一句输出一句;只能额外弄出一个文本流定时读
553
- done = [False]
554
- threading.Thread(
555
- target=if_done,
556
- args=(
557
- done,
558
- p,
559
- ),
560
- ).start()
561
- while 1:
562
- with open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir), "r") as f:
563
- yield (f.read())
564
- sleep(1)
565
- if done[0] == True:
566
- break
567
- with open("%s/logs/%s/preprocess.log" % (now_dir, exp_dir), "r") as f:
568
- log = f.read()
569
- print(log)
570
- yield log
571
-
572
- # but2.click(extract_f0,[gpus6,np7,f0method8,if_f0_3,trainset_dir4],[info2])
573
- def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, version19, echl):
574
- gpus = gpus.split("-")
575
- os.makedirs("%s/logs/%s" % (now_dir, exp_dir), exist_ok=True)
576
- f = open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "w")
577
- f.close()
578
- if if_f0:
579
- cmd = config.python_cmd + " extract_f0_print.py %s/logs/%s %s %s %s" % (
580
- now_dir,
581
- exp_dir,
582
- n_p,
583
- f0method,
584
- echl,
585
- )
586
- print(cmd)
587
- p = Popen(cmd, shell=True, cwd=now_dir) # , stdin=PIPE, stdout=PIPE,stderr=PIPE
588
- ###煞笔gr, popen read都非得全跑完了再一次性读取, 不用gr就正常读一句输出一句;只能额外弄出一个文本流定时读
589
- done = [False]
590
- threading.Thread(
591
- target=if_done,
592
- args=(
593
- done,
594
- p,
595
- ),
596
- ).start()
597
- while 1:
598
- with open(
599
- "%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r"
600
- ) as f:
601
- yield (f.read())
602
- sleep(1)
603
- if done[0] == True:
604
- break
605
- with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r") as f:
606
- log = f.read()
607
- print(log)
608
- yield log
609
- ####对不同part分别开多进程
610
- """
611
- n_part=int(sys.argv[1])
612
- i_part=int(sys.argv[2])
613
- i_gpu=sys.argv[3]
614
- exp_dir=sys.argv[4]
615
- os.environ["CUDA_VISIBLE_DEVICES"]=str(i_gpu)
616
- """
617
- leng = len(gpus)
618
- ps = []
619
- for idx, n_g in enumerate(gpus):
620
- cmd = (
621
- config.python_cmd
622
- + " extract_feature_print.py %s %s %s %s %s/logs/%s %s"
623
- % (
624
- config.device,
625
- leng,
626
- idx,
627
- n_g,
628
- now_dir,
629
- exp_dir,
630
- version19,
631
- )
632
- )
633
- print(cmd)
634
- p = Popen(
635
- cmd, shell=True, cwd=now_dir
636
- ) # , shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=now_dir
637
- ps.append(p)
638
- ###煞笔gr, popen read都非得全跑完了再一次性读取, 不用gr就正常读一句输出一句;只能额外弄出一个文本流定时读
639
- done = [False]
640
- threading.Thread(
641
- target=if_done_multi,
642
- args=(
643
- done,
644
- ps,
645
- ),
646
- ).start()
647
- while 1:
648
- with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r") as f:
649
- yield (f.read())
650
- sleep(1)
651
- if done[0] == True:
652
- break
653
- with open("%s/logs/%s/extract_f0_feature.log" % (now_dir, exp_dir), "r") as f:
654
- log = f.read()
655
- print(log)
656
- yield log
657
-
658
-
659
- def change_sr2(sr2, if_f0_3, version19):
660
- path_str = "" if version19 == "v1" else "_v2"
661
- f0_str = "f0" if if_f0_3 else ""
662
- if_pretrained_generator_exist = os.access("pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2), os.F_OK)
663
- if_pretrained_discriminator_exist = os.access("pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2), os.F_OK)
664
- if (if_pretrained_generator_exist == False):
665
- print("pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2), "not exist, will not use pretrained model")
666
- if (if_pretrained_discriminator_exist == False):
667
- print("pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2), "not exist, will not use pretrained model")
668
- return (
669
- ("pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2)) if if_pretrained_generator_exist else "",
670
- ("pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2)) if if_pretrained_discriminator_exist else "",
671
- {"visible": True, "__type__": "update"}
672
- )
673
-
674
- def change_version19(sr2, if_f0_3, version19):
675
- path_str = "" if version19 == "v1" else "_v2"
676
- f0_str = "f0" if if_f0_3 else ""
677
- if_pretrained_generator_exist = os.access("pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2), os.F_OK)
678
- if_pretrained_discriminator_exist = os.access("pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2), os.F_OK)
679
- if (if_pretrained_generator_exist == False):
680
- print("pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2), "not exist, will not use pretrained model")
681
- if (if_pretrained_discriminator_exist == False):
682
- print("pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2), "not exist, will not use pretrained model")
683
- return (
684
- ("pretrained%s/%sG%s.pth" % (path_str, f0_str, sr2)) if if_pretrained_generator_exist else "",
685
- ("pretrained%s/%sD%s.pth" % (path_str, f0_str, sr2)) if if_pretrained_discriminator_exist else "",
686
- )
687
-
688
-
689
- def change_f0(if_f0_3, sr2, version19): # f0method8,pretrained_G14,pretrained_D15
690
- path_str = "" if version19 == "v1" else "_v2"
691
- if_pretrained_generator_exist = os.access("pretrained%s/f0G%s.pth" % (path_str, sr2), os.F_OK)
692
- if_pretrained_discriminator_exist = os.access("pretrained%s/f0D%s.pth" % (path_str, sr2), os.F_OK)
693
- if (if_pretrained_generator_exist == False):
694
- print("pretrained%s/f0G%s.pth" % (path_str, sr2), "not exist, will not use pretrained model")
695
- if (if_pretrained_discriminator_exist == False):
696
- print("pretrained%s/f0D%s.pth" % (path_str, sr2), "not exist, will not use pretrained model")
697
- if if_f0_3:
698
- return (
699
- {"visible": True, "__type__": "update"},
700
- "pretrained%s/f0G%s.pth" % (path_str, sr2) if if_pretrained_generator_exist else "",
701
- "pretrained%s/f0D%s.pth" % (path_str, sr2) if if_pretrained_discriminator_exist else "",
702
- )
703
- return (
704
- {"visible": False, "__type__": "update"},
705
- ("pretrained%s/G%s.pth" % (path_str, sr2)) if if_pretrained_generator_exist else "",
706
- ("pretrained%s/D%s.pth" % (path_str, sr2)) if if_pretrained_discriminator_exist else "",
707
- )
708
-
709
-
710
- global log_interval
711
-
712
-
713
- def set_log_interval(exp_dir, batch_size12):
714
- log_interval = 1
715
-
716
- folder_path = os.path.join(exp_dir, "1_16k_wavs")
717
-
718
- if os.path.exists(folder_path) and os.path.isdir(folder_path):
719
- wav_files = [f for f in os.listdir(folder_path) if f.endswith(".wav")]
720
- if wav_files:
721
- sample_size = len(wav_files)
722
- log_interval = math.ceil(sample_size / batch_size12)
723
- if log_interval > 1:
724
- log_interval += 1
725
- return log_interval
726
-
727
- # but3.click(click_train,[exp_dir1,sr2,if_f0_3,save_epoch10,total_epoch11,batch_size12,if_save_latest13,pretrained_G14,pretrained_D15,gpus16])
728
- def click_train(
729
- exp_dir1,
730
- sr2,
731
- if_f0_3,
732
- spk_id5,
733
- save_epoch10,
734
- total_epoch11,
735
- batch_size12,
736
- if_save_latest13,
737
- pretrained_G14,
738
- pretrained_D15,
739
- gpus16,
740
- if_cache_gpu17,
741
- if_save_every_weights18,
742
- version19,
743
- ):
744
- CSVutil('csvdb/stop.csv', 'w+', 'formanting', False)
745
- # 生成filelist
746
- exp_dir = "%s/logs/%s" % (now_dir, exp_dir1)
747
- os.makedirs(exp_dir, exist_ok=True)
748
- gt_wavs_dir = "%s/0_gt_wavs" % (exp_dir)
749
- feature_dir = (
750
- "%s/3_feature256" % (exp_dir)
751
- if version19 == "v1"
752
- else "%s/3_feature768" % (exp_dir)
753
- )
754
-
755
- log_interval = set_log_interval(exp_dir, batch_size12)
756
-
757
- if if_f0_3:
758
- f0_dir = "%s/2a_f0" % (exp_dir)
759
- f0nsf_dir = "%s/2b-f0nsf" % (exp_dir)
760
- names = (
761
- set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)])
762
- & set([name.split(".")[0] for name in os.listdir(feature_dir)])
763
- & set([name.split(".")[0] for name in os.listdir(f0_dir)])
764
- & set([name.split(".")[0] for name in os.listdir(f0nsf_dir)])
765
- )
766
- else:
767
- names = set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set(
768
- [name.split(".")[0] for name in os.listdir(feature_dir)]
769
- )
770
- opt = []
771
- for name in names:
772
- if if_f0_3:
773
- opt.append(
774
- "%s/%s.wav|%s/%s.npy|%s/%s.wav.npy|%s/%s.wav.npy|%s"
775
- % (
776
- gt_wavs_dir.replace("\\", "\\\\"),
777
- name,
778
- feature_dir.replace("\\", "\\\\"),
779
- name,
780
- f0_dir.replace("\\", "\\\\"),
781
- name,
782
- f0nsf_dir.replace("\\", "\\\\"),
783
- name,
784
- spk_id5,
785
- )
786
- )
787
- else:
788
- opt.append(
789
- "%s/%s.wav|%s/%s.npy|%s"
790
- % (
791
- gt_wavs_dir.replace("\\", "\\\\"),
792
- name,
793
- feature_dir.replace("\\", "\\\\"),
794
- name,
795
- spk_id5,
796
- )
797
- )
798
- fea_dim = 256 if version19 == "v1" else 768
799
- if if_f0_3:
800
- for _ in range(2):
801
- opt.append(
802
- "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s"
803
- % (now_dir, sr2, now_dir, fea_dim, now_dir, now_dir, spk_id5)
804
- )
805
- else:
806
- for _ in range(2):
807
- opt.append(
808
- "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s"
809
- % (now_dir, sr2, now_dir, fea_dim, spk_id5)
810
- )
811
- shuffle(opt)
812
- with open("%s/filelist.txt" % exp_dir, "w") as f:
813
- f.write("\n".join(opt))
814
- print("write filelist done")
815
- # 生成config#无需生成config
816
- # cmd = python_cmd + " train_nsf_sim_cache_sid_load_pretrain.py -e mi-test -sr 40k -f0 1 -bs 4 -g 0 -te 10 -se 5 -pg pretrained/f0G40k.pth -pd pretrained/f0D40k.pth -l 1 -c 0"
817
- print("use gpus:", gpus16)
818
- if pretrained_G14 == "":
819
- print("no pretrained Generator")
820
- if pretrained_D15 == "":
821
- print("no pretrained Discriminator")
822
- if gpus16:
823
- cmd = (
824
- config.python_cmd
825
- + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s %s %s -l %s -c %s -sw %s -v %s -li %s"
826
- % (
827
- exp_dir1,
828
- sr2,
829
- 1 if if_f0_3 else 0,
830
- batch_size12,
831
- gpus16,
832
- total_epoch11,
833
- save_epoch10,
834
- ("-pg %s" % pretrained_G14) if pretrained_G14 != "" else "",
835
- ("-pd %s" % pretrained_D15) if pretrained_D15 != "" else "",
836
- 1 if if_save_latest13 == True else 0,
837
- 1 if if_cache_gpu17 == True else 0,
838
- 1 if if_save_every_weights18 == True else 0,
839
- version19,
840
- log_interval,
841
- )
842
- )
843
- else:
844
- cmd = (
845
- config.python_cmd
846
- + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s %s %s -l %s -c %s -sw %s -v %s -li %s"
847
- % (
848
- exp_dir1,
849
- sr2,
850
- 1 if if_f0_3 else 0,
851
- batch_size12,
852
- total_epoch11,
853
- save_epoch10,
854
- ("-pg %s" % pretrained_G14) if pretrained_G14 != "" else "\b",
855
- ("-pd %s" % pretrained_D15) if pretrained_D15 != "" else "\b",
856
- 1 if if_save_latest13 == True else 0,
857
- 1 if if_cache_gpu17 == True else 0,
858
- 1 if if_save_every_weights18 == True else 0,
859
- version19,
860
- log_interval,
861
- )
862
- )
863
- print(cmd)
864
- p = Popen(cmd, shell=True, cwd=now_dir)
865
- global PID
866
- PID = p.pid
867
- p.wait()
868
- return ("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log", {"visible": False, "__type__": "update"}, {"visible": True, "__type__": "update"})
869
-
870
-
871
- # but4.click(train_index, [exp_dir1], info3)
872
- def train_index(exp_dir1, version19):
873
- exp_dir = "%s/logs/%s" % (now_dir, exp_dir1)
874
- os.makedirs(exp_dir, exist_ok=True)
875
- feature_dir = (
876
- "%s/3_feature256" % (exp_dir)
877
- if version19 == "v1"
878
- else "%s/3_feature768" % (exp_dir)
879
- )
880
- if os.path.exists(feature_dir) == False:
881
- return "请先进行特征提取!"
882
- listdir_res = list(os.listdir(feature_dir))
883
- if len(listdir_res) == 0:
884
- return "请先进行特征提取!"
885
- npys = []
886
- for name in sorted(listdir_res):
887
- phone = np.load("%s/%s" % (feature_dir, name))
888
- npys.append(phone)
889
- big_npy = np.concatenate(npys, 0)
890
- big_npy_idx = np.arange(big_npy.shape[0])
891
- np.random.shuffle(big_npy_idx)
892
- big_npy = big_npy[big_npy_idx]
893
- np.save("%s/total_fea.npy" % exp_dir, big_npy)
894
- # n_ivf = big_npy.shape[0] // 39
895
- n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39)
896
- infos = []
897
- infos.append("%s,%s" % (big_npy.shape, n_ivf))
898
- yield "\n".join(infos)
899
- index = faiss.index_factory(256 if version19 == "v1" else 768, "IVF%s,Flat" % n_ivf)
900
- # index = faiss.index_factory(256if version19=="v1"else 768, "IVF%s,PQ128x4fs,RFlat"%n_ivf)
901
- infos.append("training")
902
- yield "\n".join(infos)
903
- index_ivf = faiss.extract_index_ivf(index) #
904
- index_ivf.nprobe = 1
905
- index.train(big_npy)
906
- faiss.write_index(
907
- index,
908
- "%s/trained_IVF%s_Flat_nprobe_%s_%s_%s.index"
909
- % (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
910
- )
911
- # faiss.write_index(index, '%s/trained_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
912
- infos.append("adding")
913
- yield "\n".join(infos)
914
- batch_size_add = 8192
915
- for i in range(0, big_npy.shape[0], batch_size_add):
916
- index.add(big_npy[i : i + batch_size_add])
917
- faiss.write_index(
918
- index,
919
- "%s/added_IVF%s_Flat_nprobe_%s_%s_%s.index"
920
- % (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
921
- )
922
- infos.append(
923
- "成功构建索引,added_IVF%s_Flat_nprobe_%s_%s_%s.index"
924
- % (n_ivf, index_ivf.nprobe, exp_dir1, version19)
925
- )
926
- # faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
927
- # infos.append("成功构建索引,added_IVF%s_Flat_FastScan_%s.index"%(n_ivf,version19))
928
- yield "\n".join(infos)
929
-
930
-
931
- # but5.click(train1key, [exp_dir1, sr2, if_f0_3, trainset_dir4, spk_id5, gpus6, np7, f0method8, save_epoch10, total_epoch11, batch_size12, if_save_latest13, pretrained_G14, pretrained_D15, gpus16, if_cache_gpu17], info3)
932
- def train1key(
933
- exp_dir1,
934
- sr2,
935
- if_f0_3,
936
- trainset_dir4,
937
- spk_id5,
938
- np7,
939
- f0method8,
940
- save_epoch10,
941
- total_epoch11,
942
- batch_size12,
943
- if_save_latest13,
944
- pretrained_G14,
945
- pretrained_D15,
946
- gpus16,
947
- if_cache_gpu17,
948
- if_save_every_weights18,
949
- version19,
950
- echl
951
- ):
952
- infos = []
953
-
954
- def get_info_str(strr):
955
- infos.append(strr)
956
- return "\n".join(infos)
957
-
958
- model_log_dir = "%s/logs/%s" % (now_dir, exp_dir1)
959
- preprocess_log_path = "%s/preprocess.log" % model_log_dir
960
- extract_f0_feature_log_path = "%s/extract_f0_feature.log" % model_log_dir
961
- gt_wavs_dir = "%s/0_gt_wavs" % model_log_dir
962
- feature_dir = (
963
- "%s/3_feature256" % model_log_dir
964
- if version19 == "v1"
965
- else "%s/3_feature768" % model_log_dir
966
- )
967
-
968
- os.makedirs(model_log_dir, exist_ok=True)
969
- #########step1:处理数据
970
- open(preprocess_log_path, "w").close()
971
- cmd = (
972
- config.python_cmd
973
- + " trainset_preprocess_pipeline_print.py %s %s %s %s "
974
- % (trainset_dir4, sr_dict[sr2], np7, model_log_dir)
975
- + str(config.noparallel)
976
- )
977
- yield get_info_str(i18n("step1:正在处理数据"))
978
- yield get_info_str(cmd)
979
- p = Popen(cmd, shell=True)
980
- p.wait()
981
- with open(preprocess_log_path, "r") as f:
982
- print(f.read())
983
- #########step2a:提取音高
984
- open(extract_f0_feature_log_path, "w")
985
- if if_f0_3:
986
- yield get_info_str("step2a:正在提取音高")
987
- cmd = config.python_cmd + " extract_f0_print.py %s %s %s %s" % (
988
- model_log_dir,
989
- np7,
990
- f0method8,
991
- echl
992
- )
993
- yield get_info_str(cmd)
994
- p = Popen(cmd, shell=True, cwd=now_dir)
995
- p.wait()
996
- with open(extract_f0_feature_log_path, "r") as f:
997
- print(f.read())
998
- else:
999
- yield get_info_str(i18n("step2a:无需提取音高"))
1000
- #######step2b:提取特征
1001
- yield get_info_str(i18n("step2b:正在提取特征"))
1002
- gpus = gpus16.split("-")
1003
- leng = len(gpus)
1004
- ps = []
1005
- for idx, n_g in enumerate(gpus):
1006
- cmd = config.python_cmd + " extract_feature_print.py %s %s %s %s %s %s" % (
1007
- config.device,
1008
- leng,
1009
- idx,
1010
- n_g,
1011
- model_log_dir,
1012
- version19,
1013
- )
1014
- yield get_info_str(cmd)
1015
- p = Popen(
1016
- cmd, shell=True, cwd=now_dir
1017
- ) # , shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=now_dir
1018
- ps.append(p)
1019
- for p in ps:
1020
- p.wait()
1021
- with open(extract_f0_feature_log_path, "r") as f:
1022
- print(f.read())
1023
- #######step3a:训练模型
1024
- yield get_info_str(i18n("step3a:正在训练模型"))
1025
- # 生成filelist
1026
- if if_f0_3:
1027
- f0_dir = "%s/2a_f0" % model_log_dir
1028
- f0nsf_dir = "%s/2b-f0nsf" % model_log_dir
1029
- names = (
1030
- set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)])
1031
- & set([name.split(".")[0] for name in os.listdir(feature_dir)])
1032
- & set([name.split(".")[0] for name in os.listdir(f0_dir)])
1033
- & set([name.split(".")[0] for name in os.listdir(f0nsf_dir)])
1034
- )
1035
- else:
1036
- names = set([name.split(".")[0] for name in os.listdir(gt_wavs_dir)]) & set(
1037
- [name.split(".")[0] for name in os.listdir(feature_dir)]
1038
- )
1039
- opt = []
1040
- for name in names:
1041
- if if_f0_3:
1042
- opt.append(
1043
- "%s/%s.wav|%s/%s.npy|%s/%s.wav.npy|%s/%s.wav.npy|%s"
1044
- % (
1045
- gt_wavs_dir.replace("\\", "\\\\"),
1046
- name,
1047
- feature_dir.replace("\\", "\\\\"),
1048
- name,
1049
- f0_dir.replace("\\", "\\\\"),
1050
- name,
1051
- f0nsf_dir.replace("\\", "\\\\"),
1052
- name,
1053
- spk_id5,
1054
- )
1055
- )
1056
- else:
1057
- opt.append(
1058
- "%s/%s.wav|%s/%s.npy|%s"
1059
- % (
1060
- gt_wavs_dir.replace("\\", "\\\\"),
1061
- name,
1062
- feature_dir.replace("\\", "\\\\"),
1063
- name,
1064
- spk_id5,
1065
- )
1066
- )
1067
- fea_dim = 256 if version19 == "v1" else 768
1068
- if if_f0_3:
1069
- for _ in range(2):
1070
- opt.append(
1071
- "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s/logs/mute/2a_f0/mute.wav.npy|%s/logs/mute/2b-f0nsf/mute.wav.npy|%s"
1072
- % (now_dir, sr2, now_dir, fea_dim, now_dir, now_dir, spk_id5)
1073
- )
1074
- else:
1075
- for _ in range(2):
1076
- opt.append(
1077
- "%s/logs/mute/0_gt_wavs/mute%s.wav|%s/logs/mute/3_feature%s/mute.npy|%s"
1078
- % (now_dir, sr2, now_dir, fea_dim, spk_id5)
1079
- )
1080
- shuffle(opt)
1081
- with open("%s/filelist.txt" % model_log_dir, "w") as f:
1082
- f.write("\n".join(opt))
1083
- yield get_info_str("write filelist done")
1084
- if gpus16:
1085
- cmd = (
1086
- config.python_cmd
1087
- +" train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -g %s -te %s -se %s %s %s -l %s -c %s -sw %s -v %s"
1088
- % (
1089
- exp_dir1,
1090
- sr2,
1091
- 1 if if_f0_3 else 0,
1092
- batch_size12,
1093
- gpus16,
1094
- total_epoch11,
1095
- save_epoch10,
1096
- ("-pg %s" % pretrained_G14) if pretrained_G14 != "" else "",
1097
- ("-pd %s" % pretrained_D15) if pretrained_D15 != "" else "",
1098
- 1 if if_save_latest13 == True else 0,
1099
- 1 if if_cache_gpu17 == True else 0,
1100
- 1 if if_save_every_weights18 == True else 0,
1101
- version19,
1102
- )
1103
- )
1104
- else:
1105
- cmd = (
1106
- config.python_cmd
1107
- + " train_nsf_sim_cache_sid_load_pretrain.py -e %s -sr %s -f0 %s -bs %s -te %s -se %s %s %s -l %s -c %s -sw %s -v %s"
1108
- % (
1109
- exp_dir1,
1110
- sr2,
1111
- 1 if if_f0_3 else 0,
1112
- batch_size12,
1113
- total_epoch11,
1114
- save_epoch10,
1115
- ("-pg %s" % pretrained_G14) if pretrained_G14 != "" else "",
1116
- ("-pd %s" % pretrained_D15) if pretrained_D15 != "" else "",
1117
- 1 if if_save_latest13 == True else 0,
1118
- 1 if if_cache_gpu17 == True else 0,
1119
- 1 if if_save_every_weights18 == True else 0,
1120
- version19,
1121
- )
1122
- )
1123
- yield get_info_str(cmd)
1124
- p = Popen(cmd, shell=True, cwd=now_dir)
1125
- p.wait()
1126
- yield get_info_str(i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log"))
1127
- #######step3b:训练索引
1128
- npys = []
1129
- listdir_res = list(os.listdir(feature_dir))
1130
- for name in sorted(listdir_res):
1131
- phone = np.load("%s/%s" % (feature_dir, name))
1132
- npys.append(phone)
1133
- big_npy = np.concatenate(npys, 0)
1134
-
1135
- big_npy_idx = np.arange(big_npy.shape[0])
1136
- np.random.shuffle(big_npy_idx)
1137
- big_npy = big_npy[big_npy_idx]
1138
- np.save("%s/total_fea.npy" % model_log_dir, big_npy)
1139
-
1140
- # n_ivf = big_npy.shape[0] // 39
1141
- n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39)
1142
- yield get_info_str("%s,%s" % (big_npy.shape, n_ivf))
1143
- index = faiss.index_factory(256 if version19 == "v1" else 768, "IVF%s,Flat" % n_ivf)
1144
- yield get_info_str("training index")
1145
- index_ivf = faiss.extract_index_ivf(index) #
1146
- index_ivf.nprobe = 1
1147
- index.train(big_npy)
1148
- faiss.write_index(
1149
- index,
1150
- "%s/trained_IVF%s_Flat_nprobe_%s_%s_%s.index"
1151
- % (model_log_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
1152
- )
1153
- yield get_info_str("adding index")
1154
- batch_size_add = 8192
1155
- for i in range(0, big_npy.shape[0], batch_size_add):
1156
- index.add(big_npy[i : i + batch_size_add])
1157
- faiss.write_index(
1158
- index,
1159
- "%s/added_IVF%s_Flat_nprobe_%s_%s_%s.index"
1160
- % (model_log_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
1161
- )
1162
- yield get_info_str(
1163
- "成功构建索引, added_IVF%s_Flat_nprobe_%s_%s_%s.index"
1164
- % (n_ivf, index_ivf.nprobe, exp_dir1, version19)
1165
- )
1166
- yield get_info_str(i18n("全流程结束!"))
1167
-
1168
-
1169
- def whethercrepeornah(radio):
1170
- mango = True if radio == 'mangio-crepe' or radio == 'mangio-crepe-tiny' else False
1171
- return ({"visible": mango, "__type__": "update"})
1172
-
1173
- # ckpt_path2.change(change_info_,[ckpt_path2],[sr__,if_f0__])
1174
- def change_info_(ckpt_path):
1175
- if (
1176
- os.path.exists(ckpt_path.replace(os.path.basename(ckpt_path), "train.log"))
1177
- == False
1178
- ):
1179
- return {"__type__": "update"}, {"__type__": "update"}, {"__type__": "update"}
1180
- try:
1181
- with open(
1182
- ckpt_path.replace(os.path.basename(ckpt_path), "train.log"), "r"
1183
- ) as f:
1184
- info = eval(f.read().strip("\n").split("\n")[0].split("\t")[-1])
1185
- sr, f0 = info["sample_rate"], info["if_f0"]
1186
- version = "v2" if ("version" in info and info["version"] == "v2") else "v1"
1187
- return sr, str(f0), version
1188
- except:
1189
- traceback.print_exc()
1190
- return {"__type__": "update"}, {"__type__": "update"}, {"__type__": "update"}
1191
-
1192
-
1193
- from lib.infer_pack.models_onnx import SynthesizerTrnMsNSFsidM
1194
-
1195
-
1196
- def export_onnx(ModelPath, ExportedPath, MoeVS=True):
1197
- cpt = torch.load(ModelPath, map_location="cpu")
1198
- cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
1199
- hidden_channels = 256 if cpt.get("version","v1")=="v1"else 768#cpt["config"][-2] # hidden_channels,为768Vec做准备
1200
-
1201
- test_phone = torch.rand(1, 200, hidden_channels) # hidden unit
1202
- test_phone_lengths = torch.tensor([200]).long() # hidden unit 长度(貌似没啥用)
1203
- test_pitch = torch.randint(size=(1, 200), low=5, high=255) # 基频(单位赫兹)
1204
- test_pitchf = torch.rand(1, 200) # nsf基频
1205
- test_ds = torch.LongTensor([0]) # 说话人ID
1206
- test_rnd = torch.rand(1, 192, 200) # 噪声(加入随机因子)
1207
-
1208
- device = "cpu" # 导出时设备(不影响使用模型)
1209
-
1210
-
1211
- net_g = SynthesizerTrnMsNSFsidM(
1212
- *cpt["config"], is_half=False,version=cpt.get("version","v1")
1213
- ) # fp32导出(C++要支持fp16必须手动将内存重新排列所以暂时不用fp16)
1214
- net_g.load_state_dict(cpt["weight"], strict=False)
1215
- input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"]
1216
- output_names = [
1217
- "audio",
1218
- ]
1219
- # net_g.construct_spkmixmap(n_speaker) 多角色混合轨道导出
1220
- torch.onnx.export(
1221
- net_g,
1222
- (
1223
- test_phone.to(device),
1224
- test_phone_lengths.to(device),
1225
- test_pitch.to(device),
1226
- test_pitchf.to(device),
1227
- test_ds.to(device),
1228
- test_rnd.to(device),
1229
- ),
1230
- ExportedPath,
1231
- dynamic_axes={
1232
- "phone": [1],
1233
- "pitch": [1],
1234
- "pitchf": [1],
1235
- "rnd": [2],
1236
- },
1237
- do_constant_folding=False,
1238
- opset_version=16,
1239
- verbose=False,
1240
- input_names=input_names,
1241
- output_names=output_names,
1242
- )
1243
- return "Finished"
1244
-
1245
- #region RVC WebUI App
1246
-
1247
- def get_presets():
1248
- data = None
1249
- with open('../inference-presets.json', 'r') as file:
1250
- data = json.load(file)
1251
- preset_names = []
1252
- for preset in data['presets']:
1253
- preset_names.append(preset['name'])
1254
-
1255
- return preset_names
1256
-
1257
- def change_choices2():
1258
- audio_files=[]
1259
- for filename in os.listdir("./audios"):
1260
- if filename.endswith(('.wav','.mp3','.ogg','.flac','.m4a','.aac','.mp4')):
1261
- audio_files.append(os.path.join('./audios',filename).replace('\\', '/'))
1262
- return {"choices": sorted(audio_files), "__type__": "update"}, {"__type__": "update"}
1263
-
1264
- audio_files=[]
1265
- for filename in os.listdir("./audios"):
1266
- if filename.endswith(('.wav','.mp3','.ogg','.flac','.m4a','.aac','.mp4')):
1267
- audio_files.append(os.path.join('./audios',filename).replace('\\', '/'))
1268
-
1269
- def get_index():
1270
- if check_for_name() != '':
1271
- chosen_model=sorted(names)[0].split(".")[0]
1272
- logs_path="./logs/"+chosen_model
1273
- if os.path.exists(logs_path):
1274
- for file in os.listdir(logs_path):
1275
- if file.endswith(".index"):
1276
- return os.path.join(logs_path, file)
1277
- return ''
1278
- else:
1279
- return ''
1280
-
1281
- def get_indexes():
1282
- indexes_list=[]
1283
- for dirpath, dirnames, filenames in os.walk("./logs/"):
1284
- for filename in filenames:
1285
- if filename.endswith(".index"):
1286
- indexes_list.append(os.path.join(dirpath,filename))
1287
- if len(indexes_list) > 0:
1288
- return indexes_list
1289
- else:
1290
- return ''
1291
-
1292
- def get_name():
1293
- if len(audio_files) > 0:
1294
- return sorted(audio_files)[0]
1295
- else:
1296
- return ''
1297
-
1298
- def save_to_wav(record_button):
1299
- if record_button is None:
1300
- pass
1301
- else:
1302
- path_to_file=record_button
1303
- new_name = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")+'.wav'
1304
- new_path='./audios/'+new_name
1305
- shutil.move(path_to_file,new_path)
1306
- return new_path
1307
-
1308
- def save_to_wav2(dropbox):
1309
- file_path=dropbox.name
1310
- shutil.move(file_path,'./audios')
1311
- return os.path.join('./audios',os.path.basename(file_path))
1312
-
1313
- def match_index(sid0):
1314
- folder=sid0.split(".")[0]
1315
- parent_dir="./logs/"+folder
1316
- if os.path.exists(parent_dir):
1317
- for filename in os.listdir(parent_dir):
1318
- if filename.endswith(".index"):
1319
- index_path=os.path.join(parent_dir,filename)
1320
- return index_path
1321
- else:
1322
- return ''
1323
-
1324
- def check_for_name():
1325
- if len(names) > 0:
1326
- return sorted(names)[0]
1327
- else:
1328
- return ''
1329
-
1330
- def download_from_url(url, model):
1331
- if url == '':
1332
- return "URL cannot be left empty."
1333
- if model =='':
1334
- return "You need to name your model. For example: My-Model"
1335
- url = url.strip()
1336
- zip_dirs = ["zips", "unzips"]
1337
- for directory in zip_dirs:
1338
- if os.path.exists(directory):
1339
- shutil.rmtree(directory)
1340
- os.makedirs("zips", exist_ok=True)
1341
- os.makedirs("unzips", exist_ok=True)
1342
- zipfile = model + '.zip'
1343
- zipfile_path = './zips/' + zipfile
1344
- try:
1345
- if "drive.google.com" in url:
1346
- subprocess.run(["gdown", url, "--fuzzy", "-O", zipfile_path])
1347
- elif "mega.nz" in url:
1348
- m = Mega()
1349
- m.download_url(url, './zips')
1350
- else:
1351
- subprocess.run(["wget", url, "-O", zipfile_path])
1352
- for filename in os.listdir("./zips"):
1353
- if filename.endswith(".zip"):
1354
- zipfile_path = os.path.join("./zips/",filename)
1355
- shutil.unpack_archive(zipfile_path, "./unzips", 'zip')
1356
- else:
1357
- return "No zipfile found."
1358
- for root, dirs, files in os.walk('./unzips'):
1359
- for file in files:
1360
- file_path = os.path.join(root, file)
1361
- if file.endswith(".index"):
1362
- os.mkdir(f'./logs/{model}')
1363
- shutil.copy2(file_path,f'./logs/{model}')
1364
- elif "G_" not in file and "D_" not in file and file.endswith(".pth"):
1365
- shutil.copy(file_path,f'./weights/{model}.pth')
1366
- shutil.rmtree("zips")
1367
- shutil.rmtree("unzips")
1368
- return "Model downloaded, you can go back to the inference page!"
1369
- except:
1370
- return "ERROR - The download failed. Check if the link is valid."
1371
- def success_message(face):
1372
- return f'{face.name} has been uploaded.', 'None'
1373
- def mouth(size, face, voice, faces):
1374
- if size == 'Half':
1375
- size = 2
1376
- else:
1377
- size = 1
1378
- if faces == 'None':
1379
- character = face.name
1380
- else:
1381
- if faces == 'Ben Shapiro':
1382
- character = '/content/wav2lip-HD/inputs/ben-shapiro-10.mp4'
1383
- elif faces == 'Andrew Tate':
1384
- character = '/content/wav2lip-HD/inputs/tate-7.mp4'
1385
- command = "python inference.py " \
1386
- "--checkpoint_path checkpoints/wav2lip.pth " \
1387
- f"--face {character} " \
1388
- f"--audio {voice} " \
1389
- "--pads 0 20 0 0 " \
1390
- "--outfile /content/wav2lip-HD/outputs/result.mp4 " \
1391
- "--fps 24 " \
1392
- f"--resize_factor {size}"
1393
- process = subprocess.Popen(command, shell=True, cwd='/content/wav2lip-HD/Wav2Lip-master')
1394
- stdout, stderr = process.communicate()
1395
- return '/content/wav2lip-HD/outputs/result.mp4', 'Animation completed.'
1396
- eleven_voices = ['Adam','Antoni','Josh','Arnold','Sam','Bella','Rachel','Domi','Elli']
1397
- eleven_voices_ids=['pNInz6obpgDQGcFmaJgB','ErXwobaYiN019PkySvjV','TxGEqnHWrfWFTfGW9XjX','VR6AewLTigWG4xSOukaG','yoZ06aMxZJJ28mfd3POQ','EXAVITQu4vr4xnSDxMaL','21m00Tcm4TlvDq8ikWAM','AZnzlk1XvdvUeBnXmlld','MF3mGyEYCl7XYWbV9V6O']
1398
- chosen_voice = dict(zip(eleven_voices, eleven_voices_ids))
1399
-
1400
- def stoptraining(mim):
1401
- if int(mim) == 1:
1402
- try:
1403
- CSVutil('csvdb/stop.csv', 'w+', 'stop', 'True')
1404
- os.kill(PID, signal.SIGTERM)
1405
- except Exception as e:
1406
- print(f"Couldn't click due to {e}")
1407
- return (
1408
- {"visible": False, "__type__": "update"},
1409
- {"visible": True, "__type__": "update"},
1410
- )
1411
-
1412
-
1413
- def elevenTTS(xiapi, text, id, lang):
1414
- if xiapi!= '' and id !='':
1415
- choice = chosen_voice[id]
1416
- CHUNK_SIZE = 1024
1417
- url = f"https://api.elevenlabs.io/v1/text-to-speech/{choice}"
1418
- headers = {
1419
- "Accept": "audio/mpeg",
1420
- "Content-Type": "application/json",
1421
- "xi-api-key": xiapi
1422
- }
1423
- if lang == 'en':
1424
- data = {
1425
- "text": text,
1426
- "model_id": "eleven_monolingual_v1",
1427
- "voice_settings": {
1428
- "stability": 0.5,
1429
- "similarity_boost": 0.5
1430
- }
1431
- }
1432
- else:
1433
- data = {
1434
- "text": text,
1435
- "model_id": "eleven_multilingual_v1",
1436
- "voice_settings": {
1437
- "stability": 0.5,
1438
- "similarity_boost": 0.5
1439
- }
1440
- }
1441
-
1442
- response = requests.post(url, json=data, headers=headers)
1443
- with open('./temp_eleven.mp3', 'wb') as f:
1444
- for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
1445
- if chunk:
1446
- f.write(chunk)
1447
- aud_path = save_to_wav('./temp_eleven.mp3')
1448
- return aud_path, aud_path
1449
- else:
1450
- tts = gTTS(text, lang=lang)
1451
- tts.save('./temp_gTTS.mp3')
1452
- aud_path = save_to_wav('./temp_gTTS.mp3')
1453
- return aud_path, aud_path
1454
-
1455
- def ilariaTTS(text, ttsvoice):
1456
- vo=language_dict[ttsvoice]
1457
- asyncio.run(edge_tts.Communicate(text, vo).save("./temp_ilaria.mp3"))
1458
- aud_path = save_to_wav('./temp_ilaria.mp3')
1459
- return aud_path, aud_path
1460
-
1461
- def upload_to_dataset(files, dir):
1462
- if dir == '':
1463
- dir = './dataset'
1464
- if not os.path.exists(dir):
1465
- os.makedirs(dir)
1466
- count = 0
1467
- for file in files:
1468
- path=file.name
1469
- shutil.copy2(path,dir)
1470
- count += 1
1471
- return f' {count} files uploaded to {dir}.'
1472
-
1473
- def zip_downloader(model):
1474
- if not os.path.exists(f'./weights/{model}.pth'):
1475
- return {"__type__": "update"}, f'Make sure the Voice Name is correct. I could not find {model}.pth'
1476
- index_found = False
1477
- for file in os.listdir(f'./logs/{model}'):
1478
- if file.endswith('.index') and 'added' in file:
1479
- log_file = file
1480
- index_found = True
1481
- if index_found:
1482
- return [f'./weights/{model}.pth', f'./logs/{model}/{log_file}'], "Done"
1483
- else:
1484
- return f'./weights/{model}.pth', "Could not find Index file."
1485
-
1486
- with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="rose"), title="Ilaria RVC 💖") as app:
1487
- with gr.Tabs():
1488
- with gr.TabItem("Inference"):
1489
- gr.HTML("<h1> Ilaria RVC 💖 </h1>")
1490
- gr.HTML("<h10> You can find voice models on AI Hub: https://discord.gg/aihub </h10>")
1491
- gr.HTML("<h4> Huggingface port by Ilaria of the Rejekt Easy GUI </h4>")
1492
-
1493
- # Inference Preset Row
1494
- # with gr.Row():
1495
- # mangio_preset = gr.Dropdown(label="Inference Preset", choices=sorted(get_presets()))
1496
- # mangio_preset_name_save = gr.Textbox(
1497
- # label="Your preset name"
1498
- # )
1499
- # mangio_preset_save_btn = gr.Button('Save Preset', variant="primary")
1500
-
1501
- # Other RVC stuff
1502
- with gr.Row():
1503
- sid0 = gr.Dropdown(label="1.Choose the model.", choices=sorted(names), value=check_for_name())
1504
- refresh_button = gr.Button("Refresh", variant="primary")
1505
- if check_for_name() != '':
1506
- get_vc(sorted(names)[0])
1507
- vc_transform0 = gr.Number(label="Pitch: 0 from man to man (or woman to woman); 12 from man to woman and -12 from woman to man.", value=0)
1508
- #clean_button = gr.Button(i18n("卸载音色省显存"), variant="primary")
1509
- spk_item = gr.Slider(
1510
- minimum=0,
1511
- maximum=2333,
1512
- step=1,
1513
- label=i18n("请选择说话人id"),
1514
- value=0,
1515
- visible=False,
1516
- interactive=True,
1517
- )
1518
- #clean_button.click(fn=clean, inputs=[], outputs=[sid0])
1519
- sid0.change(
1520
- fn=get_vc,
1521
- inputs=[sid0],
1522
- outputs=[spk_item],
1523
- )
1524
- but0 = gr.Button("Convert", variant="primary")
1525
- with gr.Row():
1526
- with gr.Column():
1527
- with gr.Row():
1528
- dropbox = gr.File(label="Drag your audio file and click refresh.")
1529
- with gr.Row():
1530
- record_button=gr.Audio(label="Or you can use your microphone!", type="filepath")
1531
-
1532
- with gr.Row():
1533
- input_audio0 = gr.Dropdown(
1534
- label="2.Choose the audio file.",
1535
- value="./audios/Test_Audio.mp3",
1536
- choices=audio_files
1537
- )
1538
- dropbox.upload(fn=save_to_wav2, inputs=[dropbox], outputs=[input_audio0])
1539
- dropbox.upload(fn=change_choices2, inputs=[], outputs=[input_audio0])
1540
- refresh_button2 = gr.Button("Refresh", variant="primary", size='sm')
1541
- record_button.change(fn=save_to_wav, inputs=[record_button], outputs=[input_audio0])
1542
- record_button.change(fn=change_choices2, inputs=[], outputs=[input_audio0])
1543
- with gr.Row():
1544
- with gr.Accordion('ElevenLabs / Google TTS', open=False):
1545
- with gr.Column():
1546
- lang = gr.Radio(label='Chinese & Japanese do not work with ElevenLabs currently.',choices=['en','it','es','fr','pt','zh-CN','de','hi','ja'], value='en')
1547
- api_box = gr.Textbox(label="Enter your API Key for ElevenLabs, or leave empty to use GoogleTTS", value='')
1548
- elevenid=gr.Dropdown(label="Voice:", choices=eleven_voices)
1549
- with gr.Column():
1550
- tfs = gr.Textbox(label="Input your Text", interactive=True, value="This is a test.")
1551
- tts_button = gr.Button(value="Speak")
1552
- tts_button.click(fn=elevenTTS, inputs=[api_box,tfs, elevenid, lang], outputs=[record_button, input_audio0])
1553
- with gr.Row():
1554
- with gr.Accordion('Wav2Lip', open=False, visible=False):
1555
- with gr.Row():
1556
- size = gr.Radio(label='Resolution:',choices=['Half','Full'])
1557
- face = gr.UploadButton("Upload A Character",type='filepath')
1558
- faces = gr.Dropdown(label="OR Choose one:", choices=['None','Ben Shapiro','Andrew Tate'])
1559
- with gr.Row():
1560
- preview = gr.Textbox(label="Status:",interactive=False)
1561
- face.upload(fn=success_message,inputs=[face], outputs=[preview, faces])
1562
- with gr.Row():
1563
- animation = gr.Video()
1564
- refresh_button2.click(fn=change_choices2, inputs=[], outputs=[input_audio0, animation])
1565
- with gr.Row():
1566
- animate_button = gr.Button('Animate')
1567
-
1568
- with gr.Column():
1569
- vc_output2 = gr.Audio(
1570
- label="Final Result! (Click on the three dots to download the audio)",
1571
- type='filepath',
1572
- interactive=False,
1573
- )
1574
-
1575
- with gr.Accordion('IlariaTTS', open=True):
1576
- with gr.Column():
1577
- ilariaid=gr.Dropdown(label="Voice:", choices=ilariavoices, value="English-Jenny (Female)")
1578
- ilariatext = gr.Textbox(label="Input your Text", interactive=True, value="This is a test.")
1579
- ilariatts_button = gr.Button(value="Speak")
1580
- ilariatts_button.click(fn=ilariaTTS, inputs=[ilariatext, ilariaid], outputs=[record_button, input_audio0])
1581
-
1582
- #with gr.Column():
1583
- with gr.Accordion("Index Settings", open=False):
1584
- #with gr.Row():
1585
-
1586
- file_index1 = gr.Dropdown(
1587
- label="3. Choose the index file (in case it wasn't automatically found.)",
1588
- choices=get_indexes(),
1589
- value=get_index(),
1590
- interactive=True,
1591
- )
1592
- sid0.change(fn=match_index, inputs=[sid0],outputs=[file_index1])
1593
- refresh_button.click(
1594
- fn=change_choices, inputs=[], outputs=[sid0, file_index1]
1595
- )
1596
- # file_big_npy1 = gr.Textbox(
1597
- # label=i18n("特征文件路径"),
1598
- # value="E:\\codes\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
1599
- # interactive=True,
1600
- # )
1601
- index_rate1 = gr.Slider(
1602
- minimum=0,
1603
- maximum=1,
1604
- label=i18n("检索特征占比"),
1605
- value=0.66,
1606
- interactive=True,
1607
- )
1608
-
1609
- animate_button.click(fn=mouth, inputs=[size, face, vc_output2, faces], outputs=[animation, preview])
1610
-
1611
- with gr.Accordion("Advanced Options", open=False):
1612
- f0method0 = gr.Radio(
1613
- label="Optional: Change the Pitch Extraction Algorithm. Extraction methods are sorted from 'worst quality' to 'best quality'. If you don't know what you're doing, leave rmvpe.",
1614
- choices=["pm", "dio", "crepe-tiny", "mangio-crepe-tiny", "crepe", "harvest", "mangio-crepe", "rmvpe"], # Fork Feature. Add Crepe-Tiny
1615
- value="rmvpe",
1616
- interactive=True,
1617
- )
1618
-
1619
- crepe_hop_length = gr.Slider(
1620
- minimum=1,
1621
- maximum=512,
1622
- step=1,
1623
- label="Mangio-Crepe Hop Length. Higher numbers will reduce the chance of extreme pitch changes but lower numbers will increase accuracy. 64-192 is a good range to experiment with.",
1624
- value=120,
1625
- interactive=True,
1626
- visible=False,
1627
- )
1628
- f0method0.change(fn=whethercrepeornah, inputs=[f0method0], outputs=[crepe_hop_length])
1629
- filter_radius0 = gr.Slider(
1630
- minimum=0,
1631
- maximum=7,
1632
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
1633
- value=3,
1634
- step=1,
1635
- interactive=True,
1636
- )
1637
- resample_sr0 = gr.Slider(
1638
- minimum=0,
1639
- maximum=48000,
1640
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
1641
- value=0,
1642
- step=1,
1643
- interactive=True,
1644
- visible=False
1645
- )
1646
- rms_mix_rate0 = gr.Slider(
1647
- minimum=0,
1648
- maximum=1,
1649
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
1650
- value=0.21,
1651
- interactive=True,
1652
- )
1653
- protect0 = gr.Slider(
1654
- minimum=0,
1655
- maximum=0.5,
1656
- label=i18n("保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"),
1657
- value=0.33,
1658
- step=0.01,
1659
- interactive=True,
1660
- )
1661
- formanting = gr.Checkbox(
1662
- value=bool(DoFormant),
1663
- label="[EXPERIMENTAL] Formant shift inference audio",
1664
- info="Used for male to female and vice-versa conversions",
1665
- interactive=True,
1666
- visible=True,
1667
- )
1668
-
1669
- formant_preset = gr.Dropdown(
1670
- value='',
1671
- choices=get_fshift_presets(),
1672
- label="browse presets for formanting",
1673
- visible=bool(DoFormant),
1674
- )
1675
- formant_refresh_button = gr.Button(
1676
- value='\U0001f504',
1677
- visible=bool(DoFormant),
1678
- variant='primary',
1679
- )
1680
- #formant_refresh_button = ToolButton( elem_id='1')
1681
- #create_refresh_button(formant_preset, lambda: {"choices": formant_preset}, "refresh_list_shiftpresets")
1682
-
1683
- qfrency = gr.Slider(
1684
- value=Quefrency,
1685
- info="Default value is 1.0",
1686
- label="Quefrency for formant shifting",
1687
- minimum=0.0,
1688
- maximum=16.0,
1689
- step=0.1,
1690
- visible=bool(DoFormant),
1691
- interactive=True,
1692
- )
1693
- tmbre = gr.Slider(
1694
- value=Timbre,
1695
- info="Default value is 1.0",
1696
- label="Timbre for formant shifting",
1697
- minimum=0.0,
1698
- maximum=16.0,
1699
- step=0.1,
1700
- visible=bool(DoFormant),
1701
- interactive=True,
1702
- )
1703
-
1704
- formant_preset.change(fn=preset_apply, inputs=[formant_preset, qfrency, tmbre], outputs=[qfrency, tmbre])
1705
- frmntbut = gr.Button("Apply", variant="primary", visible=bool(DoFormant))
1706
- formanting.change(fn=formant_enabled,inputs=[formanting,qfrency,tmbre,frmntbut,formant_preset,formant_refresh_button],outputs=[formanting,qfrency,tmbre,frmntbut,formant_preset,formant_refresh_button])
1707
- frmntbut.click(fn=formant_apply,inputs=[qfrency, tmbre], outputs=[qfrency, tmbre])
1708
- formant_refresh_button.click(fn=update_fshift_presets,inputs=[formant_preset, qfrency, tmbre],outputs=[formant_preset, qfrency, tmbre])
1709
-
1710
- with gr.Row():
1711
- vc_output1 = gr.Textbox("")
1712
- f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"), visible=False)
1713
-
1714
- but0.click(
1715
- vc_single,
1716
- [
1717
- spk_item,
1718
- input_audio0,
1719
- vc_transform0,
1720
- f0_file,
1721
- f0method0,
1722
- file_index1,
1723
- # file_index2,
1724
- # file_big_npy1,
1725
- index_rate1,
1726
- filter_radius0,
1727
- resample_sr0,
1728
- rms_mix_rate0,
1729
- protect0,
1730
- crepe_hop_length
1731
- ],
1732
- [vc_output1, vc_output2],
1733
- )
1734
-
1735
- with gr.Accordion("Batch Conversion",open=False, visible=False):
1736
- with gr.Row():
1737
- with gr.Column():
1738
- vc_transform1 = gr.Number(
1739
- label=i18n("变调(整数, 半音数量, 升八度12降八度-12)"), value=0
1740
- )
1741
- opt_input = gr.Textbox(label=i18n("指定输出文件夹"), value="opt")
1742
- f0method1 = gr.Radio(
1743
- label=i18n(
1744
- "选择音高提取算法,输入歌声可用pm提速,harvest低音好但巨慢无比,crepe效果好但吃GPU"
1745
- ),
1746
- choices=["pm", "harvest", "crepe", "rmvpe"],
1747
- value="rmvpe",
1748
- interactive=True,
1749
- )
1750
- filter_radius1 = gr.Slider(
1751
- minimum=0,
1752
- maximum=7,
1753
- label=i18n(">=3则使用对harvest音高识别的结果使用中值滤波,数值为滤波半径,使用可以削弱哑音"),
1754
- value=3,
1755
- step=1,
1756
- interactive=True,
1757
- )
1758
- with gr.Column():
1759
- file_index3 = gr.Textbox(
1760
- label=i18n("特征检索库文件路径,为空则使用下拉的选择结果"),
1761
- value="",
1762
- interactive=True,
1763
- )
1764
- file_index4 = gr.Dropdown(
1765
- label=i18n("自动检测index路径,下拉式选择(dropdown)"),
1766
- choices=sorted(index_paths),
1767
- interactive=True,
1768
- )
1769
- refresh_button.click(
1770
- fn=lambda: change_choices()[1],
1771
- inputs=[],
1772
- outputs=file_index4,
1773
- )
1774
- # file_big_npy2 = gr.Textbox(
1775
- # label=i18n("特征文件路径"),
1776
- # value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
1777
- # interactive=True,
1778
- # )
1779
- index_rate2 = gr.Slider(
1780
- minimum=0,
1781
- maximum=1,
1782
- label=i18n("检索特征占比"),
1783
- value=1,
1784
- interactive=True,
1785
- )
1786
- with gr.Column():
1787
- resample_sr1 = gr.Slider(
1788
- minimum=0,
1789
- maximum=48000,
1790
- label=i18n("后处理重采样至最终采样率,0为不进行重采样"),
1791
- value=0,
1792
- step=1,
1793
- interactive=True,
1794
- )
1795
- rms_mix_rate1 = gr.Slider(
1796
- minimum=0,
1797
- maximum=1,
1798
- label=i18n("输入源音量包络替换输出音量包络融合比例,越靠近1越使用输出包络"),
1799
- value=1,
1800
- interactive=True,
1801
- )
1802
- protect1 = gr.Slider(
1803
- minimum=0,
1804
- maximum=0.5,
1805
- label=i18n(
1806
- "保护清辅音和呼吸声,防止电音撕裂等artifact,拉满0.5不开启,调低加大保护力度但可能降低索引效果"
1807
- ),
1808
- value=0.33,
1809
- step=0.01,
1810
- interactive=True,
1811
- )
1812
- with gr.Column():
1813
- dir_input = gr.Textbox(
1814
- label=i18n("输入待处理音频文件夹路径(去文件管理器地址栏拷就行了)"),
1815
- value="E:\codes\py39\\test-20230416b\\todo-songs",
1816
- )
1817
- inputs = gr.File(
1818
- file_count="multiple", label=i18n("也可批量输入音频文件, 二选一, 优先读文件夹")
1819
- )
1820
- with gr.Row():
1821
- format1 = gr.Radio(
1822
- label=i18n("导出文件格式"),
1823
- choices=["wav", "flac", "mp3", "m4a"],
1824
- value="flac",
1825
- interactive=True,
1826
- )
1827
- but1 = gr.Button(i18n("转换"), variant="primary")
1828
- vc_output3 = gr.Textbox(label=i18n("输出信息"))
1829
- but1.click(
1830
- vc_multi,
1831
- [
1832
- spk_item,
1833
- dir_input,
1834
- opt_input,
1835
- inputs,
1836
- vc_transform1,
1837
- f0method1,
1838
- file_index3,
1839
- file_index4,
1840
- # file_big_npy2,
1841
- index_rate2,
1842
- filter_radius1,
1843
- resample_sr1,
1844
- rms_mix_rate1,
1845
- protect1,
1846
- format1,
1847
- crepe_hop_length,
1848
- ],
1849
- [vc_output3],
1850
- )
1851
- but1.click(fn=lambda: easy_uploader.clear())
1852
- with gr.TabItem("Download Voice Models"):
1853
- with gr.Row():
1854
- url=gr.Textbox(label="Huggingface Link:")
1855
- with gr.Row():
1856
- model = gr.Textbox(label="Name of the model (without spaces):")
1857
- download_button=gr.Button("Download")
1858
- with gr.Row():
1859
- status_bar=gr.Textbox(label="Download Status")
1860
- download_button.click(fn=download_from_url, inputs=[url, model], outputs=[status_bar])
1861
- with gr.Row():
1862
- gr.Markdown(
1863
- """
1864
- Made with 💖 by Ilaria | Support her on [Ko-Fi](https://ko-fi.com/ilariaowo)
1865
- """
1866
- )
1867
-
1868
- def has_two_files_in_pretrained_folder():
1869
- pretrained_folder = "./pretrained/"
1870
- if not os.path.exists(pretrained_folder):
1871
- return False
1872
-
1873
- files_in_folder = os.listdir(pretrained_folder)
1874
- num_files = len(files_in_folder)
1875
- return num_files >= 2
1876
- print(
1877
- "=" * 50,
1878
- "Disabling Training, as ZeroGPU only supports a running time of 120 seconds.",
1879
- "Please use a local machine, or colab for training.",
1880
- "=" * 50,
1881
- )
1882
-
1883
- app.launch(share=False, quiet=False, max_threads=1022)
1884
- #endpain
 
1
+ import gradio as gr
2
+ import requests
3
+ import random
4
+ import os
5
+ import zipfile # built in module for unzipping files (thank god)
6
+ import librosa
7
+ import time
8
+ from infer_rvc_python import BaseLoader
9
+ from pydub import AudioSegment
10
+ from tts_voice import tts_order_voice
11
+ import edge_tts
12
+ import tempfile
13
+ import anyio
14
+ from audio_separator.separator import Separator
15
+
16
+
17
+ language_dict = tts_order_voice
18
+
19
+ # ilaria tts implementation :rofl:
20
+ async def text_to_speech_edge(text, language_code):
21
+ voice = language_dict[language_code]
22
+ communicate = edge_tts.Communicate(text, voice)
23
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
24
+ tmp_path = tmp_file.name
25
+
26
+ await communicate.save(tmp_path)
27
+
28
+ return tmp_path
29
+
30
+ # fucking dogshit toggle
31
+ try:
32
+ import spaces
33
+ spaces_status = True
34
+ except ImportError:
35
+ spaces_status = False
36
+
37
+ separator = Separator()
38
+ converter = BaseLoader(only_cpu=False, hubert_path=None, rmvpe_path=None) # <- yeah so like this handles rvc
39
+
40
+ global pth_file
41
+ global index_file
42
+
43
+ pth_file = "model.pth"
44
+ index_file = "model.index"
45
+
46
+ #CONFIGS
47
+ TEMP_DIR = "temp"
48
+ MODEL_PREFIX = "model"
49
+ PITCH_ALGO_OPT = [
50
+ "pm",
51
+ "harvest",
52
+ "crepe",
53
+ "rmvpe",
54
+ "rmvpe+",
55
+ ]
56
+ UVR_5_MODELS = [
57
+ {"model_name": "BS-Roformer-Viperx-1297", "checkpoint": "model_bs_roformer_ep_317_sdr_12.9755.ckpt"},
58
+ {"model_name": "MDX23C-InstVoc HQ 2", "checkpoint": "MDX23C-8KFFT-InstVoc_HQ_2.ckpt"},
59
+ {"model_name": "Kim Vocal 2", "checkpoint": "Kim_Vocal_2.onnx"},
60
+ {"model_name": "5_HP-Karaoke", "checkpoint": "5_HP-Karaoke-UVR.pth"},
61
+ {"model_name": "UVR-DeNoise by FoxJoy", "checkpoint": "UVR-DeNoise.pth"},
62
+ {"model_name": "UVR-DeEcho-DeReverb by FoxJoy", "checkpoint": "UVR-DeEcho-DeReverb.pth"},
63
+ ]
64
+
65
+ os.makedirs(TEMP_DIR, exist_ok=True)
66
+
67
+ def unzip_file(file):
68
+ filename = os.path.basename(file).split(".")[0] # converts "model.zip" to "model" so we can do things
69
+ with zipfile.ZipFile(file, 'r') as zip_ref:
70
+ zip_ref.extractall(os.path.join(TEMP_DIR, filename)) # might not be very ram efficient...
71
+ return True
72
+
73
+
74
+ def progress_bar(total, current): # best progress bar ever trust me sunglasses emoji 😎
75
+ return "[" + "=" * int(current / total * 20) + ">" + " " * (20 - int(current / total * 20)) + "] " + str(int(current / total * 100)) + "%"
76
+
77
+ def download_from_url(url, filename=None):
78
+ if "/blob/" in url:
79
+ url = url.replace("/blob/", "/resolve/") # made it delik proof 😎
80
+ if "huggingface" not in url:
81
+ return ["The URL must be from huggingface", "Failed", "Failed"]
82
+ if filename is None:
83
+ filename = os.path.join(TEMP_DIR, MODEL_PREFIX + str(random.randint(1, 1000)) + ".zip")
84
+ response = requests.get(url)
85
+ total = int(response.headers.get('content-length', 0)) # bytes to download (length of the file)
86
+ if total > 500000000:
87
+
88
+ return ["The file is too large. You can only download files up to 500 MB in size.", "Failed", "Failed"]
89
+ current = 0
90
+ with open(filename, "wb") as f:
91
+ for data in response.iter_content(chunk_size=4096): # download in chunks of 4096 bytes (4kb - helps with memory usage and speed)
92
+ f.write(data)
93
+ current += len(data)
94
+ print(progress_bar(total, current), end="\r") # \r is a carriage return, it moves the cursor to the start of the line so its like tqdm sunglasses emoji 😎
95
+
96
+ # unzip because the model is in a zip file lel
97
+
98
+ try:
99
+ unzip_file(filename)
100
+ except Exception as e:
101
+ return ["Failed to unzip the file", "Failed", "Failed"] # return early if it fails and like tell the user but its dogshit hahahahahahaha 😎 According to all known laws aviation, there is no way a bee should be able to fly.
102
+ unzipped_dir = os.path.join(TEMP_DIR, os.path.basename(filename).split(".")[0]) # just do what we did in unzip_file because we need the directory
103
+ pth_files = []
104
+ index_files = []
105
+ for root, dirs, files in os.walk(unzipped_dir): # could be done more efficiently because nobody stores models in subdirectories but like who cares (it's a futureproofing thing lel)
106
+ for file in files:
107
+ if file.endswith(".pth"):
108
+ pth_files.append(os.path.join(root, file))
109
+ elif file.endswith(".index"):
110
+ index_files.append(os.path.join(root, file))
111
+
112
+ print(pth_files, index_files) # debug print because im fucking stupid and i need to see what is going on
113
+ global pth_file
114
+ global index_file
115
+ pth_file = pth_files[0]
116
+ index_file = index_files[0]
117
+
118
+ pth_file_ui.value = pth_file
119
+ index_file_ui.value = index_file
120
+ print(pth_file_ui.value)
121
+ print(index_file_ui.value)
122
+ return ["Downloaded as " + filename, pth_files[0], index_files[0]]
123
+
124
+ def inference(audio, model_name):
125
+ output_data = inf_handler(audio, model_name)
126
+ vocals = output_data[0]
127
+ inst = output_data[1]
128
+
129
+ return vocals, inst
130
+
131
+ if spaces_status:
132
+ @spaces.GPU()
133
+ def convert_now(audio_files, random_tag, converter):
134
+ return converter(
135
+ audio_files,
136
+ random_tag,
137
+ overwrite=False,
138
+ parallel_workers=8
139
+ )
140
+
141
+
142
+ else:
143
+ def convert_now(audio_files, random_tag, converter):
144
+ return converter(
145
+ audio_files,
146
+ random_tag,
147
+ overwrite=False,
148
+ parallel_workers=8
149
+ )
150
+
151
+ def calculate_remaining_time(epochs, seconds_per_epoch):
152
+ total_seconds = epochs * seconds_per_epoch
153
+
154
+ hours = total_seconds // 3600
155
+ minutes = (total_seconds % 3600) // 60
156
+ seconds = total_seconds % 60
157
+
158
+ if hours == 0:
159
+ return f"{int(minutes)} minutes"
160
+ elif hours == 1:
161
+ return f"{int(hours)} hour and {int(minutes)} minutes"
162
+ else:
163
+ return f"{int(hours)} hours and {int(minutes)} minutes"
164
+
165
+ def inf_handler(audio, model_name): # its a shame that zerogpu just WONT cooperate with us
166
+ model_found = False
167
+ for model_info in UVR_5_MODELS:
168
+ if model_info["model_name"] == model_name:
169
+ separator.load_model(model_info["checkpoint"])
170
+ model_found = True
171
+ break
172
+ if not model_found:
173
+ separator.load_model()
174
+ output_files = separator.separate(audio)
175
+ vocals = output_files[0]
176
+ inst = output_files[1]
177
+ return vocals, inst
178
+
179
+
180
+ def run(
181
+ audio_files,
182
+ pitch_alg,
183
+ pitch_lvl,
184
+ index_inf,
185
+ r_m_f,
186
+ e_r,
187
+ c_b_p,
188
+ ):
189
+ if not audio_files:
190
+ raise ValueError("The audio pls")
191
+
192
+ if isinstance(audio_files, str):
193
+ audio_files = [audio_files]
194
+
195
+ try:
196
+ duration_base = librosa.get_duration(filename=audio_files[0])
197
+ print("Duration:", duration_base)
198
+ except Exception as e:
199
+ print(e)
200
+
201
+ random_tag = "USER_"+str(random.randint(10000000, 99999999))
202
+
203
+ file_m = pth_file_ui.value
204
+ file_index = index_file_ui.value
205
+
206
+ print("Random tag:", random_tag)
207
+ print("File model:", file_m)
208
+ print("Pitch algorithm:", pitch_alg)
209
+ print("Pitch level:", pitch_lvl)
210
+ print("File index:", file_index)
211
+ print("Index influence:", index_inf)
212
+ print("Respiration median filtering:", r_m_f)
213
+ print("Envelope ratio:", e_r)
214
+
215
+ converter.apply_conf(
216
+ tag=random_tag,
217
+ file_model=file_m,
218
+ pitch_algo=pitch_alg,
219
+ pitch_lvl=pitch_lvl,
220
+ file_index=file_index,
221
+ index_influence=index_inf,
222
+ respiration_median_filtering=r_m_f,
223
+ envelope_ratio=e_r,
224
+ consonant_breath_protection=c_b_p,
225
+ resample_sr=44100 if audio_files[0].endswith('.mp3') else 0,
226
+ )
227
+ time.sleep(0.1)
228
+
229
+ result = convert_now(audio_files, random_tag, converter)
230
+ print("Result:", result)
231
+
232
+ return result[0]
233
+
234
+ def upload_model(index_file, pth_file):
235
+ pth_file = pth_file.name
236
+ index_file = index_file.name
237
+ pth_file_ui.value = pth_file
238
+ index_file_ui.value = index_file
239
+ return "Uploaded!"
240
+
241
+ with gr.Blocks(theme="Ilaria RVC") as demo:
242
+ gr.Markdown("## Ilaria RVC 💖")
243
+ with gr.Tab("Inference"):
244
+ sound_gui = gr.Audio(value=None,type="filepath",autoplay=False,visible=True,)
245
+ pth_file_ui = gr.Textbox(label="Model pth file",value=pth_file,visible=False,interactive=False,)
246
+ index_file_ui = gr.Textbox(label="Index pth file",value=index_file,visible=False,interactive=False,)
247
+
248
+ with gr.Accordion("Settings", open=False):
249
+ pitch_algo_conf = gr.Dropdown(PITCH_ALGO_OPT,value=PITCH_ALGO_OPT[4],label="Pitch algorithm",visible=True,interactive=True,)
250
+ pitch_lvl_conf = gr.Slider(label="Pitch level (lower -> 'male' while higher -> 'female')",minimum=-24,maximum=24,step=1,value=0,visible=True,interactive=True,)
251
+ index_inf_conf = gr.Slider(minimum=0,maximum=1,label="Index influence -> How much accent is applied",value=0.75,)
252
+ respiration_filter_conf = gr.Slider(minimum=0,maximum=7,label="Respiration median filtering",value=3,step=1,interactive=True,)
253
+ envelope_ratio_conf = gr.Slider(minimum=0,maximum=1,label="Envelope ratio",value=0.25,interactive=True,)
254
+ consonant_protec_conf = gr.Slider(minimum=0,maximum=0.5,label="Consonant breath protection",value=0.5,interactive=True,)
255
+
256
+ button_conf = gr.Button("Convert",variant="primary",)
257
+ output_conf = gr.Audio(type="filepath",label="Output",)
258
+
259
+ button_conf.click(lambda :None, None, output_conf)
260
+ button_conf.click(
261
+ run,
262
+ inputs=[
263
+ sound_gui,
264
+ pitch_algo_conf,
265
+ pitch_lvl_conf,
266
+ index_inf_conf,
267
+ respiration_filter_conf,
268
+ envelope_ratio_conf,
269
+ consonant_protec_conf,
270
+ ],
271
+ outputs=[output_conf],
272
+ )
273
+
274
+ with gr.Tab("Ilaria TTS"):
275
+ text_tts = gr.Textbox(label="Text", placeholder="Hello!", lines=3, interactive=True,)
276
+ dropdown_tts = gr.Dropdown(label="Language and Model",choices=list(language_dict.keys()),interactive=True, value=list(language_dict.keys())[0])
277
+
278
+ button_tts = gr.Button("Speak", variant="primary",)
279
+
280
+ output_tts = gr.Audio(type="filepath", label="Output",)
281
+
282
+ button_tts.click(text_to_speech_edge, inputs=[text_tts, dropdown_tts], outputs=[output_tts])
283
+
284
+
285
+ with gr.Tab("Model Loader (Download and Upload)"):
286
+ with gr.Accordion("Model Downloader", open=False):
287
+ gr.Markdown(
288
+ "Download the model from the following URL and upload it here. (Hugginface RVC model)"
289
+ )
290
+ model = gr.Textbox(lines=1, label="Model URL")
291
+ download_button = gr.Button("Download Model")
292
+ status = gr.Textbox(lines=1, label="Status", placeholder="Waiting....", interactive=False)
293
+ model_pth = gr.Textbox(lines=1, label="Model pth file", placeholder="Waiting....", interactive=False)
294
+ index_pth = gr.Textbox(lines=1, label="Index pth file", placeholder="Waiting....", interactive=False)
295
+ download_button.click(download_from_url, model, outputs=[status, model_pth, index_pth])
296
+ with gr.Accordion("Upload A Model", open=False):
297
+ index_file_upload = gr.File(label="Index File (.index)")
298
+ pth_file_upload = gr.File(label="Model File (.pth)")
299
+ upload_button = gr.Button("Upload Model")
300
+ upload_status = gr.Textbox(lines=1, label="Status", placeholder="Waiting....", interactive=False)
301
+
302
+ upload_button.click(upload_model, [index_file_upload, pth_file_upload], upload_status)
303
+
304
+
305
+ with gr.Tab("Vocal Separator (UVR)"):
306
+ gr.Markdown("Separate vocals and instruments from an audio file using UVR models. - This is only on CPU due to ZeroGPU being ZeroGPU :(")
307
+ uvr5_audio_file = gr.Audio(label="Audio File",type="filepath")
308
+
309
+ with gr.Row():
310
+ uvr5_model = gr.Dropdown(label="Model", choices=[model["model_name"] for model in UVR_5_MODELS])
311
+ uvr5_button = gr.Button("Separate Vocals", variant="primary",)
312
+
313
+ uvr5_output_voc = gr.Audio(type="filepath", label="Output 1",) # UVR models sometimes output it in a weird way where it's like the positions swap randomly, so let's just call them Outputs lol
314
+ uvr5_output_inst = gr.Audio(type="filepath", label="Output 2",)
315
+
316
+ uvr5_button.click(inference, [uvr5_audio_file, uvr5_model], [uvr5_output_voc, uvr5_output_inst])
317
+
318
+ with gr.Tab("Extra"):
319
+ with gr.Accordion("Training Time Calculator", open=False):
320
+ with gr.Column():
321
+ epochs_input = gr.Number(label="Number of Epochs")
322
+ seconds_input = gr.Number(label="Seconds per Epoch")
323
+ calculate_button = gr.Button("Calculate Time Remaining")
324
+ remaining_time_output = gr.Textbox(label="Remaining Time", interactive=False)
325
+
326
+ calculate_button.click(
327
+ fn=calculate_remaining_time,
328
+ inputs=[epochs_input, seconds_input],
329
+ outputs=[remaining_time_output]
330
+ )
331
+
332
+ with gr.Accordion("Model Fusion", open=False):
333
+ gr.Markdown(value="Fusion of two models to create a new model - coming soon! 😎")
334
+
335
+ with gr.Accordion("Model Quantization", open=False):
336
+ gr.Markdown(value="Quantization of a model to reduce its size - coming soon! 😎")
337
+
338
+ with gr.Accordion("Training Helper", open=False):
339
+ gr.Markdown(value="Help for training models - coming soon! 😎")
340
+
341
+ with gr.Tab("Credits"):
342
+ gr.Markdown(
343
+ """
344
+ Ilaria RVC made by [Ilaria](https://huggingface.co/TheStinger) suport her on [ko-fi](https://ko-fi.com/ilariaowo)
345
+
346
+ The Inference code is made by [r3gm](https://huggingface.co/r3gm) (his module helped form this space 💖)
347
+
348
+ made with ❤️ by [mikus](https://github.com/cappuch) - i make this ui........
349
+
350
+ ## In loving memory of JLabDX 🕊️
351
+ """
352
+ )
353
+
354
+ demo.queue(api_open=False).launch(show_api=False) # idk ilaria if you want or dont want to
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
+ model.index filter=lfs diff=lfs merge=lfs -text
model.index ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af434a9142b070f7091dcdbbf957b7a01bbc96294add99d186ef1e0d4b226eac
3
+ size 83987395
model.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:896fcee182ecdcea6645a691366ac50153bc63015f43c981da135a8cabe2f088
3
+ size 55028048
packages.txt CHANGED
@@ -1,3 +1 @@
1
- build-essential
2
- ffmpeg
3
- aria2
 
1
+ ffmpeg
 
 
requirements.txt CHANGED
@@ -1,23 +1,10 @@
1
- gTTS
2
- elevenlabs
3
- edge-tts
4
- stftpitchshift==1.5.1
5
- torchcrepe
6
- setuptools
7
- wheel
8
- httpx==0.24.1
9
- faiss-gpu
10
- fairseq @ git+https://github.com/cappuch/fairseq.git
11
- gradio==4.36.1
12
- ffmpeg-python
13
- praat-parselmouth
14
- pyworld
15
- numpy==1.23.5
16
- i18n
17
- numba==0.56.4
18
- librosa==0.9.2
19
- mega.py
20
- gdown @ git+https://github.com/IAHispano/gdown.git
21
- onnxruntime
22
- pyngrok==4.1.12
23
- torch
 
1
+ torch==2.2.0
2
+ infer-rvc-python==1.1.0
3
+ edge-tts
4
+ pedalboard
5
+ noisereduce
6
+ numpy==1.23.5
7
+ audio-separator[gpu]
8
+ scipy
9
+ onnxruntime-gpu
10
+ samplerate
 
 
 
 
 
 
 
 
 
 
 
 
 
test.ogg ADDED
Binary file (73.4 kB). View file
 
tts_voice.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tts_order_voice = {'English-Jenny (Woman)': 'en-US-JennyNeural',
2
+ 'English-Guy (Man)': 'en-US-GuyNeural',
3
+ 'English-Ana (Woman)': 'en-US-AnaNeural',
4
+ 'English-Aria (Woman)': 'en-US-AriaNeural',
5
+ 'English-Christopher (Man)': 'en-US-ChristopherNeural',
6
+ 'English-Eric (Man)': 'en-US-EricNeural',
7
+ 'English-Michelle (Woman)': 'en-US-MichelleNeural',
8
+ 'English-Roger (Man)': 'en-US-RogerNeural',
9
+ 'Spanish (Mexican)-Dalia (Woman)': 'es-MX-DaliaNeural',
10
+ 'Spanish (Mexican)-Jorge- (Man)': 'es-MX-JorgeNeural',
11
+ 'Korean-Sun-Hi- (Woman)': 'ko-KR-SunHiNeural',
12
+ 'Korean-InJoon- (Man)': 'ko-KR-InJoonNeural',
13
+ 'Thai-Premwadee- (Woman)': 'th-TH-PremwadeeNeural',
14
+ 'Thai-Niwat- (Man)': 'th-TH-NiwatNeural',
15
+ 'Vietnamese-HoaiMy- (Woman)': 'vi-VN-HoaiMyNeural',
16
+ 'Vietnamese-NamMinh- (Man)': 'vi-VN-NamMinhNeural',
17
+ 'Japanese-Nanami- (Woman)': 'ja-JP-NanamiNeural',
18
+ 'Japanese-Keita- (Man)': 'ja-JP-KeitaNeural',
19
+ 'French-Denise- (Woman)': 'fr-FR-DeniseNeural',
20
+ 'French-Eloise- (Woman)': 'fr-FR-EloiseNeural',
21
+ 'French-Henri- (Man)': 'fr-FR-HenriNeural',
22
+ 'Brazilian-Francisca- (Woman)': 'pt-BR-FranciscaNeural',
23
+ 'Brazilian-Antonio- (Man)': 'pt-BR-AntonioNeural',
24
+ 'Indonesian-Ardi- (Man)': 'id-ID-ArdiNeural',
25
+ 'Indonesian-Gadis- (Woman)': 'id-ID-GadisNeural',
26
+ 'Hebrew-Avri- (Man)': 'he-IL-AvriNeural',
27
+ 'Hebrew-Hila- (Woman)': 'he-IL-HilaNeural',
28
+ 'Italian-Isabella- (Woman)': 'it-IT-IsabellaNeural',
29
+ 'Italian-Diego- (Man)': 'it-IT-DiegoNeural',
30
+ 'Italian-Elsa- (Woman)': 'it-IT-ElsaNeural',
31
+ 'Dutch-Colette- (Woman)': 'nl-NL-ColetteNeural',
32
+ 'Dutch-Fenna- (Woman)': 'nl-NL-FennaNeural',
33
+ 'Dutch-Maarten- (Man)': 'nl-NL-MaartenNeural',
34
+ 'Malese-Osman- (Man)': 'ms-MY-OsmanNeural',
35
+ 'Malese-Yasmin- (Woman)': 'ms-MY-YasminNeural',
36
+ 'Norwegian-Pernille- (Woman)': 'nb-NO-PernilleNeural',
37
+ 'Norwegian-Finn- (Man)': 'nb-NO-FinnNeural',
38
+ 'Swedish-Sofie- (Woman)': 'sv-SE-SofieNeural',
39
+ 'ArabicSwedish-Mattias- (Man)': 'sv-SE-MattiasNeural',
40
+ 'Arabic-Hamed- (Man)': 'ar-SA-HamedNeural',
41
+ 'Arabic-Zariyah- (Woman)': 'ar-SA-ZariyahNeural',
42
+ 'Greek-Athina- (Woman)': 'el-GR-AthinaNeural',
43
+ 'Greek-Nestoras- (Man)': 'el-GR-NestorasNeural',
44
+ 'German-Katja- (Woman)': 'de-DE-KatjaNeural',
45
+ 'German-Amala- (Woman)': 'de-DE-AmalaNeural',
46
+ 'German-Conrad- (Man)': 'de-DE-ConradNeural',
47
+ 'German-Killian- (Man)': 'de-DE-KillianNeural',
48
+ 'Afrikaans-Adri- (Woman)': 'af-ZA-AdriNeural',
49
+ 'Afrikaans-Willem- (Man)': 'af-ZA-WillemNeural',
50
+ 'Ethiopian-Ameha- (Man)': 'am-ET-AmehaNeural',
51
+ 'Ethiopian-Mekdes- (Woman)': 'am-ET-MekdesNeural',
52
+ 'Arabic (UAD)-Fatima- (Woman)': 'ar-AE-FatimaNeural',
53
+ 'Arabic (UAD)-Hamdan- (Man)': 'ar-AE-HamdanNeural',
54
+ 'Arabic (Bahrain)-Ali- (Man)': 'ar-BH-AliNeural',
55
+ 'Arabic (Bahrain)-Laila- (Woman)': 'ar-BH-LailaNeural',
56
+ 'Arabic (Algeria)-Ismael- (Man)': 'ar-DZ-IsmaelNeural',
57
+ 'Arabic (Egypt)-Salma- (Woman)': 'ar-EG-SalmaNeural',
58
+ 'Arabic (Egypt)-Shakir- (Man)': 'ar-EG-ShakirNeural',
59
+ 'Arabic (Iraq)-Bassel- (Man)': 'ar-IQ-BasselNeural',
60
+ 'Arabic (Iraq)-Rana- (Woman)': 'ar-IQ-RanaNeural',
61
+ 'Arabic (Jordan)-Sana- (Woman)': 'ar-JO-SanaNeural',
62
+ 'Arabic (Jordan)-Taim- (Man)': 'ar-JO-TaimNeural',
63
+ 'Arabic (Kuwait)-Fahed- (Man)': 'ar-KW-FahedNeural',
64
+ 'Arabic (Kuwait)-Noura- (Woman)': 'ar-KW-NouraNeural',
65
+ 'Arabic (Lebanon)-Layla- (Woman)': 'ar-LB-LaylaNeural',
66
+ 'Arabic (Lebanon)-Rami- (Man)': 'ar-LB-RamiNeural',
67
+ 'Arabic (Libya)-Iman- (Woman)': 'ar-LY-ImanNeural',
68
+ 'Arabic (Libya)-Omar- (Man)': 'ar-LY-OmarNeural',
69
+ 'Arabic (Morocco)-Jamal- (Man)': 'ar-MA-JamalNeural',
70
+ 'Arabic (Morocco)-Mouna- (Woman)': 'ar-MA-MounaNeural',
71
+ 'Arabic (Oman)-Abdullah- (Man)': 'ar-OM-AbdullahNeural',
72
+ 'Arabic (Oman)-Aysha- (Woman)': 'ar-OM-AyshaNeural',
73
+ 'Arabic (Qatar)-Amal- (Woman)': 'ar-QA-AmalNeural',
74
+ 'Arabic (Qatar)-Moaz- (Man)': 'ar-QA-MoazNeural',
75
+ 'Arabic (Syrian Arab Republic)-Amany- (Woman)': 'ar-SY-AmanyNeural',
76
+ 'Arabic (Syrian Arab Republic)-Laith- (Man)': 'ar-SY-LaithNeural',
77
+ 'Arabic (Tunisia)-Hedi- (Man)': 'ar-TN-HediNeural',
78
+ 'Arabic (Tunisia)-Reem- (Woman)': 'ar-TN-ReemNeural',
79
+ 'Arabic (Yemen )-Maryam- (Woman)': 'ar-YE-MaryamNeural',
80
+ 'Arabic (Yemen )-Saleh- (Man)': 'ar-YE-SalehNeural',
81
+ 'Azerbaijani-Babek- (Man)': 'az-AZ-BabekNeural',
82
+ 'Azerbaijani-Banu- (Woman)': 'az-AZ-BanuNeural',
83
+ 'Bulgarian-Borislav- (Man)': 'bg-BG-BorislavNeural',
84
+ 'Bulgarian-Kalina- (Woman)': 'bg-BG-KalinaNeural',
85
+ 'Bengali (Bangladesh)-Nabanita- (Woman)': 'bn-BD-NabanitaNeural',
86
+ 'Bengali (Bangladesh)-Pradeep- (Man)': 'bn-BD-PradeepNeural',
87
+ 'Bengali (India)-Bashkar- (Man)': 'bn-IN-BashkarNeural',
88
+ 'Bengali (India)-Tanishaa- (Woman)': 'bn-IN-TanishaaNeural',
89
+ 'Bosniak (Bosnia and Herzegovina)-Goran- (Man)': 'bs-BA-GoranNeural',
90
+ 'Bosniak (Bosnia and Herzegovina)-Vesna- (Woman)': 'bs-BA-VesnaNeural',
91
+ 'Catalan (Spain)-Joana- (Woman)': 'ca-ES-JoanaNeural',
92
+ 'Catalan (Spain)-Enric- (Man)': 'ca-ES-EnricNeural',
93
+ 'Czech (Czech Republic)-Antonin- (Man)': 'cs-CZ-AntoninNeural',
94
+ 'Czech (Czech Republic)-Vlasta- (Woman)': 'cs-CZ-VlastaNeural',
95
+ 'Welsh (UK)-Aled- (Man)': 'cy-GB-AledNeural',
96
+ 'Welsh (UK)-Nia- (Woman)': 'cy-GB-NiaNeural',
97
+ 'Danish (Denmark)-Christel- (Woman)': 'da-DK-ChristelNeural',
98
+ 'Danish (Denmark)-Jeppe- (Man)': 'da-DK-JeppeNeural',
99
+ 'German (Austria)-Ingrid- (Woman)': 'de-AT-IngridNeural',
100
+ 'German (Austria)-Jonas- (Man)': 'de-AT-JonasNeural',
101
+ 'German (Switzerland)-Jan- (Man)': 'de-CH-JanNeural',
102
+ 'German (Switzerland)-Leni- (Woman)': 'de-CH-LeniNeural',
103
+ 'English (Australia)-Natasha- (Woman)': 'en-AU-NatashaNeural',
104
+ 'English (Australia)-William- (Man)': 'en-AU-WilliamNeural',
105
+ 'English (Canada)-Clara- (Woman)': 'en-CA-ClaraNeural',
106
+ 'English (Canada)-Liam- (Man)': 'en-CA-LiamNeural',
107
+ 'English (UK)-Libby- (Woman)': 'en-GB-LibbyNeural',
108
+ 'English (UK)-Maisie- (Woman)': 'en-GB-MaisieNeural',
109
+ 'English (UK)-Ryan- (Man)': 'en-GB-RyanNeural',
110
+ 'English (UK)-Sonia- (Woman)': 'en-GB-SoniaNeural',
111
+ 'English (UK)-Thomas- (Man)': 'en-GB-ThomasNeural',
112
+ 'English (Hong Kong)-Sam- (Man)': 'en-HK-SamNeural',
113
+ 'English (Hong Kong)-Yan- (Woman)': 'en-HK-YanNeural',
114
+ 'English (Ireland)-Connor- (Man)': 'en-IE-ConnorNeural',
115
+ 'English (Ireland)-Emily- (Woman)': 'en-IE-EmilyNeural',
116
+ 'English (India)-Neerja- (Woman)': 'en-IN-NeerjaNeural',
117
+ 'English (India)-Prabhat- (Man)': 'en-IN-PrabhatNeural',
118
+ 'English (Kenya)-Asilia- (Woman)': 'en-KE-AsiliaNeural',
119
+ 'English (Kenya)-Chilemba- (Man)': 'en-KE-ChilembaNeural',
120
+ 'English (Nigeria)-Abeo- (Man)': 'en-NG-AbeoNeural',
121
+ 'English (Nigeria)-Ezinne- (Woman)': 'en-NG-EzinneNeural',
122
+ 'English (New Zealand)-Mitchell- (Man)': 'en-NZ-MitchellNeural',
123
+ 'English (Philippines)-James- (Man)': 'en-PH-JamesNeural',
124
+ 'English (Philippines)-Rosa- (Woman)': 'en-PH-RosaNeural',
125
+ 'English (Singapore)-Luna- (Woman)': 'en-SG-LunaNeural',
126
+ 'English (Singapore)-Wayne- (Man)': 'en-SG-WayneNeural',
127
+ 'English (Tanzania)-Elimu- (Man)': 'en-TZ-ElimuNeural',
128
+ 'English (Tanzania)-Imani- (Woman)': 'en-TZ-ImaniNeural',
129
+ 'English (South Africa)-Leah- (Woman)': 'en-ZA-LeahNeural',
130
+ 'English (South Africa)-Luke- (Man)': 'en-ZA-LukeNeural',
131
+ 'Spanish (Argentina)-Elena- (Woman)': 'es-AR-ElenaNeural',
132
+ 'Spanish (Argentina)-Tomas- (Man)': 'es-AR-TomasNeural',
133
+ 'Spanish (Bolivia)-Marcelo- (Man)': 'es-BO-MarceloNeural',
134
+ 'Spanish (Bolivia)-Sofia- (Woman)': 'es-BO-SofiaNeural',
135
+ 'Spanish (Colombia)-Gonzalo- (Man)': 'es-CO-GonzaloNeural',
136
+ 'Spanish (Colombia)-Salome- (Woman)': 'es-CO-SalomeNeural',
137
+ 'Spanish (Costa Rica)-Juan- (Man)': 'es-CR-JuanNeural',
138
+ 'Spanish (Costa Rica)-Maria- (Woman)': 'es-CR-MariaNeural',
139
+ 'Spanish (Cuba)-Belkys- (Woman)': 'es-CU-BelkysNeural',
140
+ 'Spanish (Dominican Republic)-Emilio- (Man)': 'es-DO-EmilioNeural',
141
+ 'Spanish (Dominican Republic)-Ramona- (Woman)': 'es-DO-RamonaNeural',
142
+ 'Spanish (Ecuador)-Andrea- (Woman)': 'es-EC-AndreaNeural',
143
+ 'Spanish (Ecuador)-Luis- (Man)': 'es-EC-LuisNeural',
144
+ 'Spanish (Spain)-Alvaro- (Man)': 'es-ES-AlvaroNeural',
145
+ 'Spanish (Spain)-Elvira- (Woman)': 'es-ES-ElviraNeural',
146
+ 'Spanish (Equatorial Guinea)-Teresa- (Woman)': 'es-GQ-TeresaNeural',
147
+ 'Spanish (Guatemala)-Andres- (Man)': 'es-GT-AndresNeural',
148
+ 'Spanish (Guatemala)-Marta- (Woman)': 'es-GT-MartaNeural',
149
+ 'Spanish (Honduras)-Carlos- (Man)': 'es-HN-CarlosNeural',
150
+ 'Spanish (Honduras)-Karla- (Woman)': 'es-HN-KarlaNeural',
151
+ 'Spanish (Nicaragua)-Federico- (Man)': 'es-NI-FedericoNeural',
152
+ 'Spanish (Nicaragua)-Yolanda- (Woman)': 'es-NI-YolandaNeural',
153
+ 'Spanish (Panama)-Margarita- (Woman)': 'es-PA-MargaritaNeural',
154
+ 'Spanish (Panama)-Roberto- (Man)': 'es-PA-RobertoNeural',
155
+ 'Spanish (Peru)-Alex- (Man)': 'es-PE-AlexNeural',
156
+ 'Spanish (Peru)-Camila- (Woman)': 'es-PE-CamilaNeural',
157
+ 'Spanish (Puerto Rico)-Karina- (Woman)': 'es-PR-KarinaNeural',
158
+ 'Spanish (Puerto Rico)-Victor- (Man)': 'es-PR-VictorNeural',
159
+ 'Spanish (Paraguay)-Mario- (Man)': 'es-PY-MarioNeural',
160
+ 'Spanish (Paraguay)-Tania- (Woman)': 'es-PY-TaniaNeural',
161
+ 'Spanish (El Salvador)-Lorena- (Woman)': 'es-SV-LorenaNeural',
162
+ 'Spanish (El Salvador)-Rodrigo- (Man)': 'es-SV-RodrigoNeural',
163
+ 'Spanish (United States)-Alonso- (Man)': 'es-US-AlonsoNeural',
164
+ 'Spanish (United States)-Paloma- (Woman)': 'es-US-PalomaNeural',
165
+ 'Spanish (Uruguay)-Mateo- (Man)': 'es-UY-MateoNeural',
166
+ 'Spanish (Uruguay)-Valentina- (Woman)': 'es-UY-ValentinaNeural',
167
+ 'Spanish (Venezuela)-Paola- (Woman)': 'es-VE-PaolaNeural',
168
+ 'Spanish (Venezuela)-Sebastian- (Man)': 'es-VE-SebastianNeural',
169
+ 'Estonian (Estonia)-Anu- (Woman)': 'et-EE-AnuNeural',
170
+ 'Estonian (Estonia)-Kert- (Man)': 'et-EE-KertNeural',
171
+ 'Persian (Iran)-Dilara- (Woman)': 'fa-IR-DilaraNeural',
172
+ 'Persian (Iran)-Farid- (Man)': 'fa-IR-FaridNeural',
173
+ 'Finnish (Finland)-Harri- (Man)': 'fi-FI-HarriNeural',
174
+ 'Finnish (Finland)-Noora- (Woman)': 'fi-FI-NooraNeural',
175
+ 'French (Belgium)-Charline- (Woman)': 'fr-BE-CharlineNeural',
176
+ 'French (Belgium)-Gerard- (Man)': 'fr-BE-GerardNeural',
177
+ 'French (Canada)-Sylvie- (Woman)': 'fr-CA-SylvieNeural',
178
+ 'French (Canada)-Antoine- (Man)': 'fr-CA-AntoineNeural',
179
+ 'French (Canada)-Jean- (Man)': 'fr-CA-JeanNeural',
180
+ 'French (Switzerland)-Ariane- (Woman)': 'fr-CH-ArianeNeural',
181
+ 'French (Switzerland)-Fabrice- (Man)': 'fr-CH-FabriceNeural',
182
+ 'Irish (Ireland)-Colm- (Man)': 'ga-IE-ColmNeural',
183
+ 'Irish (Ireland)-Orla- (Woman)': 'ga-IE-OrlaNeural',
184
+ 'Galician (Spain)-Roi- (Man)': 'gl-ES-RoiNeural',
185
+ 'Galician (Spain)-Sabela- (Woman)': 'gl-ES-SabelaNeural',
186
+ 'Gujarati (India)-Dhwani- (Woman)': 'gu-IN-DhwaniNeural',
187
+ 'Gujarati (India)-Niranjan- (Man)': 'gu-IN-NiranjanNeural',
188
+ 'Hindi (India)-Madhur- (Man)': 'hi-IN-MadhurNeural',
189
+ 'Hindi (India)-Swara- (Woman)': 'hi-IN-SwaraNeural',
190
+ 'Croatian (Croatia)-Gabrijela- (Woman)': 'hr-HR-GabrijelaNeural',
191
+ 'Croatian (Croatia)-Srecko- (Man)': 'hr-HR-SreckoNeural',
192
+ 'Hungarian (Hungary)-Noemi- (Woman)': 'hu-HU-NoemiNeural',
193
+ 'Hungarian (Hungary)-Tamas- (Man)': 'hu-HU-TamasNeural',
194
+ 'Icelandic (Iceland)-Gudrun- (Woman)': 'is-IS-GudrunNeural',
195
+ 'Icelandic (Iceland)-Gunnar- (Man)': 'is-IS-GunnarNeural',
196
+ 'Javanese (Indonesia)-Dimas- (Man)': 'jv-ID-DimasNeural',
197
+ 'Javanese (Indonesia)-Siti- (Woman)': 'jv-ID-SitiNeural',
198
+ 'Georgian (Georgia)-Eka- (Woman)': 'ka-GE-EkaNeural',
199
+ 'Georgian (Georgia)-Giorgi- (Man)': 'ka-GE-GiorgiNeural',
200
+ 'Kazakh (Kazakhstan)-Aigul- (Woman)': 'kk-KZ-AigulNeural',
201
+ 'Kazakh (Kazakhstan)-Daulet- (Man)': 'kk-KZ-DauletNeural',
202
+ 'Khmer (Cambodia)-Piseth- (Man)': 'km-KH-PisethNeural',
203
+ 'Khmer (Cambodia)-Sreymom- (Woman)': 'km-KH-SreymomNeural',
204
+ 'Kannada (India)-Gagan- (Man)': 'kn-IN-GaganNeural',
205
+ 'Kannada (India)-Sapna- (Woman)': 'kn-IN-SapnaNeural',
206
+ 'Lao (Laos)-Chanthavong- (Man)': 'lo-LA-ChanthavongNeural',
207
+ 'Lao (Laos)-Keomany- (Woman)': 'lo-LA-KeomanyNeural',
208
+ 'Lithuanian (Lithuania)-Leonas- (Man)': 'lt-LT-LeonasNeural',
209
+ 'Lithuanian (Lithuania)-Ona- (Woman)': 'lt-LT-OnaNeural',
210
+ 'Latvian (Latvia)-Everita- (Woman)': 'lv-LV-EveritaNeural',
211
+ 'Latvian (Latvia)-Nils- (Man)': 'lv-LV-NilsNeural',
212
+ 'Macedonian (North Macedonia)-Aleksandar- (Man)': 'mk-MK-AleksandarNeural',
213
+ 'Macedonian (North Macedonia)-Marija- (Woman)': 'mk-MK-MarijaNeural',
214
+ 'Malayalam (India)-Midhun- (Man)': 'ml-IN-MidhunNeural',
215
+ 'Malayalam (India)-Sobhana- (Woman)': 'ml-IN-SobhanaNeural',
216
+ 'Mongolian (Mongolia)-Bataa- (Man)': 'mn-MN-BataaNeural',
217
+ 'Mongolian (Mongolia)-Yesui- (Woman)': 'mn-MN-YesuiNeural',
218
+ 'Marathi (India)-Aarohi- (Woman)': 'mr-IN-AarohiNeural',
219
+ 'Marathi (India)-Manohar- (Man)': 'mr-IN-ManoharNeural',
220
+ 'Maltese (Malta)-Grace- (Woman)': 'mt-MT-GraceNeural',
221
+ 'Maltese (Malta)-Joseph- (Man)': 'mt-MT-JosephNeural',
222
+ 'Burmese (Myanmar)-Nilar- (Woman)': 'my-MM-NilarNeural',
223
+ 'Burmese (Myanmar)-Thiha- (Man)': 'my-MM-ThihaNeural',
224
+ 'Nepali (Nepal)-Hemkala- (Woman)': 'ne-NP-HemkalaNeural',
225
+ 'Nepali (Nepal)-Sagar- (Man)': 'ne-NP-SagarNeural',
226
+ 'Dutch (Belgium)-Arnaud- (Man)': 'nl-BE-ArnaudNeural',
227
+ 'Dutch (Belgium)-Dena- (Woman)': 'nl-BE-DenaNeural',
228
+ 'Polish (Poland)-Marek- (Man)': 'pl-PL-MarekNeural',
229
+ 'Polish (Poland)-Zofia- (Woman)': 'pl-PL-ZofiaNeural',
230
+ 'Pashto (Afghanistan)-Gul Nawaz- (Man)': 'ps-AF-Gul',}