-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
25 lines (19 loc) · 961 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import argparse
import yaml
from experiment import ExperimentStage
if __name__ == '__main__':
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--experiments', type=str, nargs='+', required=True, help='Experiment yaml file path')
args = vars(parser.parse_args())
with open('./configs/common.yaml', 'r') as f:
common_config = yaml.load(f, Loader=yaml.Loader)
if not isinstance(common_config['device'], list):
common_config['device'] = [common_config['device']]
experiment_configs = []
for experiment_path in args['experiments']:
with open(experiment_path, 'r') as f:
exp_config = dict(common_config['defaults'])
exp_config.update(yaml.load(f, Loader=yaml.Loader))
experiment_configs.append(exp_config)
with ExperimentStage(common_config, experiment_configs) as exp_stage:
exp_stage.run()