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
d674c7bd
Commit
d674c7bd
authored
Jul 02, 2023
by
Benjamin Fattori
Browse files
winogrande task implemented
parent
d9802303
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
lm_eval/tasks/winogrande/preprocess_winogrande.py
lm_eval/tasks/winogrande/preprocess_winogrande.py
+21
-0
lm_eval/tasks/winogrande/winogrande.yaml
lm_eval/tasks/winogrande/winogrande.yaml
+14
-0
No files found.
lm_eval/tasks/winogrande/preprocess_winogrande.py
0 → 100644
View file @
d674c7bd
def
partial_context
(
doc
,
option
):
# Substitute the pronoun in the sentence with the specified option
# and ignore everything after.
pronoun_loc
=
doc
[
"sentence"
].
index
(
"_"
)
return
doc
[
"sentence"
][:
pronoun_loc
]
+
option
def
partial_target
(
doc
):
# The target is everything after the document specified pronoun.
pronoun_loc
=
doc
[
"sentence"
].
index
(
"_"
)
+
1
return
doc
[
"sentence"
][
pronoun_loc
:].
strip
()
def
create_choices
(
doc
):
choices
=
[]
for
option
in
[
doc
[
"option1"
],
doc
[
"option2"
]]:
partial_ctx
=
partial_context
(
doc
,
option
)
choices
.
append
(
partial_ctx
)
return
choices
def
gold_alias
(
doc
):
answer_to_num
=
{
"1"
:
0
,
"2"
:
1
}
return
answer_to_num
[
doc
[
'answer'
]]
\ No newline at end of file
lm_eval/tasks/winogrande/winogrande.yaml
View file @
d674c7bd
task
:
winogrande
dataset_path
:
winogrande
dataset_name
:
winogrande_xl
output_type
:
winograd_schema
training_split
:
train
validation_split
:
validation
doc_to_target
:
!function
preprocess_winogrande.partial_target
doc_to_text
:
"
{{sentence}}"
create_choices
:
!function
preprocess_winogrande.create_choices
gold_alias
:
!function
preprocess_winogrande.gold_alias
metric_list
:
-
metric
:
acc
aggregation
:
mean
higher_is_better
:
true
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