Skip to content

Commit 22d0b26

Browse files
author
Arthur Douillard
committed
[results_utils] Put same exp (diff seed) on same folder.
1 parent 9a51061 commit 22d0b26

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

inclearn/results_utils.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ def get_template_results(args):
1515

1616
def save_results(results, label):
1717
del results["config"]["device"]
18-
file_path = "{}_{}.json".format(utils.get_date(), label)
19-
with open(os.path.join("results", file_path), "w+") as f:
20-
json.dump(results, f)
2118

19+
folder_path = os.path.join("results", label)
20+
if not os.path.exists(folder_path):
21+
os.makedirs(folder_path)
22+
23+
file_path = "{date}_{label}_{seed}.json".format(
24+
date=utils.get_date(),
25+
label=label,
26+
seed=results["config"]["seed"]
27+
)
28+
with open(os.path.join(folder_path, file_path), "w+") as f:
29+
json.dump(results, f)
2230

2331

2432
def plot(paths, save_path=None):

0 commit comments

Comments
 (0)