liumaolin commited on
Commit ·
60123c5
1
Parent(s): 14b5955
feat(tts): prevent config saving for dict-based initialization
Browse files- Add `_from_dict` flag to track dict-based initialization
- Skip saving configuration files when initialized with a dictionary
GPT_SoVITS/TTS_infer_pack/TTS.py
CHANGED
|
@@ -297,6 +297,9 @@ class TTS_Config:
|
|
| 297 |
# "auto_yue",#多语种启动切分识别语种
|
| 298 |
|
| 299 |
def __init__(self, configs: Union[dict, str] = None):
|
|
|
|
|
|
|
|
|
|
| 300 |
# 设置默认配置文件路径
|
| 301 |
configs_base_path: str = "GPT_SoVITS/configs/"
|
| 302 |
os.makedirs(configs_base_path, exist_ok=True)
|
|
@@ -375,6 +378,10 @@ class TTS_Config:
|
|
| 375 |
return configs
|
| 376 |
|
| 377 |
def save_configs(self, configs_path: str = None) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
configs = deepcopy(self.default_configs)
|
| 379 |
if self.configs is not None:
|
| 380 |
configs["custom"] = self.update_configs()
|
|
|
|
| 297 |
# "auto_yue",#多语种启动切分识别语种
|
| 298 |
|
| 299 |
def __init__(self, configs: Union[dict, str] = None):
|
| 300 |
+
# 标记是否从 dict 初始化,若是则不保存配置文件
|
| 301 |
+
self._from_dict = isinstance(configs, dict)
|
| 302 |
+
|
| 303 |
# 设置默认配置文件路径
|
| 304 |
configs_base_path: str = "GPT_SoVITS/configs/"
|
| 305 |
os.makedirs(configs_base_path, exist_ok=True)
|
|
|
|
| 378 |
return configs
|
| 379 |
|
| 380 |
def save_configs(self, configs_path: str = None) -> None:
|
| 381 |
+
# 从 dict 初始化时不保存配置文件
|
| 382 |
+
if self._from_dict:
|
| 383 |
+
return
|
| 384 |
+
|
| 385 |
configs = deepcopy(self.default_configs)
|
| 386 |
if self.configs is not None:
|
| 387 |
configs["custom"] = self.update_configs()
|