mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-05-06 20:01:37 +08:00
chore(format): run black on dev
This commit is contained in:
parent
ab07a8b1bc
commit
ad6a6e59c2
41
infer-web.py
41
infer-web.py
@ -569,7 +569,9 @@ def click_train(
|
|||||||
sort_keys=True,
|
sort_keys=True,
|
||||||
)
|
)
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
cmd = '"%s" infer/modules/train/train.py -e "%s" -sr %s -f0 %s -bs %s -te %s -se %s %s %s -l %s -c %s -sw %s -v %s -a "%s"' % (
|
cmd = (
|
||||||
|
'"%s" infer/modules/train/train.py -e "%s" -sr %s -f0 %s -bs %s -te %s -se %s %s %s -l %s -c %s -sw %s -v %s -a "%s"'
|
||||||
|
% (
|
||||||
config.python_cmd,
|
config.python_cmd,
|
||||||
exp_dir1,
|
exp_dir1,
|
||||||
sr2,
|
sr2,
|
||||||
@ -583,8 +585,9 @@ def click_train(
|
|||||||
1 if if_cache_gpu17 == i18n("是") else 0,
|
1 if if_cache_gpu17 == i18n("是") else 0,
|
||||||
1 if if_save_every_weights18 == i18n("是") else 0,
|
1 if if_save_every_weights18 == i18n("是") else 0,
|
||||||
version19,
|
version19,
|
||||||
author
|
author,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
if gpus16:
|
if gpus16:
|
||||||
cmd += '-g "%s"' % (gpus16)
|
cmd += '-g "%s"' % (gpus16)
|
||||||
|
|
||||||
@ -713,7 +716,7 @@ def train1key(
|
|||||||
if_save_every_weights18,
|
if_save_every_weights18,
|
||||||
version19,
|
version19,
|
||||||
gpus_rmvpe,
|
gpus_rmvpe,
|
||||||
author
|
author,
|
||||||
):
|
):
|
||||||
infos = []
|
infos = []
|
||||||
|
|
||||||
@ -751,7 +754,7 @@ def train1key(
|
|||||||
if_cache_gpu17,
|
if_cache_gpu17,
|
||||||
if_save_every_weights18,
|
if_save_every_weights18,
|
||||||
version19,
|
version19,
|
||||||
author
|
author,
|
||||||
)
|
)
|
||||||
yield get_info_str(
|
yield get_info_str(
|
||||||
i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log")
|
i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log")
|
||||||
@ -1245,7 +1248,9 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
)
|
)
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
but2 = gr.Button(i18n("特征提取"), variant="primary")
|
but2 = gr.Button(i18n("特征提取"), variant="primary")
|
||||||
info2 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
info2 = gr.Textbox(
|
||||||
|
label=i18n("输出信息"), value="", max_lines=8
|
||||||
|
)
|
||||||
f0method8.change(
|
f0method8.change(
|
||||||
fn=change_f0_method,
|
fn=change_f0_method,
|
||||||
inputs=[f0method8],
|
inputs=[f0method8],
|
||||||
@ -1266,7 +1271,9 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
api_name="train_extract_f0_feature",
|
api_name="train_extract_f0_feature",
|
||||||
)
|
)
|
||||||
with gr.Group():
|
with gr.Group():
|
||||||
gr.Markdown(value=i18n("### 第三步 开始训练\n填写训练设置, 开始训练模型和索引."))
|
gr.Markdown(
|
||||||
|
value=i18n("### 第三步 开始训练\n填写训练设置, 开始训练模型和索引.")
|
||||||
|
)
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
save_epoch10 = gr.Slider(
|
save_epoch10 = gr.Slider(
|
||||||
@ -1521,7 +1528,9 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
)
|
)
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
but7 = gr.Button(i18n("修改"), variant="primary")
|
but7 = gr.Button(i18n("修改"), variant="primary")
|
||||||
info5 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
info5 = gr.Textbox(
|
||||||
|
label=i18n("输出信息"), value="", max_lines=8
|
||||||
|
)
|
||||||
but7.click(
|
but7.click(
|
||||||
change_info,
|
change_info,
|
||||||
[ckpt_path0, info_, name_to_save1],
|
[ckpt_path0, info_, name_to_save1],
|
||||||
@ -1541,7 +1550,9 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
)
|
)
|
||||||
but8 = gr.Button(i18n("查看"), variant="primary")
|
but8 = gr.Button(i18n("查看"), variant="primary")
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
info6 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
info6 = gr.Textbox(
|
||||||
|
label=i18n("输出信息"), value="", max_lines=8
|
||||||
|
)
|
||||||
but8.click(show_info, [ckpt_path1], info6, api_name="ckpt_show")
|
but8.click(show_info, [ckpt_path1], info6, api_name="ckpt_show")
|
||||||
with gr.Group():
|
with gr.Group():
|
||||||
gr.Markdown(
|
gr.Markdown(
|
||||||
@ -1592,13 +1603,23 @@ with gr.Blocks(title="RVC WebUI") as app:
|
|||||||
)
|
)
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
but9 = gr.Button(i18n("提取"), variant="primary")
|
but9 = gr.Button(i18n("提取"), variant="primary")
|
||||||
info7 = gr.Textbox(label=i18n("输出信息"), value="", max_lines=8)
|
info7 = gr.Textbox(
|
||||||
|
label=i18n("输出信息"), value="", max_lines=8
|
||||||
|
)
|
||||||
ckpt_path2.change(
|
ckpt_path2.change(
|
||||||
change_info_, [ckpt_path2], [sr__, if_f0__, version_1]
|
change_info_, [ckpt_path2], [sr__, if_f0__, version_1]
|
||||||
)
|
)
|
||||||
but9.click(
|
but9.click(
|
||||||
extract_small_model,
|
extract_small_model,
|
||||||
[ckpt_path2, save_name, extauthor, sr__, if_f0__, info___, version_1],
|
[
|
||||||
|
ckpt_path2,
|
||||||
|
save_name,
|
||||||
|
extauthor,
|
||||||
|
sr__,
|
||||||
|
if_f0__,
|
||||||
|
info___,
|
||||||
|
version_1,
|
||||||
|
],
|
||||||
info7,
|
info7,
|
||||||
api_name="ckpt_extract",
|
api_name="ckpt_extract",
|
||||||
)
|
)
|
||||||
|
@ -43,7 +43,8 @@ def save_small_model(ckpt, sr, if_f0, name, epoch, version, hps):
|
|||||||
opt["info"] = "%sepoch" % epoch
|
opt["info"] = "%sepoch" % epoch
|
||||||
opt["name"] = name
|
opt["name"] = name
|
||||||
opt["timestamp"] = int(time())
|
opt["timestamp"] = int(time())
|
||||||
if hps.author: opt["author"] = hps.author
|
if hps.author:
|
||||||
|
opt["author"] = hps.author
|
||||||
opt["sr"] = sr
|
opt["sr"] = sr
|
||||||
opt["f0"] = if_f0
|
opt["f0"] = if_f0
|
||||||
opt["version"] = version
|
opt["version"] = version
|
||||||
@ -179,7 +180,8 @@ def extract_small_model(path, name, author, sr, if_f0, info, version):
|
|||||||
opt["info"] = info
|
opt["info"] = info
|
||||||
opt["name"] = name
|
opt["name"] = name
|
||||||
opt["timestamp"] = int(time())
|
opt["timestamp"] = int(time())
|
||||||
if author: opt["author"] = author
|
if author:
|
||||||
|
opt["author"] = author
|
||||||
opt["version"] = version
|
opt["version"] = version
|
||||||
opt["sr"] = sr
|
opt["sr"] = sr
|
||||||
opt["f0"] = int(if_f0)
|
opt["f0"] = int(if_f0)
|
||||||
@ -219,9 +221,12 @@ def merge(path1, path2, alpha1, sr, f0, info, name, version):
|
|||||||
|
|
||||||
def authors(c1, c2):
|
def authors(c1, c2):
|
||||||
a1, a2 = c1.get("author", ""), c2.get("author", "")
|
a1, a2 = c1.get("author", ""), c2.get("author", "")
|
||||||
if a1 == a2: return a1
|
if a1 == a2:
|
||||||
if not a1: a1 = "Unknown"
|
return a1
|
||||||
if not a2: a2 = "Unknown"
|
if not a1:
|
||||||
|
a1 = "Unknown"
|
||||||
|
if not a2:
|
||||||
|
a2 = "Unknown"
|
||||||
return f"{a1} & {a2}"
|
return f"{a1} & {a2}"
|
||||||
|
|
||||||
ckpt1 = torch.load(path1, map_location="cpu")
|
ckpt1 = torch.load(path1, map_location="cpu")
|
||||||
@ -260,7 +265,8 @@ def merge(path1, path2, alpha1, sr, f0, info, name, version):
|
|||||||
"""
|
"""
|
||||||
opt["name"] = name
|
opt["name"] = name
|
||||||
opt["timestamp"] = int(time())
|
opt["timestamp"] = int(time())
|
||||||
if author: opt["author"] = author
|
if author:
|
||||||
|
opt["author"] = author
|
||||||
opt["sr"] = sr
|
opt["sr"] = sr
|
||||||
opt["f0"] = 1 if f0 == i18n("是") else 0
|
opt["f0"] = 1 if f0 == i18n("是") else 0
|
||||||
opt["version"] = version
|
opt["version"] = version
|
||||||
|
@ -358,9 +358,7 @@ def get_hparams(init=True):
|
|||||||
required=True,
|
required=True,
|
||||||
help="if caching the dataset in GPU memory, 1 or 0",
|
help="if caching the dataset in GPU memory, 1 or 0",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument("-a", "--author", type=str, default="", help="Model author")
|
||||||
"-a", "--author", type=str, default="", help="Model author"
|
|
||||||
)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
name = args.experiment_dir
|
name = args.experiment_dir
|
||||||
@ -389,6 +387,7 @@ def get_hparams(init=True):
|
|||||||
hparams.author = args.author
|
hparams.author = args.author
|
||||||
return hparams
|
return hparams
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def get_hparams_from_dir(model_dir):
|
def get_hparams_from_dir(model_dir):
|
||||||
config_save_path = os.path.join(model_dir, "config.json")
|
config_save_path = os.path.join(model_dir, "config.json")
|
||||||
@ -435,6 +434,7 @@ def check_git_hash(model_dir):
|
|||||||
open(path, "w").write(cur_hash)
|
open(path, "w").write(cur_hash)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def get_logger(model_dir, filename="train.log"):
|
def get_logger(model_dir, filename="train.log"):
|
||||||
global logger
|
global logger
|
||||||
logger = logging.getLogger(os.path.basename(model_dir))
|
logger = logging.getLogger(os.path.basename(model_dir))
|
||||||
|
@ -96,7 +96,8 @@ class VC:
|
|||||||
{"value": to_return_protect[2], "__type__": "update"},
|
{"value": to_return_protect[2], "__type__": "update"},
|
||||||
{"value": to_return_protect[3], "__type__": "update"},
|
{"value": to_return_protect[3], "__type__": "update"},
|
||||||
{"value": "", "__type__": "update"},
|
{"value": "", "__type__": "update"},
|
||||||
) if to_return_protect
|
)
|
||||||
|
if to_return_protect
|
||||||
else {"visible": True, "maximum": 0, "__type__": "update"}
|
else {"visible": True, "maximum": 0, "__type__": "update"}
|
||||||
)
|
)
|
||||||
person = f'{os.getenv("weight_root")}/{sid}'
|
person = f'{os.getenv("weight_root")}/{sid}'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user