Skip to content

Commit 8a44dce

Browse files
authored
Merge pull request #7247 from hiyouga/hiyouga/commit
[misc] support print commit info Former-commit-id: 0f7ec4f
2 parents 6d92338 + d019603 commit 8a44dce

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/llamafactory/extras/env.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,13 @@ def print_env() -> None:
7474
except Exception:
7575
pass
7676

77+
try:
78+
import subprocess
79+
80+
commit_info = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, check=True)
81+
commit_hash = commit_info.stdout.strip()
82+
info["Git commit"] = commit_hash
83+
except Exception:
84+
pass
85+
7786
print("\n" + "\n".join([f"- {key}: {value}" for key, value in info.items()]) + "\n")

0 commit comments

Comments
 (0)