File size: 447 Bytes
c6f92cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

import yaml

def load_base_cfg():
    with open('configs/base.yml', 'r') as fp:
        cfg = yaml.load(fp, Loader=yaml.SafeLoader)
    return cfg

def load_cfg(cfg_file):
    cfg = load_base_cfg()
    with open(cfg_file, 'r') as fp:
        exp_cfg = yaml.load(fp, Loader=yaml.SafeLoader)

    cfg['model'].update(exp_cfg.get('model', {}))
    cfg['data'].update(exp_cfg.get('data', {}))
    dataset = cfg['data'].get('dataset')
    return cfg