From dbac20d0890051b25d4f569d70f97bb068630b9b Mon Sep 17 00:00:00 2001 From: KerekesDavid Date: Mon, 21 Oct 2024 16:41:18 +0200 Subject: [PATCH] Add a config file hash to dir name --- pangaea/run.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pangaea/run.py b/pangaea/run.py index 1733e01..611b832 100644 --- a/pangaea/run.py +++ b/pangaea/run.py @@ -2,6 +2,7 @@ import pathlib import pprint import time +import hashlib import hydra import torch @@ -38,6 +39,7 @@ def get_exp_info(hydra_config: HydraConf) -> dict[str, str]: str: experiment information. """ choices = OmegaConf.to_container(hydra_config.runtime.choices) + cfg_hash = hashlib.sha1(OmegaConf.to_yaml(hydra_config).encode(), usedforsecurity=False).hexdigest()[:6] timestamp = time.strftime("%Y%m%d_%H%M%S", time.localtime()) fm = choices["encoder"] decoder = choices["decoder"] @@ -49,7 +51,7 @@ def get_exp_info(hydra_config: HydraConf) -> dict[str, str]: "decoder": decoder, "ds": ds, "task": task, - "exp_name": f"{timestamp}_{fm}_{decoder}_{ds}", + "exp_name": f"{timestamp}_{cfg_hash}_{fm}_{decoder}_{ds}", } return exp_info