Skip to content

Commit

Permalink
Merge pull request #104 from yurujaja/hashed-runs
Browse files Browse the repository at this point in the history
Add a hash of the config file  to the run directory name
  • Loading branch information
KerekesDavid authored Oct 21, 2024
2 parents 52fd21a + dbac20d commit 9b14172
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pangaea/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pathlib
import pprint
import time
import hashlib

import hydra
import torch
Expand Down Expand Up @@ -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"]
Expand All @@ -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

Expand Down

0 comments on commit 9b14172

Please sign in to comment.