From dfd27778f13188abaa1d6a86b397c728d2979671 Mon Sep 17 00:00:00 2001 From: Ernst Roell Date: Mon, 24 Jun 2024 16:11:01 +0200 Subject: [PATCH] added run id. --- experiments/configs.py | 6 +++--- run.py | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/experiments/configs.py b/experiments/configs.py index 7a1970b..17e0863 100644 --- a/experiments/configs.py +++ b/experiments/configs.py @@ -9,7 +9,7 @@ from metrics.tasks import TaskType from models.models import ModelType import yaml -from typing import Any, List +from typing import Any, List, Optional import os @@ -44,8 +44,8 @@ class ConfigExperimentRun(BaseSettings): discriminator=Discriminator(get_discriminator_value) ) - def get_checkpoint_path(self, base_folder: str): - identifier = f"{self.transforms.name.lower()}_{self.task_type.name.lower()}_{self.conf_model.type.name.lower()}_seed_{self.seed}.ckpt" + def get_checkpoint_path(self, base_folder: str, run: Optional[int] = 0): + identifier = f"{self.transforms.name.lower()}_{self.task_type.name.lower()}_{self.conf_model.type.name.lower()}_seed_{self.seed}_run_{run}.ckpt" return os.path.join(base_folder, identifier) diff --git a/run.py b/run.py index b3b9b36..ff5f31c 100644 --- a/run.py +++ b/run.py @@ -15,7 +15,7 @@ def run_configs_folder( config_dir = "./configs" files = os.listdir(config_dir) for file in files: - for _ in range(5): + for i in range(5): config_file = os.path.join(config_dir, file) config = load_config(config_file) print("[INFO] Using configuration file:", config_file) @@ -23,7 +23,9 @@ def run_configs_folder( checkpoint_path = None if checkpoint_folder: - checkpoint_path = config.get_checkpoint_path(checkpoint_folder) + checkpoint_path = config.get_checkpoint_path( + checkpoint_folder, f"{i}" + ) print("[INFO] Using checkpoint folder:", checkpoint_path) else: print("[INFO] No checkpoint folder.")