m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/experiment.py9
-rw-r--r--src/run.py3
2 files changed, 7 insertions, 5 deletions
diff --git a/src/experiment.py b/src/experiment.py
index f8a219a..85bc4a1 100644
--- a/src/experiment.py
+++ b/src/experiment.py
@@ -9,8 +9,8 @@ import torch
from runner import Runner
class Experiment:
- def __init__(self, file):
- self.make_dir()
+ def __init__(self, file, prefix):
+ self.make_dir(prefix)
self.copy_config(file)
self.metrics = ExperimentMetrics()
self.runner = Runner(file, self.metrics)
@@ -41,9 +41,10 @@ class Experiment:
def dir_path(self, file):
return '{}/{}'.format(self.dirname, file)
- def make_dir(self):
+ def make_dir(self, prefix):
time_string = time.strftime('%Y%m%d%H%M%S')
- dirname = 'outputs/{}'.format(time_string)
+ prefix = '' if prefix == '' else '{}-'.format(prefix)
+ dirname = 'outputs/{}{}'.format(prefix, time_string)
self.dirname = dirname
os.mkdir(dirname)
diff --git a/src/run.py b/src/run.py
index db25e60..28324d8 100644
--- a/src/run.py
+++ b/src/run.py
@@ -8,7 +8,8 @@ if len(sys.argv) < 2:
exit(1)
file = sys.argv[1]
+prefix = sys.argv[2] if len(sys.argv) > 2 else ''
-experiment = Experiment(file)
+experiment = Experiment(file, prefix)
experiment.run()
experiment.save_results()