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
0033f1b6
Commit
0033f1b6
authored
Apr 27, 2022
by
Zdenek Kasner
Browse files
Align BLEU computation with ROUGE
parent
795b7912
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
lm_eval/base.py
lm_eval/base.py
+2
-2
No files found.
lm_eval/base.py
View file @
0033f1b6
...
@@ -768,7 +768,7 @@ class PromptSourceTask(Task):
...
@@ -768,7 +768,7 @@ class PromptSourceTask(Task):
metric
in
self
.
CONFIGURED_PS_METRICS
metric
in
self
.
CONFIGURED_PS_METRICS
),
"Unexpected metric. Add it, or use a task-specific solution."
),
"Unexpected metric. Add it, or use a task-specific solution."
if
metric
==
"BLEU"
:
if
metric
==
"BLEU"
:
out
[
"bleu"
]
=
(
target
,
pred
)
out
[
"bleu"
]
=
metrics
.
bleu
([
(
target
,
pred
)
])
if
metric
==
"ROUGE"
:
if
metric
==
"ROUGE"
:
# TODO: This computes all rouge sub-metrics. Find a generic
# TODO: This computes all rouge sub-metrics. Find a generic
# way to handle user specified rouge sub-metrics to avoid extra
# way to handle user specified rouge sub-metrics to avoid extra
...
@@ -819,7 +819,7 @@ class PromptSourceTask(Task):
...
@@ -819,7 +819,7 @@ class PromptSourceTask(Task):
if
metric
==
"Accuracy"
:
if
metric
==
"Accuracy"
:
out
[
"acc"
]
=
mean
out
[
"acc"
]
=
mean
if
metric
==
"BLEU"
:
if
metric
==
"BLEU"
:
out
[
"bleu"
]
=
me
trics
.
bleu
out
[
"bleu"
]
=
me
an
if
metric
==
"ROUGE"
:
if
metric
==
"ROUGE"
:
# TODO: Find a generic way to handle user specified rouge metrics.
# TODO: Find a generic way to handle user specified rouge metrics.
out
[
"rouge1_precision"
]
=
mean
out
[
"rouge1_precision"
]
=
mean
...
...
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