aboutsummaryrefslogtreecommitdiff
path: root/app/lstm_chem/utils/config.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-07-31 21:23:03 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-07-31 21:23:03 +0530
commit61ce4e7b089d68395be2221f64d89040c0b14a34 (patch)
tree6bd60c1fd4f8bcd1c503914c61272ed382fff1da /app/lstm_chem/utils/config.py
parent376f04d1df2692a8874de686372d18b9ab07950a (diff)
added AI model
Diffstat (limited to 'app/lstm_chem/utils/config.py')
-rwxr-xr-xapp/lstm_chem/utils/config.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/lstm_chem/utils/config.py b/app/lstm_chem/utils/config.py
new file mode 100755
index 0000000..fff7359
--- /dev/null
+++ b/app/lstm_chem/utils/config.py
@@ -0,0 +1,26 @@
+import os
+import time
+import json
+from bunch import Bunch
+
+
+def get_config_from_json(json_file):
+ with open(json_file, 'r') as config_file:
+ config_dict = json.load(config_file)
+ config = Bunch(config_dict)
+ return config
+
+
+def process_config(json_file):
+ config = get_config_from_json(json_file)
+ config.config_file = json_file
+ config.exp_dir = os.path.join(
+ 'experiments', time.strftime('%Y-%m-%d/', time.localtime()),
+ config.exp_name)
+ config.tensorboard_log_dir = os.path.join(
+ 'experiments', time.strftime('%Y-%m-%d/', time.localtime()),
+ config.exp_name, 'logs/')
+ config.checkpoint_dir = os.path.join(
+ 'experiments', time.strftime('%Y-%m-%d/', time.localtime()),
+ config.exp_name, 'checkpoints/')
+ return config