chore(format): run black on dev

This commit is contained in:
github-actions[bot] 2024-06-03 08:13:55 +00:00
parent ab07a8b1bc
commit ad6a6e59c2
4 changed files with 50 additions and 22 deletions

View File

@ -569,7 +569,9 @@ def click_train(
sort_keys=True,
)
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,
exp_dir1,
sr2,
@ -583,8 +585,9 @@ def click_train(
1 if if_cache_gpu17 == i18n("") else 0,
1 if if_save_every_weights18 == i18n("") else 0,
version19,
author
author,
)
)
if gpus16:
cmd += '-g "%s"' % (gpus16)
@ -713,7 +716,7 @@ def train1key(
if_save_every_weights18,
version19,
gpus_rmvpe,
author
author,
):
infos = []
@ -751,7 +754,7 @@ def train1key(
if_cache_gpu17,
if_save_every_weights18,
version19,
author
author,
)
yield get_info_str(
i18n("训练结束, 您可查看控制台训练日志或实验文件夹下的train.log")
@ -1245,7 +1248,9 @@ with gr.Blocks(title="RVC WebUI") as app:
)
with gr.Column():
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(
fn=change_f0_method,
inputs=[f0method8],
@ -1266,7 +1271,9 @@ with gr.Blocks(title="RVC WebUI") as app:
api_name="train_extract_f0_feature",
)
with gr.Group():
gr.Markdown(value=i18n("### 第三步 开始训练\n填写训练设置, 开始训练模型和索引."))
gr.Markdown(
value=i18n("### 第三步 开始训练\n填写训练设置, 开始训练模型和索引.")
)
with gr.Row():
with gr.Column():
save_epoch10 = gr.Slider(
@ -1521,7 +1528,9 @@ with gr.Blocks(title="RVC WebUI") as app:
)
with gr.Column():
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(
change_info,
[ckpt_path0, info_, name_to_save1],
@ -1541,7 +1550,9 @@ with gr.Blocks(title="RVC WebUI") as app:
)
but8 = gr.Button(i18n("查看"), variant="primary")
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")
with gr.Group():
gr.Markdown(
@ -1592,13 +1603,23 @@ with gr.Blocks(title="RVC WebUI") as app:
)
with gr.Column():
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(
change_info_, [ckpt_path2], [sr__, if_f0__, version_1]
)
but9.click(
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,
api_name="ckpt_extract",
)

View File

@ -43,7 +43,8 @@ def save_small_model(ckpt, sr, if_f0, name, epoch, version, hps):
opt["info"] = "%sepoch" % epoch
opt["name"] = name
opt["timestamp"] = int(time())
if hps.author: opt["author"] = hps.author
if hps.author:
opt["author"] = hps.author
opt["sr"] = sr
opt["f0"] = if_f0
opt["version"] = version
@ -179,7 +180,8 @@ def extract_small_model(path, name, author, sr, if_f0, info, version):
opt["info"] = info
opt["name"] = name
opt["timestamp"] = int(time())
if author: opt["author"] = author
if author:
opt["author"] = author
opt["version"] = version
opt["sr"] = sr
opt["f0"] = int(if_f0)
@ -219,9 +221,12 @@ def merge(path1, path2, alpha1, sr, f0, info, name, version):
def authors(c1, c2):
a1, a2 = c1.get("author", ""), c2.get("author", "")
if a1 == a2: return a1
if not a1: a1 = "Unknown"
if not a2: a2 = "Unknown"
if a1 == a2:
return a1
if not a1:
a1 = "Unknown"
if not a2:
a2 = "Unknown"
return f"{a1} & {a2}"
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["timestamp"] = int(time())
if author: opt["author"] = author
if author:
opt["author"] = author
opt["sr"] = sr
opt["f0"] = 1 if f0 == i18n("") else 0
opt["version"] = version

View File

@ -358,9 +358,7 @@ def get_hparams(init=True):
required=True,
help="if caching the dataset in GPU memory, 1 or 0",
)
parser.add_argument(
"-a", "--author", type=str, default="", help="Model author"
)
parser.add_argument("-a", "--author", type=str, default="", help="Model author")
args = parser.parse_args()
name = args.experiment_dir
@ -389,6 +387,7 @@ def get_hparams(init=True):
hparams.author = args.author
return hparams
"""
def get_hparams_from_dir(model_dir):
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)
"""
def get_logger(model_dir, filename="train.log"):
global logger
logger = logging.getLogger(os.path.basename(model_dir))

View File

@ -96,7 +96,8 @@ class VC:
{"value": to_return_protect[2], "__type__": "update"},
{"value": to_return_protect[3], "__type__": "update"},
{"value": "", "__type__": "update"},
) if to_return_protect
)
if to_return_protect
else {"visible": True, "maximum": 0, "__type__": "update"}
)
person = f'{os.getenv("weight_root")}/{sid}'