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
0dbf0255
"...gtest-1.11.0/googlemock/scripts/generator/cpp/tokenize.py" did not exist on "5e24f35816ed2e256efc15cd5d28c147119cf394"
Commit
0dbf0255
authored
Feb 10, 2025
by
Baber
Browse files
add winogrande_gen
parent
799359ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
lm_eval/tasks/winogrande/generation.yaml
lm_eval/tasks/winogrande/generation.yaml
+18
-0
lm_eval/tasks/winogrande/preprocess_winogrande.py
lm_eval/tasks/winogrande/preprocess_winogrande.py
+18
-0
No files found.
lm_eval/tasks/winogrande/generation.yaml
0 → 100644
View file @
0dbf0255
task
:
winogrande_generation
dataset_path
:
winogrande
dataset_name
:
winogrande_xl
output_type
:
generate_until
training_split
:
train
validation_split
:
validation
doc_to_text
:
!function
preprocess_winogrande.doc_to_text_gen
doc_to_target
:
"
{{'A'
if
answer|int
==
1
else
'B'}}"
should_decontaminate
:
true
doc_to_decontamination_query
:
sentence
metric_list
:
-
metric
:
exact_match
aggregation
:
mean
higher_is_better
:
true
metadata
:
version
:
1.0
dataset_kwargs
:
trust_remote_code
:
true
lm_eval/tasks/winogrande/preprocess_winogrande.py
View file @
0dbf0255
...
@@ -12,3 +12,21 @@ def doc_to_choice(doc):
...
@@ -12,3 +12,21 @@ def doc_to_choice(doc):
idx
=
doc
[
"sentence"
].
index
(
"_"
)
idx
=
doc
[
"sentence"
].
index
(
"_"
)
options
=
[
doc
[
"option1"
],
doc
[
"option2"
]]
options
=
[
doc
[
"option1"
],
doc
[
"option2"
]]
return
[
doc
[
"sentence"
][:
idx
]
+
opt
for
opt
in
options
]
return
[
doc
[
"sentence"
][:
idx
]
+
opt
for
opt
in
options
]
def
doc_to_text_gen
(
doc
):
sentence
=
doc
[
"sentence"
]
is_noun
=
doc
[
"option1"
][
0
].
isupper
()
question
=
"Who"
if
is_noun
else
"What"
question
=
f
"Question:
{
question
}
"
+
doc
[
"sentence"
].
split
(
"_"
)[
-
1
]
return
(
"Given the following question and two candidate answers (A and B), choose the best answer"
+
sentence
+
"
\n
"
+
question
+
"
\n
"
+
f
"A.
{
doc
[
'option1'
]
}
"
+
"
\n
"
+
f
"B.
{
doc
[
'option2'
]
}
"
+
'Your response should end with "The best answer is [the_answer_letter]" where the [the_answer_letter] is one of A or B.'
)
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