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
0dd45190
Unverified
Commit
0dd45190
authored
Jun 26, 2023
by
Stella Biderman
Committed by
GitHub
Jun 26, 2023
Browse files
Merge pull request #610 from Vermeille/patch-1
[triviaqa] The ground truth must be a *substring* of the generated an…
parents
5e56fbf6
0570991a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
lm_eval/tasks/triviaqa.py
lm_eval/tasks/triviaqa.py
+6
-4
No files found.
lm_eval/tasks/triviaqa.py
View file @
0dd45190
...
@@ -28,7 +28,7 @@ _CITATION = """
...
@@ -28,7 +28,7 @@ _CITATION = """
class
TriviaQA
(
Task
):
class
TriviaQA
(
Task
):
VERSION
=
2
VERSION
=
3
DATASET_PATH
=
"trivia_qa"
DATASET_PATH
=
"trivia_qa"
DATASET_NAME
=
"rc.nocontext"
DATASET_NAME
=
"rc.nocontext"
...
@@ -86,9 +86,11 @@ class TriviaQA(Task):
...
@@ -86,9 +86,11 @@ class TriviaQA(Task):
return
continuation
return
continuation
def
process_results
(
self
,
doc
,
results
):
def
process_results
(
self
,
doc
,
results
):
continuation
=
results
[
0
].
strip
().
lower
().
translate
(
str
.
maketrans
(
''
,
''
,
string
.
punctuation
))
generated
=
results
[
0
].
strip
().
lower
().
translate
(
str
.
maketrans
(
''
,
''
,
string
.
punctuation
))
list_of_candidates
=
[
alias
.
lower
().
translate
(
str
.
maketrans
(
''
,
''
,
string
.
punctuation
))
for
alias
in
self
.
_remove_prefixes
(
doc
[
"answer"
][
"aliases"
])]
list_of_truth_candidates
=
[
alias
.
lower
().
translate
(
str
.
maketrans
(
''
,
''
,
string
.
punctuation
))
for
alias
in
self
.
_remove_prefixes
(
doc
[
"answer"
][
"aliases"
])]
return
{
"em"
:
float
(
continuation
in
list_of_candidates
)}
def
match
(
candidate
):
return
candidate
in
generated
return
{
"em"
:
float
(
any
(
match
(
candidate
)
for
candidate
in
list_of_truth_candidates
))}
def
aggregation
(
self
):
def
aggregation
(
self
):
return
{
return
{
...
...
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