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
135b41ce
Commit
135b41ce
authored
Aug 15, 2023
by
lintangsutawika
Browse files
format
parent
0436b5d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
lm_eval/tasks/truthfulqa/utils.py
lm_eval/tasks/truthfulqa/utils.py
+23
-21
No files found.
lm_eval/tasks/truthfulqa/utils.py
View file @
135b41ce
...
@@ -4,6 +4,7 @@ import numpy as np
...
@@ -4,6 +4,7 @@ import numpy as np
from
rouge_score
import
rouge_scorer
,
scoring
from
rouge_score
import
rouge_scorer
,
scoring
def
process_results_mc2
(
doc
,
results
):
def
process_results_mc2
(
doc
,
results
):
lls
,
is_greedy
=
zip
(
*
results
)
lls
,
is_greedy
=
zip
(
*
results
)
...
@@ -24,7 +25,6 @@ def process_docs_gen(dataset: datasets.Dataset) -> datasets.Dataset:
...
@@ -24,7 +25,6 @@ def process_docs_gen(dataset: datasets.Dataset) -> datasets.Dataset:
def
preprocess_function
(
examples
):
def
preprocess_function
(
examples
):
def
_format_answers
(
answers
):
def
_format_answers
(
answers
):
formatted_answers
=
[]
formatted_answers
=
[]
for
answer
in
answers
:
for
answer
in
answers
:
...
@@ -142,6 +142,7 @@ def bleu(refs, preds):
...
@@ -142,6 +142,7 @@ def bleu(refs, preds):
).
score
).
score
return
score
return
score
def
rouge
(
refs
,
preds
):
def
rouge
(
refs
,
preds
):
"""
"""
Returns `t5` style ROUGE scores. See the related implementation:
Returns `t5` style ROUGE scores. See the related implementation:
...
@@ -169,6 +170,7 @@ def rouge(refs, preds):
...
@@ -169,6 +170,7 @@ def rouge(refs, preds):
result
=
aggregator
.
aggregate
()
result
=
aggregator
.
aggregate
()
return
{
type
:
result
[
type
].
mid
.
fmeasure
*
100
for
type
in
rouge_types
}
return
{
type
:
result
[
type
].
mid
.
fmeasure
*
100
for
type
in
rouge_types
}
# def bleurt_max(predictions, references):
# def bleurt_max(predictions, references):
# pass
# pass
...
...
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