| 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 | |