(config_fn)
| 45 | loaded_config = set() |
| 46 | |
| 47 | def load_config(config_fn): # deep first |
| 48 | with open(config_fn) as f: |
| 49 | hparams_ = yaml.safe_load(f) |
| 50 | loaded_config.add(config_fn) |
| 51 | if 'base_config' in hparams_: |
| 52 | ret_hparams = {} |
| 53 | if not isinstance(hparams_['base_config'], list): |
| 54 | hparams_['base_config'] = [hparams_['base_config']] |
| 55 | for c in hparams_['base_config']: |
| 56 | if c not in loaded_config: |
| 57 | if c.startswith('.'): |
| 58 | c = f'{os.path.dirname(config_fn)}/{c}' |
| 59 | c = os.path.normpath(c) |
| 60 | override_config(ret_hparams, load_config(c)) |
| 61 | override_config(ret_hparams, hparams_) |
| 62 | else: |
| 63 | ret_hparams = hparams_ |
| 64 | config_chains.append(config_fn) |
| 65 | return ret_hparams |
| 66 | |
| 67 | global hparams |
| 68 | assert args.config != '' or args_work_dir != '' |
no test coverage detected