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
bec2b500
Commit
bec2b500
authored
Jun 21, 2023
by
nikuya3
Browse files
Preprocess answer choices of hellaswag task
parent
8c653b93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
16 deletions
+2
-16
lm_eval/tasks/hellaswag/hellaswag.yaml
lm_eval/tasks/hellaswag/hellaswag.yaml
+2
-2
lm_eval/tasks/hellaswag/preprocess_hellaswag.py
lm_eval/tasks/hellaswag/preprocess_hellaswag.py
+0
-14
No files found.
lm_eval/tasks/hellaswag/hellaswag.yaml
View file @
bec2b500
...
@@ -7,8 +7,8 @@ output_type: multiple_choice
...
@@ -7,8 +7,8 @@ output_type: multiple_choice
training_split
:
train
training_split
:
train
validation_split
:
validation
validation_split
:
validation
test_split
:
null
test_split
:
null
template_aliases
:
"
{%
set
answer_choices
=
endings
%}{%
set
gold
=
label
%}"
template_aliases
:
"
{%
set
gold
=
label
%}{%
set
answer_choices
=
endings
|map('regex_replace',
'
\\
[.*?
\\
]',
'')|map('replace',
'
[title]',
'.
')|map('replace',
'
',
'
')|list
%}"
doc_to_text
:
!function
preprocess_hellaswag.doc_to_text
doc_to_text
:
"
{%
set
text
=
activity_label
~
':
'
~
ctx_a
~
'
'
~
ctx_b.capitalize()
%}{{text|regex_replace('
\\
[.*?
\\
]',
'')|replace('
[title]',
'.
')|replace('
',
'
')}}"
doc_to_target
:
"
{{gold}}"
doc_to_target
:
"
{{gold}}"
metric_list
:
metric_list
:
-
metric
:
acc
-
metric
:
acc
...
...
lm_eval/tasks/hellaswag/preprocess_hellaswag.py
deleted
100644 → 0
View file @
8c653b93
import
re
def
preprocess
(
text
):
text
=
text
.
strip
()
# NOTE: Brackets are artifacts of the WikiHow dataset portion of HellaSwag.
text
=
text
.
replace
(
" [title]"
,
". "
)
text
=
re
.
sub
(
"
\\
[.*?
\\
]"
,
""
,
text
)
text
=
text
.
replace
(
" "
,
" "
)
return
text
def
doc_to_text
(
doc
):
ctx
=
doc
[
"ctx_a"
]
+
" "
+
doc
[
"ctx_b"
].
capitalize
()
query
=
preprocess
(
doc
[
"activity_label"
]
+
": "
+
ctx
)
return
query
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