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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user