Update infer-web.py
Browse files- infer-web.py +194 -194
infer-web.py
CHANGED
|
@@ -58,7 +58,7 @@ torch.manual_seed(114514)
|
|
| 58 |
config = Config()
|
| 59 |
i18n = I18nAuto()
|
| 60 |
i18n.print()
|
| 61 |
-
#
|
| 62 |
ngpu = torch.cuda.device_count()
|
| 63 |
gpu_infos = []
|
| 64 |
mem = []
|
|
@@ -91,7 +91,7 @@ if torch.cuda.is_available() or ngpu != 0:
|
|
| 91 |
]
|
| 92 |
):
|
| 93 |
# A10#A100#V100#A40#P40#M40#K80#A4500
|
| 94 |
-
if_gpu_ok = True #
|
| 95 |
gpu_infos.append("%s\t%s" % (i, gpu_name))
|
| 96 |
mem.append(
|
| 97 |
int(
|
|
@@ -106,7 +106,7 @@ if if_gpu_ok and len(gpu_infos) > 0:
|
|
| 106 |
gpu_info = "\n".join(gpu_infos)
|
| 107 |
default_batch_size = min(mem) // 2
|
| 108 |
else:
|
| 109 |
-
gpu_info = i18n("
|
| 110 |
default_batch_size = 1
|
| 111 |
gpus = "-".join([i[0] for i in gpu_infos])
|
| 112 |
|
|
@@ -197,7 +197,7 @@ def vc_single(
|
|
| 197 |
)
|
| 198 |
if file_index != ""
|
| 199 |
else file_index2
|
| 200 |
-
) #
|
| 201 |
# file_big_npy = (
|
| 202 |
# file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
| 203 |
# )
|
|
@@ -263,7 +263,7 @@ def vc_multi(
|
|
| 263 |
try:
|
| 264 |
dir_path = (
|
| 265 |
dir_path.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
| 266 |
-
) #
|
| 267 |
opt_root = opt_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
| 268 |
os.makedirs(opt_root, exist_ok=True)
|
| 269 |
try:
|
|
@@ -402,18 +402,18 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format
|
|
| 402 |
yield "\n".join(infos)
|
| 403 |
|
| 404 |
|
| 405 |
-
#
|
| 406 |
def get_vc(sid, to_return_protect0, to_return_protect1):
|
| 407 |
global n_spk, tgt_sr, net_g, vc, cpt, version
|
| 408 |
if sid == "" or sid == []:
|
| 409 |
global hubert_model
|
| 410 |
-
if hubert_model is not None: #
|
| 411 |
print("clean_empty_cache")
|
| 412 |
del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
|
| 413 |
hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
|
| 414 |
if torch.cuda.is_available():
|
| 415 |
torch.cuda.empty_cache()
|
| 416 |
-
|
| 417 |
if_f0 = cpt.get("f0", 1)
|
| 418 |
version = cpt.get("version", "v1")
|
| 419 |
if version == "v1":
|
|
@@ -523,8 +523,8 @@ def if_done(done, p):
|
|
| 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() is None:
|
|
@@ -549,7 +549,7 @@ def preprocess_dataset(trainset_dir, exp_dir, sr, n_p):
|
|
| 549 |
)
|
| 550 |
print(cmd)
|
| 551 |
p = Popen(cmd, shell=True) # , stdin=PIPE, stdout=PIPE,stderr=PIPE,cwd=now_dir
|
| 552 |
-
|
| 553 |
done = [False]
|
| 554 |
threading.Thread(
|
| 555 |
target=if_done,
|
|
@@ -586,7 +586,7 @@ def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, version19, echl):
|
|
| 586 |
)
|
| 587 |
print(cmd)
|
| 588 |
p = Popen(cmd, shell=True, cwd=now_dir) # , stdin=PIPE, stdout=PIPE,stderr=PIPE
|
| 589 |
-
|
| 590 |
done = [False]
|
| 591 |
threading.Thread(
|
| 592 |
target=if_done,
|
|
@@ -607,7 +607,7 @@ def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, version19, echl):
|
|
| 607 |
log = f.read()
|
| 608 |
print(log)
|
| 609 |
yield log
|
| 610 |
-
|
| 611 |
"""
|
| 612 |
n_part=int(sys.argv[1])
|
| 613 |
i_part=int(sys.argv[2])
|
|
@@ -636,7 +636,7 @@ def extract_f0_feature(gpus, n_p, f0method, if_f0, exp_dir, version19, echl):
|
|
| 636 |
cmd, shell=True, cwd=now_dir
|
| 637 |
) # , shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=now_dir
|
| 638 |
ps.append(p)
|
| 639 |
-
|
| 640 |
done = [False]
|
| 641 |
threading.Thread(
|
| 642 |
target=if_done_multi,
|
|
@@ -779,7 +779,7 @@ def click_train(
|
|
| 779 |
if_save_every_weights18,
|
| 780 |
version19,
|
| 781 |
):
|
| 782 |
-
#
|
| 783 |
exp_dir = "%s/logs/%s" % (now_dir, exp_dir1)
|
| 784 |
os.makedirs(exp_dir, exist_ok=True)
|
| 785 |
gt_wavs_dir = "%s/0_gt_wavs" % (exp_dir)
|
|
@@ -846,7 +846,7 @@ def click_train(
|
|
| 846 |
with open("%s/filelist.txt" % exp_dir, "w") as f:
|
| 847 |
f.write("\n".join(opt))
|
| 848 |
print("write filelist done")
|
| 849 |
-
#
|
| 850 |
# 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"
|
| 851 |
print("use gpus:", gpus16)
|
| 852 |
if pretrained_G14 == "":
|
|
@@ -867,9 +867,9 @@ def click_train(
|
|
| 867 |
save_epoch10,
|
| 868 |
"-pg %s" % pretrained_G14 if pretrained_G14 != "" else "",
|
| 869 |
"-pd %s" % pretrained_D15 if pretrained_D15 != "" else "",
|
| 870 |
-
1 if if_save_latest13 == i18n("
|
| 871 |
-
1 if if_cache_gpu17 == i18n("
|
| 872 |
-
1 if if_save_every_weights18 == i18n("
|
| 873 |
version19,
|
| 874 |
)
|
| 875 |
)
|
|
@@ -886,16 +886,16 @@ def click_train(
|
|
| 886 |
save_epoch10,
|
| 887 |
"-pg %s" % pretrained_G14 if pretrained_G14 != "" else "\b",
|
| 888 |
"-pd %s" % pretrained_D15 if pretrained_D15 != "" else "\b",
|
| 889 |
-
1 if if_save_latest13 == i18n("
|
| 890 |
-
1 if if_cache_gpu17 == i18n("
|
| 891 |
-
1 if if_save_every_weights18 == i18n("
|
| 892 |
version19,
|
| 893 |
)
|
| 894 |
)
|
| 895 |
print(cmd)
|
| 896 |
p = Popen(cmd, shell=True, cwd=now_dir)
|
| 897 |
p.wait()
|
| 898 |
-
return "
|
| 899 |
|
| 900 |
|
| 901 |
# but4.click(train_index, [exp_dir1], info3)
|
|
@@ -908,10 +908,10 @@ def train_index(exp_dir1, version19):
|
|
| 908 |
else "%s/3_feature768" % (exp_dir)
|
| 909 |
)
|
| 910 |
if not os.path.exists(feature_dir):
|
| 911 |
-
return "
|
| 912 |
listdir_res = list(os.listdir(feature_dir))
|
| 913 |
if len(listdir_res) == 0:
|
| 914 |
-
return "
|
| 915 |
infos = []
|
| 916 |
npys = []
|
| 917 |
for name in sorted(listdir_res):
|
|
@@ -971,11 +971,11 @@ def train_index(exp_dir1, version19):
|
|
| 971 |
% (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
|
| 972 |
)
|
| 973 |
infos.append(
|
| 974 |
-
"
|
| 975 |
% (n_ivf, index_ivf.nprobe, exp_dir1, version19)
|
| 976 |
)
|
| 977 |
# faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
|
| 978 |
-
# infos.append("
|
| 979 |
yield "\n".join(infos)
|
| 980 |
|
| 981 |
|
|
@@ -1017,7 +1017,7 @@ def train1key(
|
|
| 1017 |
)
|
| 1018 |
|
| 1019 |
os.makedirs(model_log_dir, exist_ok=True)
|
| 1020 |
-
#########step1
|
| 1021 |
open(preprocess_log_path, "w").close()
|
| 1022 |
cmd = (
|
| 1023 |
config.python_cmd
|
|
@@ -1025,16 +1025,16 @@ def train1key(
|
|
| 1025 |
% (trainset_dir4, sr_dict[sr2], np7, model_log_dir)
|
| 1026 |
+ str(config.noparallel)
|
| 1027 |
)
|
| 1028 |
-
yield get_info_str(i18n("step1
|
| 1029 |
yield get_info_str(cmd)
|
| 1030 |
p = Popen(cmd, shell=True)
|
| 1031 |
p.wait()
|
| 1032 |
with open(preprocess_log_path, "r") as f:
|
| 1033 |
print(f.read())
|
| 1034 |
-
#########step2a
|
| 1035 |
open(extract_f0_feature_log_path, "w")
|
| 1036 |
if if_f0_3:
|
| 1037 |
-
yield get_info_str("step2a
|
| 1038 |
cmd = config.python_cmd + " extract_f0_print.py %s %s %s %s" % (
|
| 1039 |
model_log_dir,
|
| 1040 |
np7,
|
|
@@ -1047,9 +1047,9 @@ def train1key(
|
|
| 1047 |
with open(extract_f0_feature_log_path, "r") as f:
|
| 1048 |
print(f.read())
|
| 1049 |
else:
|
| 1050 |
-
yield get_info_str(i18n("step2a
|
| 1051 |
-
#######step2b
|
| 1052 |
-
yield get_info_str(i18n("step2b
|
| 1053 |
gpus = gpus16.split("-")
|
| 1054 |
leng = len(gpus)
|
| 1055 |
ps = []
|
|
@@ -1071,9 +1071,9 @@ def train1key(
|
|
| 1071 |
p.wait()
|
| 1072 |
with open(extract_f0_feature_log_path, "r") as f:
|
| 1073 |
print(f.read())
|
| 1074 |
-
#######step3a
|
| 1075 |
-
yield get_info_str(i18n("step3a
|
| 1076 |
-
#
|
| 1077 |
if if_f0_3:
|
| 1078 |
f0_dir = "%s/2a_f0" % model_log_dir
|
| 1079 |
f0nsf_dir = "%s/2b-f0nsf" % model_log_dir
|
|
@@ -1174,8 +1174,8 @@ def train1key(
|
|
| 1174 |
yield get_info_str(cmd)
|
| 1175 |
p = Popen(cmd, shell=True, cwd=now_dir)
|
| 1176 |
p.wait()
|
| 1177 |
-
yield get_info_str(i18n("
|
| 1178 |
-
#######step3b
|
| 1179 |
npys = []
|
| 1180 |
listdir_res = list(os.listdir(feature_dir))
|
| 1181 |
for name in sorted(listdir_res):
|
|
@@ -1234,10 +1234,10 @@ def train1key(
|
|
| 1234 |
% (model_log_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
|
| 1235 |
)
|
| 1236 |
yield get_info_str(
|
| 1237 |
-
"
|
| 1238 |
% (n_ivf, index_ivf.nprobe, exp_dir1, version19)
|
| 1239 |
)
|
| 1240 |
-
yield get_info_str(i18n("
|
| 1241 |
|
| 1242 |
|
| 1243 |
# ckpt_path2.change(change_info_,[ckpt_path2],[sr__,if_f0__])
|
|
@@ -1263,24 +1263,24 @@ def export_onnx(ModelPath, ExportedPath):
|
|
| 1263 |
vec_channels = 256 if cpt.get("version", "v1") == "v1" else 768
|
| 1264 |
|
| 1265 |
test_phone = torch.rand(1, 200, vec_channels) # hidden unit
|
| 1266 |
-
test_phone_lengths = torch.tensor([200]).long() # hidden unit
|
| 1267 |
-
test_pitch = torch.randint(size=(1, 200), low=5, high=255) #
|
| 1268 |
-
test_pitchf = torch.rand(1, 200) #
|
| 1269 |
-
test_ds = torch.LongTensor([0]) #
|
| 1270 |
-
test_rnd = torch.rand(1, 192, 200) #
|
| 1271 |
|
| 1272 |
-
device = "cpu" #
|
| 1273 |
|
| 1274 |
|
| 1275 |
net_g = SynthesizerTrnMsNSFsidM(
|
| 1276 |
*cpt["config"], is_half=False, version=cpt.get("version", "v1")
|
| 1277 |
-
) # fp32
|
| 1278 |
net_g.load_state_dict(cpt["weight"], strict=False)
|
| 1279 |
input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"]
|
| 1280 |
output_names = [
|
| 1281 |
"audio",
|
| 1282 |
]
|
| 1283 |
-
# net_g.construct_spkmixmap(n_speaker)
|
| 1284 |
torch.onnx.export(
|
| 1285 |
net_g,
|
| 1286 |
(
|
|
@@ -1421,9 +1421,9 @@ def cli_train(com):
|
|
| 1421 |
total_epoch = int(com[5]) # 10000
|
| 1422 |
batch_size = int(com[6])
|
| 1423 |
gpu_card_slot_numbers = com[7]
|
| 1424 |
-
if_save_latest = i18n("
|
| 1425 |
-
if_cache_gpu = i18n("
|
| 1426 |
-
if_save_every_weight = i18n("
|
| 1427 |
version = com[11]
|
| 1428 |
|
| 1429 |
pretrained_base = "pretrained/" if version == "v1" else "pretrained_v2/"
|
|
@@ -1621,11 +1621,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1621 |
gr.HTML("<h1> The Mangio-RVC-Fork 💻 </h1>")
|
| 1622 |
gr.Markdown(
|
| 1623 |
value=i18n(
|
| 1624 |
-
"
|
| 1625 |
)
|
| 1626 |
)
|
| 1627 |
with gr.Tabs():
|
| 1628 |
-
with gr.TabItem(i18n("
|
| 1629 |
# Inference Preset Row
|
| 1630 |
# with gr.Row():
|
| 1631 |
# mangio_preset = gr.Dropdown(label="Inference Preset", choices=sorted(get_presets()))
|
|
@@ -1636,14 +1636,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1636 |
|
| 1637 |
# Other RVC stuff
|
| 1638 |
with gr.Row():
|
| 1639 |
-
sid0 = gr.Dropdown(label=i18n("
|
| 1640 |
-
refresh_button = gr.Button(i18n("
|
| 1641 |
-
clean_button = gr.Button(i18n("
|
| 1642 |
spk_item = gr.Slider(
|
| 1643 |
minimum=0,
|
| 1644 |
maximum=2333,
|
| 1645 |
step=1,
|
| 1646 |
-
label=i18n("
|
| 1647 |
value=0,
|
| 1648 |
visible=False,
|
| 1649 |
interactive=True,
|
|
@@ -1651,20 +1651,20 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1651 |
clean_button.click(fn=clean, inputs=[], outputs=[sid0])
|
| 1652 |
with gr.Group():
|
| 1653 |
gr.Markdown(
|
| 1654 |
-
value=i18n("
|
| 1655 |
)
|
| 1656 |
with gr.Row():
|
| 1657 |
with gr.Column():
|
| 1658 |
vc_transform0 = gr.Number(
|
| 1659 |
-
label=i18n("
|
| 1660 |
)
|
| 1661 |
input_audio0 = gr.Textbox(
|
| 1662 |
-
label=i18n("
|
| 1663 |
-
value="E:\\codes\\py39\\test-20230416b\\todo-songs
|
| 1664 |
)
|
| 1665 |
f0method0 = gr.Radio(
|
| 1666 |
label=i18n(
|
| 1667 |
-
"
|
| 1668 |
),
|
| 1669 |
choices=["pm", "harvest", "dio", "crepe", "crepe-tiny", "mangio-crepe", "mangio-crepe-tiny"], # Fork Feature. Add Crepe-Tiny
|
| 1670 |
value="pm",
|
|
@@ -1681,19 +1681,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1681 |
filter_radius0 = gr.Slider(
|
| 1682 |
minimum=0,
|
| 1683 |
maximum=7,
|
| 1684 |
-
label=i18n(">=3
|
| 1685 |
value=3,
|
| 1686 |
step=1,
|
| 1687 |
interactive=True,
|
| 1688 |
)
|
| 1689 |
with gr.Column():
|
| 1690 |
file_index1 = gr.Textbox(
|
| 1691 |
-
label=i18n("
|
| 1692 |
value="",
|
| 1693 |
interactive=True,
|
| 1694 |
)
|
| 1695 |
file_index2 = gr.Dropdown(
|
| 1696 |
-
label=i18n("
|
| 1697 |
choices=sorted(index_paths),
|
| 1698 |
interactive=True,
|
| 1699 |
)
|
|
@@ -1701,14 +1701,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1701 |
fn=change_choices, inputs=[], outputs=[sid0, file_index2]
|
| 1702 |
)
|
| 1703 |
# file_big_npy1 = gr.Textbox(
|
| 1704 |
-
# label=i18n("
|
| 1705 |
# value="E:\\codes\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
|
| 1706 |
# interactive=True,
|
| 1707 |
# )
|
| 1708 |
index_rate1 = gr.Slider(
|
| 1709 |
minimum=0,
|
| 1710 |
maximum=1,
|
| 1711 |
-
label=i18n("
|
| 1712 |
value=0.88,
|
| 1713 |
interactive=True,
|
| 1714 |
)
|
|
@@ -1716,7 +1716,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1716 |
resample_sr0 = gr.Slider(
|
| 1717 |
minimum=0,
|
| 1718 |
maximum=48000,
|
| 1719 |
-
label=i18n("
|
| 1720 |
value=0,
|
| 1721 |
step=1,
|
| 1722 |
interactive=True,
|
|
@@ -1724,7 +1724,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1724 |
rms_mix_rate0 = gr.Slider(
|
| 1725 |
minimum=0,
|
| 1726 |
maximum=1,
|
| 1727 |
-
label=i18n("
|
| 1728 |
value=1,
|
| 1729 |
interactive=True,
|
| 1730 |
)
|
|
@@ -1732,17 +1732,17 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1732 |
minimum=0,
|
| 1733 |
maximum=0.5,
|
| 1734 |
label=i18n(
|
| 1735 |
-
"
|
| 1736 |
),
|
| 1737 |
value=0.33,
|
| 1738 |
step=0.01,
|
| 1739 |
interactive=True,
|
| 1740 |
)
|
| 1741 |
-
f0_file = gr.File(label=i18n("F0
|
| 1742 |
-
but0 = gr.Button(i18n("
|
| 1743 |
with gr.Row():
|
| 1744 |
-
vc_output1 = gr.Textbox(label=i18n("
|
| 1745 |
-
vc_output2 = gr.Audio(label=i18n("
|
| 1746 |
but0.click(
|
| 1747 |
vc_single,
|
| 1748 |
[
|
|
@@ -1765,17 +1765,17 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1765 |
)
|
| 1766 |
with gr.Group():
|
| 1767 |
gr.Markdown(
|
| 1768 |
-
value=i18n("
|
| 1769 |
)
|
| 1770 |
with gr.Row():
|
| 1771 |
with gr.Column():
|
| 1772 |
vc_transform1 = gr.Number(
|
| 1773 |
-
label=i18n("
|
| 1774 |
)
|
| 1775 |
-
opt_input = gr.Textbox(label=i18n("
|
| 1776 |
f0method1 = gr.Radio(
|
| 1777 |
label=i18n(
|
| 1778 |
-
"
|
| 1779 |
),
|
| 1780 |
choices=["pm", "harvest", "crepe"],
|
| 1781 |
value="pm",
|
|
@@ -1784,19 +1784,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1784 |
filter_radius1 = gr.Slider(
|
| 1785 |
minimum=0,
|
| 1786 |
maximum=7,
|
| 1787 |
-
label=i18n(">=3
|
| 1788 |
value=3,
|
| 1789 |
step=1,
|
| 1790 |
interactive=True,
|
| 1791 |
)
|
| 1792 |
with gr.Column():
|
| 1793 |
file_index3 = gr.Textbox(
|
| 1794 |
-
label=i18n("
|
| 1795 |
value="",
|
| 1796 |
interactive=True,
|
| 1797 |
)
|
| 1798 |
file_index4 = gr.Dropdown(
|
| 1799 |
-
label=i18n("
|
| 1800 |
choices=sorted(index_paths),
|
| 1801 |
interactive=True,
|
| 1802 |
)
|
|
@@ -1806,14 +1806,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1806 |
outputs=file_index4,
|
| 1807 |
)
|
| 1808 |
# file_big_npy2 = gr.Textbox(
|
| 1809 |
-
# label=i18n("
|
| 1810 |
# value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
|
| 1811 |
# interactive=True,
|
| 1812 |
# )
|
| 1813 |
index_rate2 = gr.Slider(
|
| 1814 |
minimum=0,
|
| 1815 |
maximum=1,
|
| 1816 |
-
label=i18n("
|
| 1817 |
value=1,
|
| 1818 |
interactive=True,
|
| 1819 |
)
|
|
@@ -1821,7 +1821,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1821 |
resample_sr1 = gr.Slider(
|
| 1822 |
minimum=0,
|
| 1823 |
maximum=48000,
|
| 1824 |
-
label=i18n("
|
| 1825 |
value=0,
|
| 1826 |
step=1,
|
| 1827 |
interactive=True,
|
|
@@ -1829,7 +1829,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1829 |
rms_mix_rate1 = gr.Slider(
|
| 1830 |
minimum=0,
|
| 1831 |
maximum=1,
|
| 1832 |
-
label=i18n("
|
| 1833 |
value=1,
|
| 1834 |
interactive=True,
|
| 1835 |
)
|
|
@@ -1837,7 +1837,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1837 |
minimum=0,
|
| 1838 |
maximum=0.5,
|
| 1839 |
label=i18n(
|
| 1840 |
-
"
|
| 1841 |
),
|
| 1842 |
value=0.33,
|
| 1843 |
step=0.01,
|
|
@@ -1845,21 +1845,21 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1845 |
)
|
| 1846 |
with gr.Column():
|
| 1847 |
dir_input = gr.Textbox(
|
| 1848 |
-
label=i18n("
|
| 1849 |
value="E:\codes\py39\\test-20230416b\\todo-songs",
|
| 1850 |
)
|
| 1851 |
inputs = gr.File(
|
| 1852 |
-
file_count="multiple", label=i18n("
|
| 1853 |
)
|
| 1854 |
with gr.Row():
|
| 1855 |
format1 = gr.Radio(
|
| 1856 |
-
label=i18n("
|
| 1857 |
choices=["wav", "flac", "mp3", "m4a"],
|
| 1858 |
value="flac",
|
| 1859 |
interactive=True,
|
| 1860 |
)
|
| 1861 |
-
but1 = gr.Button(i18n("
|
| 1862 |
-
vc_output3 = gr.Textbox(label=i18n("
|
| 1863 |
but1.click(
|
| 1864 |
vc_multi,
|
| 1865 |
[
|
|
@@ -1891,54 +1891,54 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1891 |
with gr.Group():
|
| 1892 |
gr.Markdown(
|
| 1893 |
value=i18n(
|
| 1894 |
-
"
|
| 1895 |
-
"
|
| 1896 |
-
"
|
| 1897 |
-
"1
|
| 1898 |
-
"2
|
| 1899 |
-
"3
|
| 1900 |
-
"
|
| 1901 |
-
" (234)DeEcho
|
| 1902 |
-
"
|
| 1903 |
-
"1
|
| 1904 |
-
"2
|
| 1905 |
-
"3
|
| 1906 |
)
|
| 1907 |
)
|
| 1908 |
with gr.Row():
|
| 1909 |
with gr.Column():
|
| 1910 |
dir_wav_input = gr.Textbox(
|
| 1911 |
-
label=i18n("
|
| 1912 |
value="E:\\codes\\py39\\test-20230416b\\todo-songs\\todo-songs",
|
| 1913 |
)
|
| 1914 |
wav_inputs = gr.File(
|
| 1915 |
-
file_count="multiple", label=i18n("
|
| 1916 |
)
|
| 1917 |
with gr.Column():
|
| 1918 |
-
model_choose = gr.Dropdown(label=i18n("
|
| 1919 |
agg = gr.Slider(
|
| 1920 |
minimum=0,
|
| 1921 |
maximum=20,
|
| 1922 |
step=1,
|
| 1923 |
-
label="
|
| 1924 |
value=10,
|
| 1925 |
interactive=True,
|
| 1926 |
-
visible=False, #
|
| 1927 |
)
|
| 1928 |
opt_vocal_root = gr.Textbox(
|
| 1929 |
-
label=i18n("
|
| 1930 |
)
|
| 1931 |
opt_ins_root = gr.Textbox(
|
| 1932 |
-
label=i18n("
|
| 1933 |
)
|
| 1934 |
format0 = gr.Radio(
|
| 1935 |
-
label=i18n("
|
| 1936 |
choices=["wav", "flac", "mp3", "m4a"],
|
| 1937 |
value="flac",
|
| 1938 |
interactive=True,
|
| 1939 |
)
|
| 1940 |
-
but2 = gr.Button(i18n("
|
| 1941 |
-
vc_output4 = gr.Textbox(label=i18n("
|
| 1942 |
but2.click(
|
| 1943 |
uvr,
|
| 1944 |
[
|
|
@@ -1952,28 +1952,28 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1952 |
],
|
| 1953 |
[vc_output4],
|
| 1954 |
)
|
| 1955 |
-
with gr.TabItem(i18n("
|
| 1956 |
gr.Markdown(
|
| 1957 |
value=i18n(
|
| 1958 |
-
"
|
| 1959 |
)
|
| 1960 |
)
|
| 1961 |
with gr.Row():
|
| 1962 |
-
exp_dir1 = gr.Textbox(label=i18n("
|
| 1963 |
sr2 = gr.Radio(
|
| 1964 |
-
label=i18n("
|
| 1965 |
choices=["40k", "48k"],
|
| 1966 |
value="40k",
|
| 1967 |
interactive=True,
|
| 1968 |
)
|
| 1969 |
if_f0_3 = gr.Radio(
|
| 1970 |
-
label=i18n("
|
| 1971 |
choices=[True, False],
|
| 1972 |
value=True,
|
| 1973 |
interactive=True,
|
| 1974 |
)
|
| 1975 |
version19 = gr.Radio(
|
| 1976 |
-
label=i18n("
|
| 1977 |
choices=["v1", "v2"],
|
| 1978 |
value="v1",
|
| 1979 |
interactive=True,
|
|
@@ -1983,39 +1983,39 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 1983 |
minimum=0,
|
| 1984 |
maximum=config.n_cpu,
|
| 1985 |
step=1,
|
| 1986 |
-
label=i18n("
|
| 1987 |
value=int(np.ceil(config.n_cpu / 1.5)),
|
| 1988 |
interactive=True,
|
| 1989 |
)
|
| 1990 |
-
with gr.Group(): #
|
| 1991 |
gr.Markdown(
|
| 1992 |
value=i18n(
|
| 1993 |
-
"step2a:
|
| 1994 |
)
|
| 1995 |
)
|
| 1996 |
with gr.Row():
|
| 1997 |
trainset_dir4 = gr.Textbox(
|
| 1998 |
-
label=i18n("
|
| 1999 |
)
|
| 2000 |
spk_id5 = gr.Slider(
|
| 2001 |
minimum=0,
|
| 2002 |
maximum=4,
|
| 2003 |
step=1,
|
| 2004 |
-
label=i18n("
|
| 2005 |
value=0,
|
| 2006 |
interactive=True,
|
| 2007 |
)
|
| 2008 |
-
but1 = gr.Button(i18n("
|
| 2009 |
-
info1 = gr.Textbox(label=i18n("
|
| 2010 |
but1.click(
|
| 2011 |
preprocess_dataset, [trainset_dir4, exp_dir1, sr2, np7], [info1]
|
| 2012 |
)
|
| 2013 |
with gr.Group():
|
| 2014 |
-
gr.Markdown(value=i18n("step2b:
|
| 2015 |
with gr.Row():
|
| 2016 |
with gr.Column():
|
| 2017 |
gpus6 = gr.Textbox(
|
| 2018 |
-
label=i18n("
|
| 2019 |
value=gpus,
|
| 2020 |
interactive=True,
|
| 2021 |
)
|
|
@@ -2023,7 +2023,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2023 |
with gr.Column():
|
| 2024 |
f0method8 = gr.Radio(
|
| 2025 |
label=i18n(
|
| 2026 |
-
"
|
| 2027 |
),
|
| 2028 |
choices=["pm", "harvest", "dio", "crepe", "mangio-crepe"], # Fork feature: Crepe on f0 extraction for training.
|
| 2029 |
value="harvest",
|
|
@@ -2037,21 +2037,21 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2037 |
value=64,
|
| 2038 |
interactive=True
|
| 2039 |
)
|
| 2040 |
-
but2 = gr.Button(i18n("
|
| 2041 |
-
info2 = gr.Textbox(label=i18n("
|
| 2042 |
but2.click(
|
| 2043 |
extract_f0_feature,
|
| 2044 |
[gpus6, np7, f0method8, if_f0_3, exp_dir1, version19, extraction_crepe_hop_length],
|
| 2045 |
[info2],
|
| 2046 |
)
|
| 2047 |
with gr.Group():
|
| 2048 |
-
gr.Markdown(value=i18n("step3:
|
| 2049 |
with gr.Row():
|
| 2050 |
save_epoch10 = gr.Slider(
|
| 2051 |
minimum=0,
|
| 2052 |
maximum=50,
|
| 2053 |
step=1,
|
| 2054 |
-
label=i18n("
|
| 2055 |
value=5,
|
| 2056 |
interactive=True,
|
| 2057 |
)
|
|
@@ -2059,7 +2059,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2059 |
minimum=0,
|
| 2060 |
maximum=10000,
|
| 2061 |
step=1,
|
| 2062 |
-
label=i18n("
|
| 2063 |
value=20,
|
| 2064 |
interactive=True,
|
| 2065 |
)
|
|
@@ -2067,38 +2067,38 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2067 |
minimum=1,
|
| 2068 |
maximum=40,
|
| 2069 |
step=1,
|
| 2070 |
-
label=i18n("
|
| 2071 |
value=default_batch_size,
|
| 2072 |
interactive=True,
|
| 2073 |
)
|
| 2074 |
if_save_latest13 = gr.Radio(
|
| 2075 |
-
label=i18n("
|
| 2076 |
-
choices=[i18n("
|
| 2077 |
-
value=i18n("
|
| 2078 |
interactive=True,
|
| 2079 |
)
|
| 2080 |
if_cache_gpu17 = gr.Radio(
|
| 2081 |
label=i18n(
|
| 2082 |
-
"
|
| 2083 |
),
|
| 2084 |
-
choices=[i18n("
|
| 2085 |
-
value=i18n("
|
| 2086 |
interactive=True,
|
| 2087 |
)
|
| 2088 |
if_save_every_weights18 = gr.Radio(
|
| 2089 |
-
label=i18n("
|
| 2090 |
-
choices=[i18n("
|
| 2091 |
-
value=i18n("
|
| 2092 |
interactive=True,
|
| 2093 |
)
|
| 2094 |
with gr.Row():
|
| 2095 |
pretrained_G14 = gr.Textbox(
|
| 2096 |
-
label=i18n("
|
| 2097 |
value="pretrained/f0G40k.pth",
|
| 2098 |
interactive=True,
|
| 2099 |
)
|
| 2100 |
pretrained_D15 = gr.Textbox(
|
| 2101 |
-
label=i18n("
|
| 2102 |
value="pretrained/f0D40k.pth",
|
| 2103 |
interactive=True,
|
| 2104 |
)
|
|
@@ -2118,14 +2118,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2118 |
[f0method8, pretrained_G14, pretrained_D15],
|
| 2119 |
)
|
| 2120 |
gpus16 = gr.Textbox(
|
| 2121 |
-
label=i18n("
|
| 2122 |
value=gpus,
|
| 2123 |
interactive=True,
|
| 2124 |
)
|
| 2125 |
-
but3 = gr.Button(i18n("
|
| 2126 |
-
but4 = gr.Button(i18n("
|
| 2127 |
-
but5 = gr.Button(i18n("
|
| 2128 |
-
info3 = gr.Textbox(label=i18n("
|
| 2129 |
but3.click(
|
| 2130 |
click_train,
|
| 2131 |
[
|
|
@@ -2172,50 +2172,50 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2172 |
info3,
|
| 2173 |
)
|
| 2174 |
|
| 2175 |
-
with gr.TabItem(i18n("ckpt
|
| 2176 |
with gr.Group():
|
| 2177 |
-
gr.Markdown(value=i18n("
|
| 2178 |
with gr.Row():
|
| 2179 |
-
ckpt_a = gr.Textbox(label=i18n("A
|
| 2180 |
-
ckpt_b = gr.Textbox(label=i18n("B
|
| 2181 |
alpha_a = gr.Slider(
|
| 2182 |
minimum=0,
|
| 2183 |
maximum=1,
|
| 2184 |
-
label=i18n("A
|
| 2185 |
value=0.5,
|
| 2186 |
interactive=True,
|
| 2187 |
)
|
| 2188 |
with gr.Row():
|
| 2189 |
sr_ = gr.Radio(
|
| 2190 |
-
label=i18n("
|
| 2191 |
choices=["40k", "48k"],
|
| 2192 |
value="40k",
|
| 2193 |
interactive=True,
|
| 2194 |
)
|
| 2195 |
if_f0_ = gr.Radio(
|
| 2196 |
-
label=i18n("
|
| 2197 |
-
choices=[i18n("
|
| 2198 |
-
value=i18n("
|
| 2199 |
interactive=True,
|
| 2200 |
)
|
| 2201 |
info__ = gr.Textbox(
|
| 2202 |
-
label=i18n("
|
| 2203 |
)
|
| 2204 |
name_to_save0 = gr.Textbox(
|
| 2205 |
-
label=i18n("
|
| 2206 |
value="",
|
| 2207 |
max_lines=1,
|
| 2208 |
interactive=True,
|
| 2209 |
)
|
| 2210 |
version_2 = gr.Radio(
|
| 2211 |
-
label=i18n("
|
| 2212 |
choices=["v1", "v2"],
|
| 2213 |
value="v1",
|
| 2214 |
interactive=True,
|
| 2215 |
)
|
| 2216 |
with gr.Row():
|
| 2217 |
-
but6 = gr.Button(i18n("
|
| 2218 |
-
info4 = gr.Textbox(label=i18n("
|
| 2219 |
but6.click(
|
| 2220 |
merge,
|
| 2221 |
[
|
|
@@ -2231,71 +2231,71 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2231 |
info4,
|
| 2232 |
) # def merge(path1,path2,alpha1,sr,f0,info):
|
| 2233 |
with gr.Group():
|
| 2234 |
-
gr.Markdown(value=i18n("
|
| 2235 |
with gr.Row():
|
| 2236 |
ckpt_path0 = gr.Textbox(
|
| 2237 |
-
label=i18n("
|
| 2238 |
)
|
| 2239 |
info_ = gr.Textbox(
|
| 2240 |
-
label=i18n("
|
| 2241 |
)
|
| 2242 |
name_to_save1 = gr.Textbox(
|
| 2243 |
-
label=i18n("
|
| 2244 |
value="",
|
| 2245 |
max_lines=8,
|
| 2246 |
interactive=True,
|
| 2247 |
)
|
| 2248 |
with gr.Row():
|
| 2249 |
-
but7 = gr.Button(i18n("
|
| 2250 |
-
info5 = gr.Textbox(label=i18n("
|
| 2251 |
but7.click(change_info, [ckpt_path0, info_, name_to_save1], info5)
|
| 2252 |
with gr.Group():
|
| 2253 |
-
gr.Markdown(value=i18n("
|
| 2254 |
with gr.Row():
|
| 2255 |
ckpt_path1 = gr.Textbox(
|
| 2256 |
-
label=i18n("
|
| 2257 |
)
|
| 2258 |
-
but8 = gr.Button(i18n("
|
| 2259 |
-
info6 = gr.Textbox(label=i18n("
|
| 2260 |
but8.click(show_info, [ckpt_path1], info6)
|
| 2261 |
with gr.Group():
|
| 2262 |
gr.Markdown(
|
| 2263 |
value=i18n(
|
| 2264 |
-
"
|
| 2265 |
)
|
| 2266 |
)
|
| 2267 |
with gr.Row():
|
| 2268 |
ckpt_path2 = gr.Textbox(
|
| 2269 |
-
label=i18n("
|
| 2270 |
value="E:\\codes\\py39\\logs\\mi-test_f0_48k\\G_23333.pth",
|
| 2271 |
interactive=True,
|
| 2272 |
)
|
| 2273 |
save_name = gr.Textbox(
|
| 2274 |
-
label=i18n("
|
| 2275 |
)
|
| 2276 |
sr__ = gr.Radio(
|
| 2277 |
-
label=i18n("
|
| 2278 |
choices=["32k", "40k", "48k"],
|
| 2279 |
value="40k",
|
| 2280 |
interactive=True,
|
| 2281 |
)
|
| 2282 |
if_f0__ = gr.Radio(
|
| 2283 |
-
label=i18n("
|
| 2284 |
choices=["1", "0"],
|
| 2285 |
value="1",
|
| 2286 |
interactive=True,
|
| 2287 |
)
|
| 2288 |
version_1 = gr.Radio(
|
| 2289 |
-
label=i18n("
|
| 2290 |
choices=["v1", "v2"],
|
| 2291 |
value="v2",
|
| 2292 |
interactive=True,
|
| 2293 |
)
|
| 2294 |
info___ = gr.Textbox(
|
| 2295 |
-
label=i18n("
|
| 2296 |
)
|
| 2297 |
-
but9 = gr.Button(i18n("
|
| 2298 |
-
info7 = gr.Textbox(label=i18n("
|
| 2299 |
ckpt_path2.change(
|
| 2300 |
change_info_, [ckpt_path2], [sr__, if_f0__, version_1]
|
| 2301 |
)
|
|
@@ -2305,23 +2305,23 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2305 |
info7,
|
| 2306 |
)
|
| 2307 |
|
| 2308 |
-
with gr.TabItem(i18n("Onnx
|
| 2309 |
with gr.Row():
|
| 2310 |
-
ckpt_dir = gr.Textbox(label=i18n("RVC
|
| 2311 |
with gr.Row():
|
| 2312 |
onnx_dir = gr.Textbox(
|
| 2313 |
-
label=i18n("Onnx
|
| 2314 |
)
|
| 2315 |
with gr.Row():
|
| 2316 |
infoOnnx = gr.Label(label="info")
|
| 2317 |
with gr.Row():
|
| 2318 |
-
butOnnx = gr.Button(i18n("
|
| 2319 |
butOnnx.click(export_onnx, [ckpt_dir, onnx_dir], infoOnnx)
|
| 2320 |
|
| 2321 |
-
tab_faq = i18n("
|
| 2322 |
with gr.TabItem(tab_faq):
|
| 2323 |
try:
|
| 2324 |
-
if tab_faq == "
|
| 2325 |
with open("docs/faq.md", "r", encoding="utf8") as f:
|
| 2326 |
info = f.read()
|
| 2327 |
else:
|
|
@@ -2453,9 +2453,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 2453 |
# )
|
| 2454 |
#endregion
|
| 2455 |
|
| 2456 |
-
# with gr.TabItem(i18n("
|
| 2457 |
-
# gr.Markdown(value=i18n("
|
| 2458 |
-
# with gr.TabItem(i18n("
|
| 2459 |
# gr.Markdown(value=i18n("xxxxx"))
|
| 2460 |
|
| 2461 |
if config.iscolab or config.paperspace: # Share gradio link for colab and paperspace (FORK FEATURE)
|
|
|
|
| 58 |
config = Config()
|
| 59 |
i18n = I18nAuto()
|
| 60 |
i18n.print()
|
| 61 |
+
# Determine whether there is an N card that can be used for training and accelerated reasoning
|
| 62 |
ngpu = torch.cuda.device_count()
|
| 63 |
gpu_infos = []
|
| 64 |
mem = []
|
|
|
|
| 91 |
]
|
| 92 |
):
|
| 93 |
# A10#A100#V100#A40#P40#M40#K80#A4500
|
| 94 |
+
if_gpu_ok = True # At least one usable Nvidia card
|
| 95 |
gpu_infos.append("%s\t%s" % (i, gpu_name))
|
| 96 |
mem.append(
|
| 97 |
int(
|
|
|
|
| 106 |
gpu_info = "\n".join(gpu_infos)
|
| 107 |
default_batch_size = min(mem) // 2
|
| 108 |
else:
|
| 109 |
+
gpu_info = i18n("Unfortunately you don't have a working graphics card to support your training.")
|
| 110 |
default_batch_size = 1
|
| 111 |
gpus = "-".join([i[0] for i in gpu_infos])
|
| 112 |
|
|
|
|
| 197 |
)
|
| 198 |
if file_index != ""
|
| 199 |
else file_index2
|
| 200 |
+
) # Prevent newbies from making mistakes and automatically replace them for them
|
| 201 |
# file_big_npy = (
|
| 202 |
# file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
| 203 |
# )
|
|
|
|
| 263 |
try:
|
| 264 |
dir_path = (
|
| 265 |
dir_path.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
| 266 |
+
) # Prevent newbies from copying the path with spaces, " and carriage returns at the beginning and end
|
| 267 |
opt_root = opt_root.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
| 268 |
os.makedirs(opt_root, exist_ok=True)
|
| 269 |
try:
|
|
|
|
| 402 |
yield "\n".join(infos)
|
| 403 |
|
| 404 |
|
| 405 |
+
# A tab can only have one sound globally.
|
| 406 |
def get_vc(sid, to_return_protect0, to_return_protect1):
|
| 407 |
global n_spk, tgt_sr, net_g, vc, cpt, version
|
| 408 |
if sid == "" or sid == []:
|
| 409 |
global hubert_model
|
| 410 |
+
if hubert_model is not None: # Considering polling, we need to add a check to see if the sid is switched from a model to a model-free state.
|
| 411 |
print("clean_empty_cache")
|
| 412 |
del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
|
| 413 |
hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
|
| 414 |
if torch.cuda.is_available():
|
| 415 |
torch.cuda.empty_cache()
|
| 416 |
+
###The downstairs won't be clean without this much trouble
|
| 417 |
if_f0 = cpt.get("f0", 1)
|
| 418 |
version = cpt.get("version", "v1")
|
| 419 |
if version == "v1":
|
|
|
|
| 523 |
|
| 524 |
def if_done_multi(done, ps):
|
| 525 |
while 1:
|
| 526 |
+
# poll==None means the process is not finished
|
| 527 |
+
# As long as there is a process that has not ended, it will not stop.
|
| 528 |
flag = 1
|
| 529 |
for p in ps:
|
| 530 |
if p.poll() is None:
|
|
|
|
| 549 |
)
|
| 550 |
print(cmd)
|
| 551 |
p = Popen(cmd, shell=True) # , stdin=PIPE, stdout=PIPE,stderr=PIPE,cwd=now_dir
|
| 552 |
+
###Damn, gr and popen read both have to run completely and then read at once. Without gr, it can just read and output one sentence at a time. I can only create an additional text stream to read at a fixed time.
|
| 553 |
done = [False]
|
| 554 |
threading.Thread(
|
| 555 |
target=if_done,
|
|
|
|
| 586 |
)
|
| 587 |
print(cmd)
|
| 588 |
p = Popen(cmd, shell=True, cwd=now_dir) # , stdin=PIPE, stdout=PIPE,stderr=PIPE
|
| 589 |
+
###Damn, gr and popen read both have to run completely and then read at once. Without gr, it can just read and output one sentence at a time. I can only create an additional text stream to read at a fixed time.
|
| 590 |
done = [False]
|
| 591 |
threading.Thread(
|
| 592 |
target=if_done,
|
|
|
|
| 607 |
log = f.read()
|
| 608 |
print(log)
|
| 609 |
yield log
|
| 610 |
+
####Open multiple processes for different parts
|
| 611 |
"""
|
| 612 |
n_part=int(sys.argv[1])
|
| 613 |
i_part=int(sys.argv[2])
|
|
|
|
| 636 |
cmd, shell=True, cwd=now_dir
|
| 637 |
) # , shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=now_dir
|
| 638 |
ps.append(p)
|
| 639 |
+
###Damn, gr and popen read both have to run completely and then read at once. Without gr, it can just read and output one sentence at a time. I can only create an additional text stream to read at a fixed time.
|
| 640 |
done = [False]
|
| 641 |
threading.Thread(
|
| 642 |
target=if_done_multi,
|
|
|
|
| 779 |
if_save_every_weights18,
|
| 780 |
version19,
|
| 781 |
):
|
| 782 |
+
# Generate filelist
|
| 783 |
exp_dir = "%s/logs/%s" % (now_dir, exp_dir1)
|
| 784 |
os.makedirs(exp_dir, exist_ok=True)
|
| 785 |
gt_wavs_dir = "%s/0_gt_wavs" % (exp_dir)
|
|
|
|
| 846 |
with open("%s/filelist.txt" % exp_dir, "w") as f:
|
| 847 |
f.write("\n".join(opt))
|
| 848 |
print("write filelist done")
|
| 849 |
+
# Generate config#No need to generate config
|
| 850 |
# 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"
|
| 851 |
print("use gpus:", gpus16)
|
| 852 |
if pretrained_G14 == "":
|
|
|
|
| 867 |
save_epoch10,
|
| 868 |
"-pg %s" % pretrained_G14 if pretrained_G14 != "" else "",
|
| 869 |
"-pd %s" % pretrained_D15 if pretrained_D15 != "" else "",
|
| 870 |
+
1 if if_save_latest13 == i18n("yes") else 0,
|
| 871 |
+
1 if if_cache_gpu17 == i18n("yes") else 0,
|
| 872 |
+
1 if if_save_every_weights18 == i18n("yes") else 0,
|
| 873 |
version19,
|
| 874 |
)
|
| 875 |
)
|
|
|
|
| 886 |
save_epoch10,
|
| 887 |
"-pg %s" % pretrained_G14 if pretrained_G14 != "" else "\b",
|
| 888 |
"-pd %s" % pretrained_D15 if pretrained_D15 != "" else "\b",
|
| 889 |
+
1 if if_save_latest13 == i18n("yes") else 0,
|
| 890 |
+
1 if if_cache_gpu17 == i18n("yes") else 0,
|
| 891 |
+
1 if if_save_every_weights18 == i18n("yes") else 0,
|
| 892 |
version19,
|
| 893 |
)
|
| 894 |
)
|
| 895 |
print(cmd)
|
| 896 |
p = Popen(cmd, shell=True, cwd=now_dir)
|
| 897 |
p.wait()
|
| 898 |
+
return "After the training is completed, you can view the console training log or train.log in the experiment folder."
|
| 899 |
|
| 900 |
|
| 901 |
# but4.click(train_index, [exp_dir1], info3)
|
|
|
|
| 908 |
else "%s/3_feature768" % (exp_dir)
|
| 909 |
)
|
| 910 |
if not os.path.exists(feature_dir):
|
| 911 |
+
return "Please perform feature extraction first!"
|
| 912 |
listdir_res = list(os.listdir(feature_dir))
|
| 913 |
if len(listdir_res) == 0:
|
| 914 |
+
return "Please perform feature extraction first!"
|
| 915 |
infos = []
|
| 916 |
npys = []
|
| 917 |
for name in sorted(listdir_res):
|
|
|
|
| 971 |
% (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
|
| 972 |
)
|
| 973 |
infos.append(
|
| 974 |
+
"Successfully built index, added_IVF%s_Flat_nprobe_%s_%s_%s.index"
|
| 975 |
% (n_ivf, index_ivf.nprobe, exp_dir1, version19)
|
| 976 |
)
|
| 977 |
# faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
|
| 978 |
+
# infos.append("Index built successfully,added_IVF%s_Flat_FastScan_%s.index"%(n_ivf,version19))
|
| 979 |
yield "\n".join(infos)
|
| 980 |
|
| 981 |
|
|
|
|
| 1017 |
)
|
| 1018 |
|
| 1019 |
os.makedirs(model_log_dir, exist_ok=True)
|
| 1020 |
+
#########step1:Process data
|
| 1021 |
open(preprocess_log_path, "w").close()
|
| 1022 |
cmd = (
|
| 1023 |
config.python_cmd
|
|
|
|
| 1025 |
% (trainset_dir4, sr_dict[sr2], np7, model_log_dir)
|
| 1026 |
+ str(config.noparallel)
|
| 1027 |
)
|
| 1028 |
+
yield get_info_str(i18n("step1:Processing data"))
|
| 1029 |
yield get_info_str(cmd)
|
| 1030 |
p = Popen(cmd, shell=True)
|
| 1031 |
p.wait()
|
| 1032 |
with open(preprocess_log_path, "r") as f:
|
| 1033 |
print(f.read())
|
| 1034 |
+
#########step2a:extract pitch
|
| 1035 |
open(extract_f0_feature_log_path, "w")
|
| 1036 |
if if_f0_3:
|
| 1037 |
+
yield get_info_str("step2a:Extracting pitch")
|
| 1038 |
cmd = config.python_cmd + " extract_f0_print.py %s %s %s %s" % (
|
| 1039 |
model_log_dir,
|
| 1040 |
np7,
|
|
|
|
| 1047 |
with open(extract_f0_feature_log_path, "r") as f:
|
| 1048 |
print(f.read())
|
| 1049 |
else:
|
| 1050 |
+
yield get_info_str(i18n("step2a:No need to extract pitch"))
|
| 1051 |
+
#######step2b:Extract features
|
| 1052 |
+
yield get_info_str(i18n("step2b:Extracting features"))
|
| 1053 |
gpus = gpus16.split("-")
|
| 1054 |
leng = len(gpus)
|
| 1055 |
ps = []
|
|
|
|
| 1071 |
p.wait()
|
| 1072 |
with open(extract_f0_feature_log_path, "r") as f:
|
| 1073 |
print(f.read())
|
| 1074 |
+
#######step3a:Training model
|
| 1075 |
+
yield get_info_str(i18n("step3a:Training model"))
|
| 1076 |
+
# Generate filelist
|
| 1077 |
if if_f0_3:
|
| 1078 |
f0_dir = "%s/2a_f0" % model_log_dir
|
| 1079 |
f0nsf_dir = "%s/2b-f0nsf" % model_log_dir
|
|
|
|
| 1174 |
yield get_info_str(cmd)
|
| 1175 |
p = Popen(cmd, shell=True, cwd=now_dir)
|
| 1176 |
p.wait()
|
| 1177 |
+
yield get_info_str(i18n("After the training is completed, you can view the console training log or train.log in the experiment folder."))
|
| 1178 |
+
#######step3b:training index
|
| 1179 |
npys = []
|
| 1180 |
listdir_res = list(os.listdir(feature_dir))
|
| 1181 |
for name in sorted(listdir_res):
|
|
|
|
| 1234 |
% (model_log_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
|
| 1235 |
)
|
| 1236 |
yield get_info_str(
|
| 1237 |
+
"Index built successfully, added_IVF%s_Flat_nprobe_%s_%s_%s.index"
|
| 1238 |
% (n_ivf, index_ivf.nprobe, exp_dir1, version19)
|
| 1239 |
)
|
| 1240 |
+
yield get_info_str(i18n("The whole process is completed!"))
|
| 1241 |
|
| 1242 |
|
| 1243 |
# ckpt_path2.change(change_info_,[ckpt_path2],[sr__,if_f0__])
|
|
|
|
| 1263 |
vec_channels = 256 if cpt.get("version", "v1") == "v1" else 768
|
| 1264 |
|
| 1265 |
test_phone = torch.rand(1, 200, vec_channels) # hidden unit
|
| 1266 |
+
test_phone_lengths = torch.tensor([200]).long() # hidden unit Length (seemingly useless)
|
| 1267 |
+
test_pitch = torch.randint(size=(1, 200), low=5, high=255) # Fundamental frequency (in Hz)
|
| 1268 |
+
test_pitchf = torch.rand(1, 200) # NSF base frequency
|
| 1269 |
+
test_ds = torch.LongTensor([0]) # Speaker ID
|
| 1270 |
+
test_rnd = torch.rand(1, 192, 200) # Noise (adding random factors)
|
| 1271 |
|
| 1272 |
+
device = "cpu" # Device when exporting (does not affect the use of the model)
|
| 1273 |
|
| 1274 |
|
| 1275 |
net_g = SynthesizerTrnMsNSFsidM(
|
| 1276 |
*cpt["config"], is_half=False, version=cpt.get("version", "v1")
|
| 1277 |
+
) # fp32 export (C++ needs to manually rearrange memory to support fp16, so fp16 is not used for the time being)
|
| 1278 |
net_g.load_state_dict(cpt["weight"], strict=False)
|
| 1279 |
input_names = ["phone", "phone_lengths", "pitch", "pitchf", "ds", "rnd"]
|
| 1280 |
output_names = [
|
| 1281 |
"audio",
|
| 1282 |
]
|
| 1283 |
+
# net_g.construct_spkmixmap(n_speaker) export of multiple role mixed tracks
|
| 1284 |
torch.onnx.export(
|
| 1285 |
net_g,
|
| 1286 |
(
|
|
|
|
| 1421 |
total_epoch = int(com[5]) # 10000
|
| 1422 |
batch_size = int(com[6])
|
| 1423 |
gpu_card_slot_numbers = com[7]
|
| 1424 |
+
if_save_latest = i18n("yes") if (int(com[8]) == 1) else i18n("no")
|
| 1425 |
+
if_cache_gpu = i18n("yes") if (int(com[9]) == 1) else i18n("no")
|
| 1426 |
+
if_save_every_weight = i18n("yes") if (int(com[10]) == 1) else i18n("no")
|
| 1427 |
version = com[11]
|
| 1428 |
|
| 1429 |
pretrained_base = "pretrained/" if version == "v1" else "pretrained_v2/"
|
|
|
|
| 1621 |
gr.HTML("<h1> The Mangio-RVC-Fork 💻 </h1>")
|
| 1622 |
gr.Markdown(
|
| 1623 |
value=i18n(
|
| 1624 |
+
"This software is open source under the MIT agreement. The author does not have any control over the software. Those who use the software and spread the sounds derived from the software are fully responsible. <br>If you do not agree with this clause, you cannot use or reference any code and files in the software package. For details, see the root directory <b>Agreement to be followed-LICENSE.txt</b>."
|
| 1625 |
)
|
| 1626 |
)
|
| 1627 |
with gr.Tabs():
|
| 1628 |
+
with gr.TabItem(i18n("Model reasoning")):
|
| 1629 |
# Inference Preset Row
|
| 1630 |
# with gr.Row():
|
| 1631 |
# mangio_preset = gr.Dropdown(label="Inference Preset", choices=sorted(get_presets()))
|
|
|
|
| 1636 |
|
| 1637 |
# Other RVC stuff
|
| 1638 |
with gr.Row():
|
| 1639 |
+
sid0 = gr.Dropdown(label=i18n("Mystery Tone"), choices=sorted(names))
|
| 1640 |
+
refresh_button = gr.Button(i18n("Refresh the patch list and index path"), variant="primary")
|
| 1641 |
+
clean_button = gr.Button(i18n("Uninstalling sounds saves video memory"), variant="primary")
|
| 1642 |
spk_item = gr.Slider(
|
| 1643 |
minimum=0,
|
| 1644 |
maximum=2333,
|
| 1645 |
step=1,
|
| 1646 |
+
label=i18n("Please select the speaker id"),
|
| 1647 |
value=0,
|
| 1648 |
visible=False,
|
| 1649 |
interactive=True,
|
|
|
|
| 1651 |
clean_button.click(fn=clean, inputs=[], outputs=[sid0])
|
| 1652 |
with gr.Group():
|
| 1653 |
gr.Markdown(
|
| 1654 |
+
value=i18n("For male to female, +12key is recommended, for female to male, -12key is recommended. If the sound range explodes and causes timbre distortion, you can adjust it to the appropriate range yourself.")
|
| 1655 |
)
|
| 1656 |
with gr.Row():
|
| 1657 |
with gr.Column():
|
| 1658 |
vc_transform0 = gr.Number(
|
| 1659 |
+
label=i18n("Transpose(integer, number of semitones, octave up 12 octave down -12)"), value=0
|
| 1660 |
)
|
| 1661 |
input_audio0 = gr.Textbox(
|
| 1662 |
+
label=i18n("Enter the path of the audio file to be processed (the default is an example of the correct format)"),
|
| 1663 |
+
value="E:\\codes\\py39\\test-20230416b\\todo-songs\\winter flowers clip1.wav",
|
| 1664 |
)
|
| 1665 |
f0method0 = gr.Radio(
|
| 1666 |
label=i18n(
|
| 1667 |
+
"Select the pitch extraction algorithm. You can use pm to speed up the input singing voice. Harvest has good bass but is extremely slow. Crepe has good effect but consumes GPU."
|
| 1668 |
),
|
| 1669 |
choices=["pm", "harvest", "dio", "crepe", "crepe-tiny", "mangio-crepe", "mangio-crepe-tiny"], # Fork Feature. Add Crepe-Tiny
|
| 1670 |
value="pm",
|
|
|
|
| 1681 |
filter_radius0 = gr.Slider(
|
| 1682 |
minimum=0,
|
| 1683 |
maximum=7,
|
| 1684 |
+
label=i18n(">=3, use median filtering on the result of harvest pitch recognition, the value is the filter radius, which can reduce mute"),
|
| 1685 |
value=3,
|
| 1686 |
step=1,
|
| 1687 |
interactive=True,
|
| 1688 |
)
|
| 1689 |
with gr.Column():
|
| 1690 |
file_index1 = gr.Textbox(
|
| 1691 |
+
label=i18n("Feature retrieval library file path, if empty, use the drop-down selection result"),
|
| 1692 |
value="",
|
| 1693 |
interactive=True,
|
| 1694 |
)
|
| 1695 |
file_index2 = gr.Dropdown(
|
| 1696 |
+
label=i18n("Automatically detect index path, drop-down selection"),
|
| 1697 |
choices=sorted(index_paths),
|
| 1698 |
interactive=True,
|
| 1699 |
)
|
|
|
|
| 1701 |
fn=change_choices, inputs=[], outputs=[sid0, file_index2]
|
| 1702 |
)
|
| 1703 |
# file_big_npy1 = gr.Textbox(
|
| 1704 |
+
# label=i18n("Feature file path"),
|
| 1705 |
# value="E:\\codes\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
|
| 1706 |
# interactive=True,
|
| 1707 |
# )
|
| 1708 |
index_rate1 = gr.Slider(
|
| 1709 |
minimum=0,
|
| 1710 |
maximum=1,
|
| 1711 |
+
label=i18n("Search feature proportion"),
|
| 1712 |
value=0.88,
|
| 1713 |
interactive=True,
|
| 1714 |
)
|
|
|
|
| 1716 |
resample_sr0 = gr.Slider(
|
| 1717 |
minimum=0,
|
| 1718 |
maximum=48000,
|
| 1719 |
+
label=i18n("Post-processing resampling to the final sampling rate, 0 means no resampling"),
|
| 1720 |
value=0,
|
| 1721 |
step=1,
|
| 1722 |
interactive=True,
|
|
|
|
| 1724 |
rms_mix_rate0 = gr.Slider(
|
| 1725 |
minimum=0,
|
| 1726 |
maximum=1,
|
| 1727 |
+
label=i18n("The input source volume envelope replaces the output volume envelope blending ratio. The closer it is to 1, the more the output envelope is used."),
|
| 1728 |
value=1,
|
| 1729 |
interactive=True,
|
| 1730 |
)
|
|
|
|
| 1732 |
minimum=0,
|
| 1733 |
maximum=0.5,
|
| 1734 |
label=i18n(
|
| 1735 |
+
"Protects clear consonants and breathing sounds, and prevents electronic music tearing and other artifacts. It is not enabled when it is set to 0.5. It is more effective when it is lowered, but the indexing effect may be reduced."
|
| 1736 |
),
|
| 1737 |
value=0.33,
|
| 1738 |
step=0.01,
|
| 1739 |
interactive=True,
|
| 1740 |
)
|
| 1741 |
+
f0_file = gr.File(label=i18n("F0 curve file, optional, one line per pitch, replaces the default F0 and sharp and flat tones"))
|
| 1742 |
+
but0 = gr.Button(i18n("Convert"), variant="primary")
|
| 1743 |
with gr.Row():
|
| 1744 |
+
vc_output1 = gr.Textbox(label=i18n("Output information"))
|
| 1745 |
+
vc_output2 = gr.Audio(label=i18n("Output audio (three dots in the lower right corner, click to download)"))
|
| 1746 |
but0.click(
|
| 1747 |
vc_single,
|
| 1748 |
[
|
|
|
|
| 1765 |
)
|
| 1766 |
with gr.Group():
|
| 1767 |
gr.Markdown(
|
| 1768 |
+
value=i18n("Batch conversion, input the audio folder to be converted, or upload multiple audio files, and output the converted audio in the specified folder (default opt).")
|
| 1769 |
)
|
| 1770 |
with gr.Row():
|
| 1771 |
with gr.Column():
|
| 1772 |
vc_transform1 = gr.Number(
|
| 1773 |
+
label=i18n("Transpose(integer, number of semitones, octave up 12 octave down -12)"), value=0
|
| 1774 |
)
|
| 1775 |
+
opt_input = gr.Textbox(label=i18n("Specify output folder"), value="opt")
|
| 1776 |
f0method1 = gr.Radio(
|
| 1777 |
label=i18n(
|
| 1778 |
+
"Select the pitch extraction algorithm. You can use pm to speed up the input singing voice. Harvest has good bass but is extremely slow. Crepe has good effect but consumes GPU."
|
| 1779 |
),
|
| 1780 |
choices=["pm", "harvest", "crepe"],
|
| 1781 |
value="pm",
|
|
|
|
| 1784 |
filter_radius1 = gr.Slider(
|
| 1785 |
minimum=0,
|
| 1786 |
maximum=7,
|
| 1787 |
+
label=i18n(">=3, use median filtering on the result of harvest pitch recognition, the value is the filter radius, which can reduce mute"),
|
| 1788 |
value=3,
|
| 1789 |
step=1,
|
| 1790 |
interactive=True,
|
| 1791 |
)
|
| 1792 |
with gr.Column():
|
| 1793 |
file_index3 = gr.Textbox(
|
| 1794 |
+
label=i18n("Feature retrieval library file path, if empty, use the drop-down selection result"),
|
| 1795 |
value="",
|
| 1796 |
interactive=True,
|
| 1797 |
)
|
| 1798 |
file_index4 = gr.Dropdown(
|
| 1799 |
+
label=i18n("Automatically detect index path, drop-down selection"),
|
| 1800 |
choices=sorted(index_paths),
|
| 1801 |
interactive=True,
|
| 1802 |
)
|
|
|
|
| 1806 |
outputs=file_index4,
|
| 1807 |
)
|
| 1808 |
# file_big_npy2 = gr.Textbox(
|
| 1809 |
+
# label=i18n("Feature file path"),
|
| 1810 |
# value="E:\\codes\\py39\\vits_vc_gpu_train\\logs\\mi-test-1key\\total_fea.npy",
|
| 1811 |
# interactive=True,
|
| 1812 |
# )
|
| 1813 |
index_rate2 = gr.Slider(
|
| 1814 |
minimum=0,
|
| 1815 |
maximum=1,
|
| 1816 |
+
label=i18n("Search feature proportion"),
|
| 1817 |
value=1,
|
| 1818 |
interactive=True,
|
| 1819 |
)
|
|
|
|
| 1821 |
resample_sr1 = gr.Slider(
|
| 1822 |
minimum=0,
|
| 1823 |
maximum=48000,
|
| 1824 |
+
label=i18n("Post-processing resampling to the final sampling rate, 0 means no resampling"),
|
| 1825 |
value=0,
|
| 1826 |
step=1,
|
| 1827 |
interactive=True,
|
|
|
|
| 1829 |
rms_mix_rate1 = gr.Slider(
|
| 1830 |
minimum=0,
|
| 1831 |
maximum=1,
|
| 1832 |
+
label=i18n("The input source volume envelope replaces the output volume envelope blending ratio. The closer it is to 1, the more the output envelope is used."),
|
| 1833 |
value=1,
|
| 1834 |
interactive=True,
|
| 1835 |
)
|
|
|
|
| 1837 |
minimum=0,
|
| 1838 |
maximum=0.5,
|
| 1839 |
label=i18n(
|
| 1840 |
+
"Protects clear consonants and breathing sounds, and prevents electronic music tearing and other artifacts. It is not enabled when it is set to 0.5. It is more effective when it is lowered, but the indexing effect may be reduced."
|
| 1841 |
),
|
| 1842 |
value=0.33,
|
| 1843 |
step=0.01,
|
|
|
|
| 1845 |
)
|
| 1846 |
with gr.Column():
|
| 1847 |
dir_input = gr.Textbox(
|
| 1848 |
+
label=i18n("Enter the path of the audio folder to be processed (just copy it from the address bar of the file manager)"),
|
| 1849 |
value="E:\codes\py39\\test-20230416b\\todo-songs",
|
| 1850 |
)
|
| 1851 |
inputs = gr.File(
|
| 1852 |
+
file_count="multiple", label=i18n("You can also batch import audio files, choose one of the two, and read the folder first")
|
| 1853 |
)
|
| 1854 |
with gr.Row():
|
| 1855 |
format1 = gr.Radio(
|
| 1856 |
+
label=i18n("Export file format"),
|
| 1857 |
choices=["wav", "flac", "mp3", "m4a"],
|
| 1858 |
value="flac",
|
| 1859 |
interactive=True,
|
| 1860 |
)
|
| 1861 |
+
but1 = gr.Button(i18n("Convert"), variant="primary")
|
| 1862 |
+
vc_output3 = gr.Textbox(label=i18n("Output information"))
|
| 1863 |
but1.click(
|
| 1864 |
vc_multi,
|
| 1865 |
[
|
|
|
|
| 1891 |
with gr.Group():
|
| 1892 |
gr.Markdown(
|
| 1893 |
value=i18n(
|
| 1894 |
+
"Batch processing of vocal accompaniment separation, using the UVR5 model.<br>"
|
| 1895 |
+
"An example of a qualified folder path format: E:\\codes\\py39\\vits_vc_gpu\\White Deer Frost Flower Test Sample (just copy it from the address bar of the file manager). <br>"
|
| 1896 |
+
"Models are divided into three categories: <br>"
|
| 1897 |
+
"1. Preserve vocals: Choose this for audio without harmony, it preserves the main vocals better than HP5. There are two models built-in, HP2 and HP3. HP3 may slightly miss the accompaniment but preserves the main vocals a little better than HP2; <br>"
|
| 1898 |
+
"2. Keep only the main voice: Select this for audio with harmony, which may weaken the main voice. Built-in HP5 model; <br>"
|
| 1899 |
+
"3. De-reverberation and de-delay model (by FoxJoy):"
|
| 1900 |
+
" (1) MDX-Net (onnx_dereverb): is the best choice for dual-channel reverberation, and cannot remove single-channel reverberation;"
|
| 1901 |
+
" (234)DeEcho: Removes delay effects. Aggressive removes delay effects more thoroughly than Normal. DeReverb additionally removes reverberation and can remove mono reverberation, but it cannot completely remove high-frequency plate reverberation. <br>"
|
| 1902 |
+
"De-reverb/de-delay, attached:<br>"
|
| 1903 |
+
"1. The time consumption of DeEcho-DeReverb model is nearly twice that of the other two DeEcho models;<br>"
|
| 1904 |
+
"2. The MDX-Net-Dereverb model is quite slow;<br>"
|
| 1905 |
+
"3. The cleanest configuration I personally recommend is to use MDX-Net first and then DeEcho-Aggressive."
|
| 1906 |
)
|
| 1907 |
)
|
| 1908 |
with gr.Row():
|
| 1909 |
with gr.Column():
|
| 1910 |
dir_wav_input = gr.Textbox(
|
| 1911 |
+
label=i18n("Enter the path of the audio folder to be processed"),
|
| 1912 |
value="E:\\codes\\py39\\test-20230416b\\todo-songs\\todo-songs",
|
| 1913 |
)
|
| 1914 |
wav_inputs = gr.File(
|
| 1915 |
+
file_count="multiple", label=i18n("You can also batch import audio files, choose one of the two, and read the folder first")
|
| 1916 |
)
|
| 1917 |
with gr.Column():
|
| 1918 |
+
model_choose = gr.Dropdown(label=i18n("Model"), choices=uvr5_names)
|
| 1919 |
agg = gr.Slider(
|
| 1920 |
minimum=0,
|
| 1921 |
maximum=20,
|
| 1922 |
step=1,
|
| 1923 |
+
label="Vocal extraction aggressiveness",
|
| 1924 |
value=10,
|
| 1925 |
interactive=True,
|
| 1926 |
+
visible=False, # Not open for adjustment yet
|
| 1927 |
)
|
| 1928 |
opt_vocal_root = gr.Textbox(
|
| 1929 |
+
label=i18n("Specify the output folder for the lead vocals"), value="opt"
|
| 1930 |
)
|
| 1931 |
opt_ins_root = gr.Textbox(
|
| 1932 |
+
label=i18n("Specify the folder for outputting non-lead vocals"), value="opt"
|
| 1933 |
)
|
| 1934 |
format0 = gr.Radio(
|
| 1935 |
+
label=i18n("Export file format"),
|
| 1936 |
choices=["wav", "flac", "mp3", "m4a"],
|
| 1937 |
value="flac",
|
| 1938 |
interactive=True,
|
| 1939 |
)
|
| 1940 |
+
but2 = gr.Button(i18n("Convert"), variant="primary")
|
| 1941 |
+
vc_output4 = gr.Textbox(label=i18n("Output information"))
|
| 1942 |
but2.click(
|
| 1943 |
uvr,
|
| 1944 |
[
|
|
|
|
| 1952 |
],
|
| 1953 |
[vc_output4],
|
| 1954 |
)
|
| 1955 |
+
with gr.TabItem(i18n("train")):
|
| 1956 |
gr.Markdown(
|
| 1957 |
value=i18n(
|
| 1958 |
+
"Step 1: Fill in the experimental configuration. The experimental data is placed under logs, one folder for each experiment. You need to manually enter the experiment name path, which contains the experimental configuration, logs, and trained model files."
|
| 1959 |
)
|
| 1960 |
)
|
| 1961 |
with gr.Row():
|
| 1962 |
+
exp_dir1 = gr.Textbox(label=i18n("Enter experiment name"), value="mi-test")
|
| 1963 |
sr2 = gr.Radio(
|
| 1964 |
+
label=i18n("target sampling rate"),
|
| 1965 |
choices=["40k", "48k"],
|
| 1966 |
value="40k",
|
| 1967 |
interactive=True,
|
| 1968 |
)
|
| 1969 |
if_f0_3 = gr.Radio(
|
| 1970 |
+
label=i18n("Does the model have pitch guidance (must be provided for singing, but not for voice)"),
|
| 1971 |
choices=[True, False],
|
| 1972 |
value=True,
|
| 1973 |
interactive=True,
|
| 1974 |
)
|
| 1975 |
version19 = gr.Radio(
|
| 1976 |
+
label=i18n("Version"),
|
| 1977 |
choices=["v1", "v2"],
|
| 1978 |
value="v1",
|
| 1979 |
interactive=True,
|
|
|
|
| 1983 |
minimum=0,
|
| 1984 |
maximum=config.n_cpu,
|
| 1985 |
step=1,
|
| 1986 |
+
label=i18n("The number of CPU processes used to extract pitch and process data"),
|
| 1987 |
value=int(np.ceil(config.n_cpu / 1.5)),
|
| 1988 |
interactive=True,
|
| 1989 |
)
|
| 1990 |
+
with gr.Group(): # Currently single-player, will support up to 4 players later#Data processing
|
| 1991 |
gr.Markdown(
|
| 1992 |
value=i18n(
|
| 1993 |
+
"step2a: Automatically traverse all files that can be decoded into audio in the training folder and perform slice normalization, generating 2 wav folders in the experimental directory; currently only supports single-player training."
|
| 1994 |
)
|
| 1995 |
)
|
| 1996 |
with gr.Row():
|
| 1997 |
trainset_dir4 = gr.Textbox(
|
| 1998 |
+
label=i18n("Enter the training folder path"), value="E:\\Voice Audio+Annotation\\Kenshi Yonezu\\src"
|
| 1999 |
)
|
| 2000 |
spk_id5 = gr.Slider(
|
| 2001 |
minimum=0,
|
| 2002 |
maximum=4,
|
| 2003 |
step=1,
|
| 2004 |
+
label=i18n("Please specify the speaker id"),
|
| 2005 |
value=0,
|
| 2006 |
interactive=True,
|
| 2007 |
)
|
| 2008 |
+
but1 = gr.Button(i18n("Process data"), variant="primary")
|
| 2009 |
+
info1 = gr.Textbox(label=i18n("Output information"), value="")
|
| 2010 |
but1.click(
|
| 2011 |
preprocess_dataset, [trainset_dir4, exp_dir1, sr2, np7], [info1]
|
| 2012 |
)
|
| 2013 |
with gr.Group():
|
| 2014 |
+
gr.Markdown(value=i18n("step2b: Use CPU to extract pitch (if the model has pitch), use GPU to extract features (select card number)"))
|
| 2015 |
with gr.Row():
|
| 2016 |
with gr.Column():
|
| 2017 |
gpus6 = gr.Textbox(
|
| 2018 |
+
label=i18n("Enter the card numbers to be used separated by -, for example 0-1-2 uses card 0, card 1 and card 2"),
|
| 2019 |
value=gpus,
|
| 2020 |
interactive=True,
|
| 2021 |
)
|
|
|
|
| 2023 |
with gr.Column():
|
| 2024 |
f0method8 = gr.Radio(
|
| 2025 |
label=i18n(
|
| 2026 |
+
"Select the pitch extraction algorithm: input singing voice can be accelerated by pm, high-quality voice but poor CPU can be accelerated by dio, harvest has better quality but is slow"
|
| 2027 |
),
|
| 2028 |
choices=["pm", "harvest", "dio", "crepe", "mangio-crepe"], # Fork feature: Crepe on f0 extraction for training.
|
| 2029 |
value="harvest",
|
|
|
|
| 2037 |
value=64,
|
| 2038 |
interactive=True
|
| 2039 |
)
|
| 2040 |
+
but2 = gr.Button(i18n("Feature extraction"), variant="primary")
|
| 2041 |
+
info2 = gr.Textbox(label=i18n("Output information"), value="", max_lines=8)
|
| 2042 |
but2.click(
|
| 2043 |
extract_f0_feature,
|
| 2044 |
[gpus6, np7, f0method8, if_f0_3, exp_dir1, version19, extraction_crepe_hop_length],
|
| 2045 |
[info2],
|
| 2046 |
)
|
| 2047 |
with gr.Group():
|
| 2048 |
+
gr.Markdown(value=i18n("step3: Fill in the training settings and start training the model and indexing"))
|
| 2049 |
with gr.Row():
|
| 2050 |
save_epoch10 = gr.Slider(
|
| 2051 |
minimum=0,
|
| 2052 |
maximum=50,
|
| 2053 |
step=1,
|
| 2054 |
+
label=i18n("Save frequency save_every_epoch"),
|
| 2055 |
value=5,
|
| 2056 |
interactive=True,
|
| 2057 |
)
|
|
|
|
| 2059 |
minimum=0,
|
| 2060 |
maximum=10000,
|
| 2061 |
step=1,
|
| 2062 |
+
label=i18n("Total number of training rounds total_epoch"),
|
| 2063 |
value=20,
|
| 2064 |
interactive=True,
|
| 2065 |
)
|
|
|
|
| 2067 |
minimum=1,
|
| 2068 |
maximum=40,
|
| 2069 |
step=1,
|
| 2070 |
+
label=i18n("batch_size for each graphics card"),
|
| 2071 |
value=default_batch_size,
|
| 2072 |
interactive=True,
|
| 2073 |
)
|
| 2074 |
if_save_latest13 = gr.Radio(
|
| 2075 |
+
label=i18n("Whether to save only the latest ckpt file to save hard disk space"),
|
| 2076 |
+
choices=[i18n("yes"), i18n("yes")],
|
| 2077 |
+
value=i18n("yes"),
|
| 2078 |
interactive=True,
|
| 2079 |
)
|
| 2080 |
if_cache_gpu17 = gr.Radio(
|
| 2081 |
label=i18n(
|
| 2082 |
+
"Whether to cache all training sets to the video memory. Small data under 10 minutes can be cached to speed up training. Large data cache will explode the video memory and will not increase the speed much."
|
| 2083 |
),
|
| 2084 |
+
choices=[i18n("yes"), i18n("no")],
|
| 2085 |
+
value=i18n("no"),
|
| 2086 |
interactive=True,
|
| 2087 |
)
|
| 2088 |
if_save_every_weights18 = gr.Radio(
|
| 2089 |
+
label=i18n("Whether to save the final small model to the weights folder at each save time point"),
|
| 2090 |
+
choices=[i18n("yes"), i18n("no")],
|
| 2091 |
+
value=i18n("no"),
|
| 2092 |
interactive=True,
|
| 2093 |
)
|
| 2094 |
with gr.Row():
|
| 2095 |
pretrained_G14 = gr.Textbox(
|
| 2096 |
+
label=i18n("Load the pre-trained bottom model G path"),
|
| 2097 |
value="pretrained/f0G40k.pth",
|
| 2098 |
interactive=True,
|
| 2099 |
)
|
| 2100 |
pretrained_D15 = gr.Textbox(
|
| 2101 |
+
label=i18n("Load the pre-trained bottom model D path"),
|
| 2102 |
value="pretrained/f0D40k.pth",
|
| 2103 |
interactive=True,
|
| 2104 |
)
|
|
|
|
| 2118 |
[f0method8, pretrained_G14, pretrained_D15],
|
| 2119 |
)
|
| 2120 |
gpus16 = gr.Textbox(
|
| 2121 |
+
label=i18n("Enter the card numbers to be used separated by -, for example 0-1-2 uses card 0, card 1 and card 2"),
|
| 2122 |
value=gpus,
|
| 2123 |
interactive=True,
|
| 2124 |
)
|
| 2125 |
+
but3 = gr.Button(i18n("Training model"), variant="primary")
|
| 2126 |
+
but4 = gr.Button(i18n("Training feature index"), variant="primary")
|
| 2127 |
+
but5 = gr.Button(i18n("One click training"), variant="primary")
|
| 2128 |
+
info3 = gr.Textbox(label=i18n("Output information"), value="", max_lines=10)
|
| 2129 |
but3.click(
|
| 2130 |
click_train,
|
| 2131 |
[
|
|
|
|
| 2172 |
info3,
|
| 2173 |
)
|
| 2174 |
|
| 2175 |
+
with gr.TabItem(i18n("ckpt processing")):
|
| 2176 |
with gr.Group():
|
| 2177 |
+
gr.Markdown(value=i18n("Model fusion, can be used to test timbre fusion"))
|
| 2178 |
with gr.Row():
|
| 2179 |
+
ckpt_a = gr.Textbox(label=i18n("A model path"), value="", interactive=True)
|
| 2180 |
+
ckpt_b = gr.Textbox(label=i18n("B model path"), value="", interactive=True)
|
| 2181 |
alpha_a = gr.Slider(
|
| 2182 |
minimum=0,
|
| 2183 |
maximum=1,
|
| 2184 |
+
label=i18n("A model weight"),
|
| 2185 |
value=0.5,
|
| 2186 |
interactive=True,
|
| 2187 |
)
|
| 2188 |
with gr.Row():
|
| 2189 |
sr_ = gr.Radio(
|
| 2190 |
+
label=i18n("target sampling rate"),
|
| 2191 |
choices=["40k", "48k"],
|
| 2192 |
value="40k",
|
| 2193 |
interactive=True,
|
| 2194 |
)
|
| 2195 |
if_f0_ = gr.Radio(
|
| 2196 |
+
label=i18n("Does the model have pitch guidance?"),
|
| 2197 |
+
choices=[i18n("yes"), i18n("no")],
|
| 2198 |
+
value=i18n("yes"),
|
| 2199 |
interactive=True,
|
| 2200 |
)
|
| 2201 |
info__ = gr.Textbox(
|
| 2202 |
+
label=i18n("Model information to be placed"), value="", max_lines=8, interactive=True
|
| 2203 |
)
|
| 2204 |
name_to_save0 = gr.Textbox(
|
| 2205 |
+
label=i18n("The saved model name has no suffix"),
|
| 2206 |
value="",
|
| 2207 |
max_lines=1,
|
| 2208 |
interactive=True,
|
| 2209 |
)
|
| 2210 |
version_2 = gr.Radio(
|
| 2211 |
+
label=i18n("Model version model"),
|
| 2212 |
choices=["v1", "v2"],
|
| 2213 |
value="v1",
|
| 2214 |
interactive=True,
|
| 2215 |
)
|
| 2216 |
with gr.Row():
|
| 2217 |
+
but6 = gr.Button(i18n("Fusion"), variant="primary")
|
| 2218 |
+
info4 = gr.Textbox(label=i18n("Output information"), value="", max_lines=8)
|
| 2219 |
but6.click(
|
| 2220 |
merge,
|
| 2221 |
[
|
|
|
|
| 2231 |
info4,
|
| 2232 |
) # def merge(path1,path2,alpha1,sr,f0,info):
|
| 2233 |
with gr.Group():
|
| 2234 |
+
gr.Markdown(value=i18n("Modify model information (only supports small model files extracted from the weights folder)"))
|
| 2235 |
with gr.Row():
|
| 2236 |
ckpt_path0 = gr.Textbox(
|
| 2237 |
+
label=i18n("model path"), value="", interactive=True
|
| 2238 |
)
|
| 2239 |
info_ = gr.Textbox(
|
| 2240 |
+
label=i18n("Model information to be changed"), value="", max_lines=8, interactive=True
|
| 2241 |
)
|
| 2242 |
name_to_save1 = gr.Textbox(
|
| 2243 |
+
label=i18n("The saved file name, the default is empty and the same as the source file name"),
|
| 2244 |
value="",
|
| 2245 |
max_lines=8,
|
| 2246 |
interactive=True,
|
| 2247 |
)
|
| 2248 |
with gr.Row():
|
| 2249 |
+
but7 = gr.Button(i18n("Revise"), variant="primary")
|
| 2250 |
+
info5 = gr.Textbox(label=i18n("Output information"), value="", max_lines=8)
|
| 2251 |
but7.click(change_info, [ckpt_path0, info_, name_to_save1], info5)
|
| 2252 |
with gr.Group():
|
| 2253 |
+
gr.Markdown(value=i18n("View model information (only supports small model files extracted from the weights folder)"))
|
| 2254 |
with gr.Row():
|
| 2255 |
ckpt_path1 = gr.Textbox(
|
| 2256 |
+
label=i18n("model path"), value="", interactive=True
|
| 2257 |
)
|
| 2258 |
+
but8 = gr.Button(i18n("Check"), variant="primary")
|
| 2259 |
+
info6 = gr.Textbox(label=i18n("Output information"), value="", max_lines=8)
|
| 2260 |
but8.click(show_info, [ckpt_path1], info6)
|
| 2261 |
with gr.Group():
|
| 2262 |
gr.Markdown(
|
| 2263 |
value=i18n(
|
| 2264 |
+
"Model extraction (enter the large file model path in the logs folder), suitable for the case where you don’t want to train the model halfway through and there is no automatic extraction to save the small file model, or you want to test the intermediate model"
|
| 2265 |
)
|
| 2266 |
)
|
| 2267 |
with gr.Row():
|
| 2268 |
ckpt_path2 = gr.Textbox(
|
| 2269 |
+
label=i18n("model path"),
|
| 2270 |
value="E:\\codes\\py39\\logs\\mi-test_f0_48k\\G_23333.pth",
|
| 2271 |
interactive=True,
|
| 2272 |
)
|
| 2273 |
save_name = gr.Textbox(
|
| 2274 |
+
label=i18n("save name"), value="", interactive=True
|
| 2275 |
)
|
| 2276 |
sr__ = gr.Radio(
|
| 2277 |
+
label=i18n("target sampling rate"),
|
| 2278 |
choices=["32k", "40k", "48k"],
|
| 2279 |
value="40k",
|
| 2280 |
interactive=True,
|
| 2281 |
)
|
| 2282 |
if_f0__ = gr.Radio(
|
| 2283 |
+
label=i18n("Whether the model has pitch guidance, 1 for yes, 0 for no"),
|
| 2284 |
choices=["1", "0"],
|
| 2285 |
value="1",
|
| 2286 |
interactive=True,
|
| 2287 |
)
|
| 2288 |
version_1 = gr.Radio(
|
| 2289 |
+
label=i18n("Model version model"),
|
| 2290 |
choices=["v1", "v2"],
|
| 2291 |
value="v2",
|
| 2292 |
interactive=True,
|
| 2293 |
)
|
| 2294 |
info___ = gr.Textbox(
|
| 2295 |
+
label=i18n("Model information to be placed"), value="", max_lines=8, interactive=True
|
| 2296 |
)
|
| 2297 |
+
but9 = gr.Button(i18n("extract"), variant="primary")
|
| 2298 |
+
info7 = gr.Textbox(label=i18n("Output information"), value="", max_lines=8)
|
| 2299 |
ckpt_path2.change(
|
| 2300 |
change_info_, [ckpt_path2], [sr__, if_f0__, version_1]
|
| 2301 |
)
|
|
|
|
| 2305 |
info7,
|
| 2306 |
)
|
| 2307 |
|
| 2308 |
+
with gr.TabItem(i18n("Onnx export")):
|
| 2309 |
with gr.Row():
|
| 2310 |
+
ckpt_dir = gr.Textbox(label=i18n("RVC model path"), value="", interactive=True)
|
| 2311 |
with gr.Row():
|
| 2312 |
onnx_dir = gr.Textbox(
|
| 2313 |
+
label=i18n("Onnx output path"), value="", interactive=True
|
| 2314 |
)
|
| 2315 |
with gr.Row():
|
| 2316 |
infoOnnx = gr.Label(label="info")
|
| 2317 |
with gr.Row():
|
| 2318 |
+
butOnnx = gr.Button(i18n("Exporting Onnx Models"), variant="primary")
|
| 2319 |
butOnnx.click(export_onnx, [ckpt_dir, onnx_dir], infoOnnx)
|
| 2320 |
|
| 2321 |
+
tab_faq = i18n("FAQ")
|
| 2322 |
with gr.TabItem(tab_faq):
|
| 2323 |
try:
|
| 2324 |
+
if tab_faq == "FAQ":
|
| 2325 |
with open("docs/faq.md", "r", encoding="utf8") as f:
|
| 2326 |
info = f.read()
|
| 2327 |
else:
|
|
|
|
| 2453 |
# )
|
| 2454 |
#endregion
|
| 2455 |
|
| 2456 |
+
# with gr.TabItem(i18n("Recruiting pitch curve front-end editor")):
|
| 2457 |
+
# gr.Markdown(value=i18n("Add the development group to contact me xxxxx"))
|
| 2458 |
+
# with gr.TabItem(i18n("Click to view the communication and problem feedback group number")):
|
| 2459 |
# gr.Markdown(value=i18n("xxxxx"))
|
| 2460 |
|
| 2461 |
if config.iscolab or config.paperspace: # Share gradio link for colab and paperspace (FORK FEATURE)
|