Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
83252575
Commit
83252575
authored
Nov 06, 2021
by
Jonathan Tow
Browse files
Add newline separator for correct `rougeLsum`
parent
61b14994
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
lm_eval/tasks/truthfulqa.py
lm_eval/tasks/truthfulqa.py
+6
-0
No files found.
lm_eval/tasks/truthfulqa.py
View file @
83252575
...
...
@@ -399,9 +399,15 @@ class TruthfulQAGeneration(Task):
"""
rouge_types
=
[
"rouge1"
,
"rouge2"
,
"rougeLsum"
]
scorer
=
rouge_scorer
.
RougeScorer
(
rouge_types
)
# Add newlines between sentences to correctly compute `rougeLsum`.
def
_prepare_summary
(
summary
):
summary
=
summary
.
replace
(
" . "
,
".
\n
"
)
return
summary
# Accumulate confidence intervals.
aggregator
=
scoring
.
BootstrapAggregator
()
for
ref
,
pred
in
zip
(
refs
,
preds
):
ref
=
_prepare_summary
(
ref
)
pred
=
_prepare_summary
(
pred
)
aggregator
.
add_scores
(
scorer
.
score
(
ref
,
pred
))
result
=
aggregator
.
aggregate
()
return
{
type
:
result
[
type
].
mid
.
fmeasure
*
100
for
type
in
rouge_types
}
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