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
1e044b92
Commit
1e044b92
authored
Mar 19, 2021
by
Eric Tang
Browse files
fixed linter issue
parent
52c7ec8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
19 deletions
+3
-19
lm_eval/tasks/math.py
lm_eval/tasks/math.py
+3
-19
No files found.
lm_eval/tasks/math.py
View file @
1e044b92
...
...
@@ -37,6 +37,8 @@ class Math(Task):
for
doc
in
self
.
_testing_docs
:
doc
[
"answer"
]
=
self
.
remove_boxed
(
self
.
last_boxed_only_string
(
doc
[
"solution"
]))
self
.
_testing_docs
=
self
.
_testing_docs
[:
25
]
def
has_training_docs
(
self
):
return
True
...
...
@@ -230,24 +232,6 @@ class Math(Task):
else
:
return
string
def
order
(
self
,
string
):
if
"("
in
string
or
")"
in
string
or
"["
in
string
or
"]"
in
string
or
", "
not
in
string
:
return
string
# otherwise, split by "," and sort
# ASSUMES commas have been removed from number representation (and spaces have been removed)
splits
=
string
.
split
(
", "
)
splits
=
sorted
(
splits
)
new_str
=
""
for
split
in
splits
:
new_str
+=
split
+
", "
new_str
=
new_str
[:
-
2
]
# remove last ","
try
:
assert
new_str
[
-
2
:]
!=
", "
# for testing
except
:
return
string
return
new_str
def
fix_sqrt
(
self
,
string
):
if
"
\\
sqrt"
not
in
string
:
return
string
...
...
@@ -292,7 +276,7 @@ class Math(Task):
string
=
string
.
replace
(
"
\\
$"
,
""
)
# remove units (on the right)
string
=
remove_right_units
(
string
)
string
=
self
.
remove_right_units
(
string
)
# remove percentage
...
...
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