Refactor: run "hatch run style:fmt"
This commit is contained in:
@@ -106,7 +106,7 @@ def merge_style_usual(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ def merge_style_add_diff(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ def merge_style_weighted_sum(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ def merge_style_add_null(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ def merge_models_usual(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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]
|
||||||
@@ -455,7 +455,7 @@ def merge_models_add_diff(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
@@ -532,7 +532,7 @@ def merge_models_weighted_sum(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
@@ -610,7 +610,7 @@ def merge_models_add_null(
|
|||||||
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:
|
if new_config["data"]["n_speakers"] == 1:
|
||||||
new_config["data"]["spk2id"] = { output_name : 0}
|
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)
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,9 @@ class TTSModel:
|
|||||||
hps=self.hyper_parameters,
|
hps=self.hyper_parameters,
|
||||||
)
|
)
|
||||||
# 愚直。もっと上手い方法ありそう
|
# 愚直。もっと上手い方法ありそう
|
||||||
params = zip(self.net_g.dec.parameters(), null_model_add.dec.parameters())
|
params = zip(
|
||||||
|
self.net_g.dec.parameters(), null_model_add.dec.parameters()
|
||||||
|
)
|
||||||
for v in params:
|
for v in params:
|
||||||
v[0].data.add_(v[1].data, alpha=float(null_model_info["weight"]))
|
v[0].data.add_(v[1].data, alpha=float(null_model_info["weight"]))
|
||||||
params = zip(
|
params = zip(
|
||||||
@@ -165,14 +167,18 @@ class TTSModel:
|
|||||||
for v in params:
|
for v in params:
|
||||||
v[0].data.add_(v[1].data, alpha=float(null_model_info["style"]))
|
v[0].data.add_(v[1].data, alpha=float(null_model_info["style"]))
|
||||||
# テンポは sdp と dp 二つあるからとりあえずどっちも足す
|
# テンポは sdp と dp 二つあるからとりあえずどっちも足す
|
||||||
params = zip(self.net_g.sdp.parameters(), null_model_add.sdp.parameters())
|
params = zip(
|
||||||
|
self.net_g.sdp.parameters(), null_model_add.sdp.parameters()
|
||||||
|
)
|
||||||
for v in params:
|
for v in params:
|
||||||
v[0].data.add_(v[1].data, alpha=float(null_model_info["tempo"]))
|
v[0].data.add_(v[1].data, alpha=float(null_model_info["tempo"]))
|
||||||
params = zip(self.net_g.dp.parameters(), null_model_add.dp.parameters())
|
params = zip(self.net_g.dp.parameters(), null_model_add.dp.parameters())
|
||||||
for v in params:
|
for v in params:
|
||||||
v[0].data.add_(v[1].data, alpha=float(null_model_info["tempo"]))
|
v[0].data.add_(v[1].data, alpha=float(null_model_info["tempo"]))
|
||||||
|
|
||||||
logger.info(f"Null models merged successfully ({time.time() - start_time:.2f}s)")
|
logger.info(
|
||||||
|
f"Null models merged successfully ({time.time() - start_time:.2f}s)"
|
||||||
|
)
|
||||||
|
|
||||||
# ONNX 推論時
|
# ONNX 推論時
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user