| 3 | |
| 4 | |
| 5 | class Config(dict): |
| 6 | def __init__(self, config_path): |
| 7 | with open(config_path, 'r') as f: |
| 8 | self._yaml = f.read() |
| 9 | self._dict = yaml.safe_load(self._yaml) |
| 10 | self._dict['PATH'] = os.path.dirname(config_path) |
| 11 | |
| 12 | def __getattr__(self, name): |
| 13 | if self._dict.get(name) is not None: |
| 14 | return self._dict[name] |
| 15 | return None |
| 16 | |
| 17 | def print(self): |
| 18 | print('Model configurations:') |
| 19 | print('---------------------------------') |
| 20 | print(self._yaml) |
| 21 | print('') |
| 22 | print('---------------------------------') |
| 23 | print('') |
| 24 | |
| 25 | |
| 26 | def load_config(path): |