mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-04 05:00:01 +08:00
完善api_v2.py里对于v4模型的判断
完善api_v2.py里对于v4模型的判断。
This commit is contained in:
parent
b122988be0
commit
fa971a4e09
@ -468,7 +468,7 @@ class TTS:
|
||||
version, model_version, if_lora_v3 = get_sovits_version_from_path_fast(weights_path)
|
||||
path_sovits = self.configs.default_configs[model_version]["vits_weights_path"]
|
||||
|
||||
if if_lora_v3 == True and os.path.exists(path_sovits) == False:
|
||||
if model_version in {"v3", "v4"} and os.path.exists(path_sovits) == False:
|
||||
info = path_sovits + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重"%model_version)
|
||||
raise FileExistsError(info)
|
||||
|
||||
@ -520,7 +520,7 @@ class TTS:
|
||||
if "pretrained" not in weights_path and hasattr(vits_model, "enc_q"):
|
||||
del vits_model.enc_q
|
||||
|
||||
if if_lora_v3 == False:
|
||||
if model_version not in {"v3", "v4"}:
|
||||
print(
|
||||
f"Loading VITS weights from {weights_path}. {vits_model.load_state_dict(dict_s2['weight'], strict=False)}"
|
||||
)
|
||||
@ -615,9 +615,6 @@ class TTS:
|
||||
self.vocoder_configs["upsample_rate"] = 480
|
||||
self.vocoder_configs["overlapped_len"] = 12
|
||||
|
||||
|
||||
|
||||
|
||||
self.vocoder = self.vocoder.eval()
|
||||
if self.configs.is_half == True:
|
||||
self.vocoder = self.vocoder.half().to(self.configs.device)
|
||||
@ -1257,7 +1254,7 @@ class TTS:
|
||||
speed_factor,
|
||||
False,
|
||||
fragment_interval,
|
||||
super_sampling if self.configs.use_vocoder and self.configs.version == "v3" else False,
|
||||
super_sampling if self.configs.use_vocoder and self.configs.version in {"v3", "v4"} else False,
|
||||
)
|
||||
else:
|
||||
audio.append(batch_audio_fragment)
|
||||
@ -1278,7 +1275,7 @@ class TTS:
|
||||
speed_factor,
|
||||
split_bucket,
|
||||
fragment_interval,
|
||||
super_sampling if self.configs.use_vocoder and self.configs.version == "v3" else False,
|
||||
super_sampling if self.configs.use_vocoder and self.configs.version in {"v3", "v4"} else False,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user