set spk2id when merge

This commit is contained in:
Risenafis
2024-07-06 03:47:41 +09:00
parent b6d09bad44
commit ffa393a3d0

View File

@@ -104,6 +104,8 @@ def merge_style_usual(
new_config = config_a.copy() new_config = config_a.copy()
new_config["data"]["num_styles"] = len(new_style2id) new_config["data"]["num_styles"] = len(new_style2id)
new_config["data"]["style2id"] = new_style2id new_config["data"]["style2id"] = new_style2id
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
new_config["model_name"] = output_name new_config["model_name"] = output_name
save_config(new_config, output_name) save_config(new_config, output_name)
@@ -159,6 +161,8 @@ def merge_style_add_diff(
new_config = config_a.copy() new_config = config_a.copy()
new_config["data"]["num_styles"] = len(new_style2id) new_config["data"]["num_styles"] = len(new_style2id)
new_config["data"]["style2id"] = new_style2id new_config["data"]["style2id"] = new_style2id
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
new_config["model_name"] = output_name new_config["model_name"] = output_name
save_config(new_config, output_name) save_config(new_config, output_name)
@@ -218,6 +222,8 @@ def merge_style_weighted_sum(
new_config = config_a.copy() new_config = config_a.copy()
new_config["data"]["num_styles"] = len(new_style2id) new_config["data"]["num_styles"] = len(new_style2id)
new_config["data"]["style2id"] = new_style2id new_config["data"]["style2id"] = new_style2id
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
new_config["model_name"] = output_name new_config["model_name"] = output_name
save_config(new_config, output_name) save_config(new_config, output_name)
@@ -267,6 +273,8 @@ def merge_style_add_null(
new_config = config_a.copy() new_config = config_a.copy()
new_config["data"]["num_styles"] = len(new_style2id) new_config["data"]["num_styles"] = len(new_style2id)
new_config["data"]["style2id"] = new_style2id new_config["data"]["style2id"] = new_style2id
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
new_config["model_name"] = output_name new_config["model_name"] = output_name
save_config(new_config, output_name) save_config(new_config, output_name)
@@ -361,6 +369,8 @@ def merge_models_usual(
new_config["model_name"] = output_name new_config["model_name"] = output_name
new_config["data"]["num_styles"] = 1 new_config["data"]["num_styles"] = 1
new_config["data"]["style2id"] = {DEFAULT_STYLE: 0} new_config["data"]["style2id"] = {DEFAULT_STYLE: 0}
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
save_config(new_config, output_name) save_config(new_config, output_name)
neutral_vector_a = style_vectors_a[0] neutral_vector_a = style_vectors_a[0]
@@ -443,6 +453,8 @@ def merge_models_add_diff(
new_config["model_name"] = output_name new_config["model_name"] = output_name
new_config["data"]["num_styles"] = 1 new_config["data"]["num_styles"] = 1
new_config["data"]["style2id"] = {DEFAULT_STYLE: 0} new_config["data"]["style2id"] = {DEFAULT_STYLE: 0}
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
with open(assets_root / output_name / "config.json", "w", encoding="utf-8") as f: with open(assets_root / output_name / "config.json", "w", encoding="utf-8") as f:
json.dump(new_config, f, indent=2, ensure_ascii=False) json.dump(new_config, f, indent=2, ensure_ascii=False)
@@ -518,6 +530,8 @@ def merge_models_weighted_sum(
new_config["model_name"] = output_name new_config["model_name"] = output_name
new_config["data"]["num_styles"] = 1 new_config["data"]["num_styles"] = 1
new_config["data"]["style2id"] = {DEFAULT_STYLE: 0} new_config["data"]["style2id"] = {DEFAULT_STYLE: 0}
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
with open(assets_root / output_name / "config.json", "w", encoding="utf-8") as f: with open(assets_root / output_name / "config.json", "w", encoding="utf-8") as f:
json.dump(new_config, f, indent=2, ensure_ascii=False) json.dump(new_config, f, indent=2, ensure_ascii=False)
@@ -594,6 +608,8 @@ def merge_models_add_null(
new_config["model_name"] = output_name new_config["model_name"] = output_name
new_config["data"]["num_styles"] = 1 new_config["data"]["num_styles"] = 1
new_config["data"]["style2id"] = {DEFAULT_STYLE: 0} new_config["data"]["style2id"] = {DEFAULT_STYLE: 0}
if new_config["data"]["n_speakers"] == 1:
new_config["data"]["spk2id"] = { output_name : 0}
with open(assets_root / output_name / "config.json", "w", encoding="utf-8") as f: with open(assets_root / output_name / "config.json", "w", encoding="utf-8") as f:
json.dump(new_config, f, indent=2, ensure_ascii=False) json.dump(new_config, f, indent=2, ensure_ascii=False)