File size: 469 Bytes
49a060f
 
 
 
 
 
9e6c24e
49a060f
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
from typing import Text, Union

from omegaconf import OmegaConf, DictConfig, ListConfig


def get_config(config_file: Text = "base") -> Union[DictConfig, ListConfig]:
    if not config_file.endswith(".yaml") or not config_file.endswith(".yml"):
        config_file += ".yaml"
    root_configs_dir = os.path.abspath(os.path.join(__file__, ".."))
    job_cfg = OmegaConf.load(os.path.join(root_configs_dir, config_file))
    return job_cfg


cfg = get_config()