Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
2255c2c7
Unverified
Commit
2255c2c7
authored
Oct 15, 2020
by
Stas Bekman
Committed by
GitHub
Oct 16, 2020
Browse files
[seq2seq] get_git_info fails gracefully (#7843)
Co-authored-by:
Sam Shleifer
<
sshleifer@gmail.com
>
parent
dfa4c26b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
examples/seq2seq/utils.py
examples/seq2seq/utils.py
+16
-8
No files found.
examples/seq2seq/utils.py
View file @
2255c2c7
...
@@ -457,14 +457,22 @@ def load_json(path):
...
@@ -457,14 +457,22 @@ def load_json(path):
def
get_git_info
():
def
get_git_info
():
repo
=
git
.
Repo
(
search_parent_directories
=
True
)
try
:
repo_infos
=
{
repo
=
git
.
Repo
(
search_parent_directories
=
True
)
"repo_id"
:
str
(
repo
),
repo_infos
=
{
"repo_sha"
:
str
(
repo
.
head
.
object
.
hexsha
),
"repo_id"
:
str
(
repo
),
"repo_branch"
:
str
(
repo
.
active_branch
),
"repo_sha"
:
str
(
repo
.
head
.
object
.
hexsha
),
"hostname"
:
str
(
socket
.
gethostname
()),
"repo_branch"
:
str
(
repo
.
active_branch
),
}
"hostname"
:
str
(
socket
.
gethostname
()),
return
repo_infos
}
return
repo_infos
except
TypeError
:
return
{
"repo_id"
:
None
,
"repo_sha"
:
None
,
"repo_branch"
:
None
,
"hostname"
:
None
,
}
ROUGE_KEYS
=
[
"rouge1"
,
"rouge2"
,
"rougeL"
,
"rougeLsum"
]
ROUGE_KEYS
=
[
"rouge1"
,
"rouge2"
,
"rougeL"
,
"rougeLsum"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment