Skip to content

Commit

Permalink
added run id.
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnstRoell committed Jun 24, 2024
1 parent 80e1945 commit dfd2777
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions experiments/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)


Expand Down
6 changes: 4 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ 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)
print_info(config)

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.")
Expand Down

0 comments on commit dfd2777

Please sign in to comment.