Commit f1beac00 authored by haileyschoelkopf's avatar haileyschoelkopf
Browse files

save git hash to results dump

parent 38244e15
......@@ -6,7 +6,7 @@ import lm_eval.api.metrics
import lm_eval.models
import lm_eval.tasks
import lm_eval.api
from lm_eval.utils import positional_deprecated, run_task_tests, make_table
from lm_eval.utils import positional_deprecated, run_task_tests, make_table, get_git_commit_hash
@positional_deprecated
......@@ -90,6 +90,7 @@ def simple_evaluate(
"limit": limit,
"bootstrap_iters": bootstrap_iters,
}
results["git_hash"] = get_git_commit_hash()
return results
......
......@@ -240,6 +240,19 @@ def run_task_tests(task_list: List[str]):
)
def get_git_commit_hash():
"""
Gets the git commit hash of your current repo (if it exists).
Source: https://github.com/EleutherAI/gpt-neox/blob/b608043be541602170bfcfb8ec9bf85e8a0799e0/megatron/neox_arguments/neox_args.py#L42
"""
try:
git_hash = subprocess.check_output(["git", "describe", "--always"]).strip()
git_hash = git_hash.decode()
except subprocess.CalledProcessError:
git_hash = None
return git_hash
env = Environment(loader=BaseLoader, undefined=StrictUndefined)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment