Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a hash of the config file to the run directory name #104

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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