Skip to content

Commit

Permalink
[seq2seq] get_git_info fails gracefully (huggingface#7843)
Browse files Browse the repository at this point in the history
Co-authored-by: Sam Shleifer <[email protected]>
  • Loading branch information
stas00 and sshleifer authored Oct 16, 2020
1 parent dfa4c26 commit 2255c2c
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions examples/seq2seq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,22 @@ def load_json(path):


def get_git_info():
repo = git.Repo(search_parent_directories=True)
repo_infos = {
"repo_id": str(repo),
"repo_sha": str(repo.head.object.hexsha),
"repo_branch": str(repo.active_branch),
"hostname": str(socket.gethostname()),
}
return repo_infos
try:
repo = git.Repo(search_parent_directories=True)
repo_infos = {
"repo_id": str(repo),
"repo_sha": str(repo.head.object.hexsha),
"repo_branch": str(repo.active_branch),
"hostname": str(socket.gethostname()),
}
return repo_infos
except TypeError:
return {
"repo_id": None,
"repo_sha": None,
"repo_branch": None,
"hostname": None,
}


ROUGE_KEYS = ["rouge1", "rouge2", "rougeL", "rougeLsum"]
Expand Down

0 comments on commit 2255c2c

Please sign in to comment.