Improve: automatically generate configs/paths.yml by copying it from configs/default_paths.yml when running initialize.py
If configs/paths.yml itself is included in version control, differences will occur when it is changed in each environment, which is troublesome.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -14,6 +14,8 @@ dist/
|
||||
/bert/*/*.safetensors
|
||||
/bert/*/*.msgpack
|
||||
|
||||
/configs/paths.yml
|
||||
|
||||
/pretrained/*.safetensors
|
||||
/pretrained/*.pth
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ from config import config
|
||||
from style_bert_vits2.constants import DEFAULT_STYLE, GRADIO_THEME
|
||||
from style_bert_vits2.logging import logger
|
||||
|
||||
|
||||
# Get path settings
|
||||
with open(os.path.join("configs", "paths.yml"), "r", encoding="utf-8") as f:
|
||||
path_config: dict[str, str] = yaml.safe_load(f.read())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import json
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
@@ -102,11 +103,16 @@ def main():
|
||||
download_pretrained_models()
|
||||
download_jp_extra_pretrained_models()
|
||||
|
||||
# If configs/paths.yml not exists, create it
|
||||
default_paths_yml = Path("configs/default_paths.yml")
|
||||
paths_yml = Path("configs/paths.yml")
|
||||
if not paths_yml.exists():
|
||||
shutil.copy(default_paths_yml, paths_yml)
|
||||
|
||||
if args.dataset_root is None and args.assets_root is None:
|
||||
return
|
||||
|
||||
# Change default paths if necessary
|
||||
paths_yml = Path("configs/paths.yml")
|
||||
with open(paths_yml, "r", encoding="utf-8") as f:
|
||||
yml_data = yaml.safe_load(f)
|
||||
if args.assets_root is not None:
|
||||
|
||||
@@ -69,8 +69,9 @@ class TTSModel:
|
||||
# ハイパーパラメータのパスが指定された
|
||||
else:
|
||||
self.config_path: Path = config_path
|
||||
self.hyper_parameters: HyperParameters = \
|
||||
HyperParameters.load_from_json(self.config_path)
|
||||
self.hyper_parameters: HyperParameters = HyperParameters.load_from_json(
|
||||
self.config_path
|
||||
)
|
||||
|
||||
# スタイルベクトルの NDArray が直接指定された
|
||||
if isinstance(style_vec_path, np.ndarray):
|
||||
|
||||
Reference in New Issue
Block a user