File size: 620 Bytes
9e15541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from pathlib import Path

import hydra
from omegaconf import OmegaConf


def load_model_config(output_path: Path, config):
    # @hydra.main(
    #     version_base=None, config_path=str(output_path), config_name="training_config"
    # )
    # def load_model_conf(cfg):
    #     return cfg

    # cfg = load_model_conf()
    cfg = OmegaConf.load(output_path / "training_config.yaml")
    if cfg:
        config["model"] = cfg["model"]


def save_hydra_config(path: Path, config, force: bool = False):
    # TODO: Save config as yaml. Check
    if not path.is_file() and not force:
        OmegaConf.save(config, path)