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
2f870265
Unverified
Commit
2f870265
authored
Aug 21, 2023
by
Lintang Sutawika
Committed by
GitHub
Aug 21, 2023
Browse files
Merge pull request #781 from EleutherAI/process-whitespace
[Refactor] Process Whitespace for greedy_until
parents
3d732e68
b2aee121
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
lm_eval/api/task.py
lm_eval/api/task.py
+27
-0
lm_eval/tasks/super_glue/boolq/seq2seq.yaml
lm_eval/tasks/super_glue/boolq/seq2seq.yaml
+2
-2
No files found.
lm_eval/api/task.py
View file @
2f870265
...
...
@@ -652,9 +652,36 @@ class ConfigurableTask(Task):
if
type
(
test_text
)
is
int
:
self
.
multiple_input
=
num_choice
else
:
test_choice
=
None
if
type
(
test_target
)
is
list
:
self
.
multiple_target
=
len
(
test_target
)
else
:
if
(
type
(
test_target
)
is
int
)
and
(
test_choice
is
not
None
):
test_target
=
[
self
.
doc_to_choice
(
test_target
)[
test_target
]]
else
:
test_target
=
[
test_target
]
if
test_choice
is
not
None
:
check_choices
=
test_choice
else
:
check_choices
=
test_target
for
choice
in
check_choices
:
choice_has_whitespace
=
True
if
" "
in
choice
else
False
delimiter_has_whitespace
=
(
True
if
" "
in
self
.
_config
.
target_delimiter
else
False
)
if
delimiter_has_whitespace
and
choice_has_whitespace
:
eval_logger
.
warning
(
f
'Both target_delimiter and target choice: "
{
choice
}
" have whitespace'
)
elif
(
not
delimiter_has_whitespace
)
and
(
not
choice_has_whitespace
):
eval_logger
.
warning
(
f
'Both target_delimiter and target choice: "
{
choice
}
" does not have whitespace, ignore if the language you are evaluating on does not require/use whitespace'
)
def
download
(
self
,
dataset_kwargs
=
None
):
...
...
lm_eval/tasks/super_glue/boolq/seq2seq.yaml
View file @
2f870265
...
...
@@ -7,8 +7,8 @@ output_type: greedy_until
training_split
:
train
validation_split
:
validation
doc_to_text
:
"
{{passage}}
\n
Question:
{{question}}?
\n
Answer:"
doc_to_target
:
"
{{['
no',
'
yes'][
label
]}}"
target_delimiter
:
"
"
doc_to_target
:
label
doc_to_choice
:
[
'
no'
,
'
yes'
]
generation_kwargs
:
until
:
-
"
\n\n
"
...
...
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