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