-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathconfig.py
30 lines (24 loc) · 872 Bytes
/
config.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
26
27
28
29
30
"""For sharing directory paths among different files.
If there is any need to modify directory structure etc., modifying this file should handle all dependencies."""
import os
import json
'''
root_path
data
train
decoder
'''
cd = os.path.dirname(__file__)
root_path = cd
print("root path of project: {}".format(root_path))
train_path = os.path.abspath(os.path.join(root_path, "train"))
data_path = os.path.abspath(os.path.join(root_path, "data"))
experiment_path = os.path.abspath(os.path.join(train_path, "experiments"))
class ExperimentConfig:
def __init__(self, **entries):
self.__dict__.update(entries)
def __repr__(self):
return str(self.__dict__)
def get_configs(experiment):
config_data = json.loads(open(os.path.join(experiment_path, str(experiment), "config.json"), "rt").read())
return ExperimentConfig(**config_data)