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
74d8d69b
Unverified
Commit
74d8d69b
authored
Sep 28, 2020
by
Sam Shleifer
Committed by
GitHub
Sep 28, 2020
Browse files
[s2s] consistent output format across eval scripts (#7435)
parent
671b278e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
examples/seq2seq/rouge_cli.py
examples/seq2seq/rouge_cli.py
+1
-1
examples/seq2seq/run_eval.py
examples/seq2seq/run_eval.py
+1
-2
No files found.
examples/seq2seq/rouge_cli.py
View file @
74d8d69b
...
@@ -9,7 +9,7 @@ def calculate_rouge_path(pred_path, tgt_path, save_path=None, **kwargs):
...
@@ -9,7 +9,7 @@ def calculate_rouge_path(pred_path, tgt_path, save_path=None, **kwargs):
tgt_lns
=
[
x
.
strip
()
for
x
in
open
(
tgt_path
).
readlines
()][:
len
(
pred_lns
)]
tgt_lns
=
[
x
.
strip
()
for
x
in
open
(
tgt_path
).
readlines
()][:
len
(
pred_lns
)]
metrics
=
calculate_rouge
(
pred_lns
,
tgt_lns
,
**
kwargs
)
metrics
=
calculate_rouge
(
pred_lns
,
tgt_lns
,
**
kwargs
)
if
save_path
is
not
None
:
if
save_path
is
not
None
:
save_json
(
metrics
,
save_path
)
save_json
(
metrics
,
save_path
,
indent
=
None
)
return
metrics
# these print nicely
return
metrics
# these print nicely
...
...
examples/seq2seq/run_eval.py
View file @
74d8d69b
...
@@ -152,8 +152,7 @@ def run_generate(verbose=True):
...
@@ -152,8 +152,7 @@ def run_generate(verbose=True):
print
(
scores
)
print
(
scores
)
if
args
.
score_path
is
not
None
:
if
args
.
score_path
is
not
None
:
path
=
args
.
score_path
json
.
dump
(
scores
,
open
(
args
.
score_path
,
"w"
))
json
.
dump
(
scores
,
open
(
path
,
"w"
))
return
scores
return
scores
...
...
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