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
d22ea1f3
Commit
d22ea1f3
authored
Mar 24, 2021
by
Jonathan Tow
Browse files
Add `answer` key to training docs for uniformity
parent
410ca65f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
lm_eval/tasks/math.py
lm_eval/tasks/math.py
+9
-10
No files found.
lm_eval/tasks/math.py
View file @
d22ea1f3
...
...
@@ -38,23 +38,22 @@ class Math(Task):
def
has_test_docs
(
self
):
return
True
def
training_docs
(
self
):
path
=
self
.
DATASET_PATH
/
"train"
/
self
.
get_file_info
()
def
_load_docs
(
self
,
path
):
for
file
in
path
.
iterdir
():
with
open
(
file
)
as
f
:
yield
json
.
load
(
f
)
doc
=
json
.
load
(
f
)
doc
[
"answer"
]
=
self
.
remove_boxed
(
self
.
last_boxed_only_string
(
doc
[
"solution"
]))
yield
doc
def
training_docs
(
self
):
return
self
.
_load_docs
(
self
.
DATASET_PATH
/
"train"
/
self
.
get_file_info
())
def
validation_docs
(
self
):
return
NotImplemented
def
test_docs
(
self
):
path
=
self
.
DATASET_PATH
/
"test"
/
self
.
get_file_info
()
for
file
in
path
.
iterdir
():
with
open
(
file
)
as
f
:
doc
=
json
.
load
(
f
)
doc
[
"answer"
]
=
self
.
remove_boxed
(
self
.
last_boxed_only_string
(
doc
[
"solution"
]))
yield
doc
return
self
.
_load_docs
(
self
.
DATASET_PATH
/
"test"
/
self
.
get_file_info
())
def
fewshot_description
(
self
):
return
"Given a mathematics problem, determine the answer. Simplify your answer as much as possible."
...
...
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