diff options
author | Marcin Chrzanowski <m@m-chrzan.xyz> | 2021-05-03 20:33:28 +0200 |
---|---|---|
committer | Marcin Chrzanowski <m@m-chrzan.xyz> | 2021-05-03 20:33:28 +0200 |
commit | 3f45fb851bace1d5bb56cd4df06ba0f4c5c47b9b (patch) | |
tree | 047af2b617e0e1d7ea7083a9d5aae5cafffbbb7b | |
parent | d751848090334d0802304d4bf1edb676d2a7f107 (diff) |
Add directory prefixes to experiments
-rw-r--r-- | src/experiment.py | 9 | ||||
-rw-r--r-- | src/run.py | 3 |
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) @@ -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() |