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
f7a3cf20
Commit
f7a3cf20
authored
Jul 13, 2023
by
lintangsutawika
Browse files
adjust mathqa
parent
a83874e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
lm_eval/tasks/mathqa/mathqa.yaml
lm_eval/tasks/mathqa/mathqa.yaml
+1
-1
lm_eval/tasks/mathqa/utils.py
lm_eval/tasks/mathqa/utils.py
+2
-2
No files found.
lm_eval/tasks/mathqa/mathqa.yaml
View file @
f7a3cf20
...
@@ -9,7 +9,7 @@ validation_split: validation
...
@@ -9,7 +9,7 @@ validation_split: validation
test_split
:
test
test_split
:
test
doc_to_text
:
"
Question:
{{Problem}}
\n
Answer:"
doc_to_text
:
"
Question:
{{Problem}}
\n
Answer:"
doc_to_target
:
!function
utils.doc_to_target
doc_to_target
:
!function
utils.doc_to_target
create
_choice
s
:
!function
utils.
create
_choice
s
# create list of answer choices
doc_to
_choice
:
!function
utils.
doc_to
_choice
# create list of answer choices
metric_list
:
metric_list
:
-
metric
:
acc
-
metric
:
acc
aggregation
:
mean
aggregation
:
mean
...
...
lm_eval/tasks/mathqa/utils.py
View file @
f7a3cf20
import
re
import
re
def
create
_choice
s
(
doc
):
def
doc_to
_choice
(
doc
):
choices
=
[
choices
=
[
c
[
4
:].
rstrip
(
" ,"
)
c
[
4
:].
rstrip
(
" ,"
)
for
c
in
re
.
findall
(
r
"[abcd] \) .*?, |e \) .*?$"
,
doc
[
"options"
])
for
c
in
re
.
findall
(
r
"[abcd] \) .*?, |e \) .*?$"
,
doc
[
"options"
])
...
@@ -10,5 +10,5 @@ def create_choices(doc):
...
@@ -10,5 +10,5 @@ def create_choices(doc):
def
doc_to_target
(
doc
):
def
doc_to_target
(
doc
):
choices
=
create
_choice
s
(
doc
)
choices
=
doc_to
_choice
(
doc
)
return
choices
[[
"a"
,
"b"
,
"c"
,
"d"
,
"e"
].
index
(
doc
[
"correct"
])]
return
choices
[[
"a"
,
"b"
,
"c"
,
"d"
,
"e"
].
index
(
doc
[
"correct"
])]
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