Skip to content

Commit cd94f57

Browse files
author
joeloskarsson
committed
Change run id format to avoid name collisions
1 parent 9912ece commit cd94f57

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

train_model.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import random
12
import torch
23
import pytorch_lightning as pl
34
from lightning_fabric.utilities import seed
@@ -82,6 +83,9 @@ def main():
8283
assert args.step_length <= 3, "Too high step length"
8384
assert args.eval in (None, "val", "test"), f"Unknown eval setting: {args.eval}"
8485

86+
# Get an (actual) random run id as a unique identifier
87+
random_run_id = random.randint(0, 9999)
88+
8589
# Set seed
8690
seed.seed_everything(args.seed)
8791

@@ -120,7 +124,7 @@ def main():
120124
if args.eval:
121125
prefix = prefix + f"eval-{args.eval}-"
122126
run_name = f"{prefix}{args.model}-{args.processor_layers}x{args.hidden_dim}-"\
123-
f"{time.strftime('%m_%d_%H_%M_%S')}"
127+
f"{time.strftime('%m_%d_%H')}-{random_run_id:04d}"
124128
checkpoint_callback = pl.callbacks.ModelCheckpoint(
125129
dirpath=f"saved_models/{run_name}", filename="min_val_loss",
126130
monitor="val_mean_loss", mode="min", save_last=True)

0 commit comments

Comments
 (0)