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
2411c9d3
Commit
2411c9d3
authored
Jul 03, 2023
by
Benjamin Fattori
Browse files
update race preprocess + rename dataset
parent
7feab5e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
lm_eval/tasks/race/preprocess_race.py
lm_eval/tasks/race/preprocess_race.py
+7
-2
lm_eval/tasks/race/race.yaml
lm_eval/tasks/race/race.yaml
+1
-3
No files found.
lm_eval/tasks/race/preprocess_race.py
View file @
2411c9d3
import
ast
def
process_ast
(
string
):
return
ast
.
literal_eval
(
string
)
def
last_problem
(
doc
):
def
last_problem
(
doc
):
return
doc
[
"problems"
][
-
1
]
return
process_ast
(
doc
[
"problems"
]
)
[
-
1
]
def
get_answer_option
(
problem
):
def
get_answer_option
(
problem
):
letter_to_num
=
{
"A"
:
0
,
"B"
:
1
,
"C"
:
2
,
"D"
:
3
}
letter_to_num
=
{
"A"
:
0
,
"B"
:
1
,
"C"
:
2
,
"D"
:
3
}
...
@@ -13,7 +18,7 @@ def create_choices(doc):
...
@@ -13,7 +18,7 @@ def create_choices(doc):
def
doc_to_text
(
doc
):
def
doc_to_text
(
doc
):
text
=
"Article: "
+
doc
[
"article"
]
+
"
\n\n
"
text
=
"Article: "
+
doc
[
"article"
]
+
"
\n\n
"
for
problem
in
doc
[
"problems"
][:
-
1
]:
for
problem
in
process_ast
(
doc
[
"problems"
]
)
[:
-
1
]:
if
problem
[
"question"
][
-
6
:]
==
" _ ."
:
if
problem
[
"question"
][
-
6
:]
==
" _ ."
:
text
+=
(
text
+=
(
problem
[
"question"
][
-
5
:]
+
get_answer_option
(
problem
)
+
"
\n
"
problem
[
"question"
][
-
5
:]
+
get_answer_option
(
problem
)
+
"
\n
"
...
...
lm_eval/tasks/race/race.yaml
View file @
2411c9d3
group
:
group
:
-
multiple_choice
-
multiple_choice
task
:
race
task
:
race
dataset_path
:
bfattori/race
_grouped
dataset_path
:
bfattori/race
dataset_name
:
high
dataset_name
:
high
output_type
:
multiple_choice
output_type
:
multiple_choice
training_split
:
train
validation_split
:
validation
test_split
:
test
test_split
:
test
create_choices
:
!function
preprocess_race.create_choices
create_choices
:
!function
preprocess_race.create_choices
doc_to_text
:
!function
preprocess_race.doc_to_text
doc_to_text
:
!function
preprocess_race.doc_to_text
...
...
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