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
aecf13dd
Commit
aecf13dd
authored
May 15, 2021
by
Leo Gao
Browse files
fix hendrycksMath for \fixed without curly braces
parent
9bbf2406
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
lm_eval/tasks/hendrycks_math.py
lm_eval/tasks/hendrycks_math.py
+13
-6
No files found.
lm_eval/tasks/hendrycks_math.py
View file @
aecf13dd
...
@@ -107,16 +107,23 @@ class Math(Task):
...
@@ -107,16 +107,23 @@ class Math(Task):
return
str1
==
str2
return
str1
==
str2
def
remove_boxed
(
self
,
s
):
def
remove_boxed
(
self
,
s
):
left
=
"
\\
boxed
{"
if
"
\\
boxed
"
in
s
:
try
:
left
=
"
\\
boxed "
assert
s
[:
len
(
left
)]
==
left
assert
s
[:
len
(
left
)]
==
left
assert
s
[
-
1
]
==
"}"
return
s
[
len
(
left
):]
return
s
[
len
(
left
):
-
1
]
except
AssertionError
:
left
=
"
\\
boxed{"
return
None
assert
s
[:
len
(
left
)]
==
left
assert
s
[
-
1
]
==
"}"
return
s
[
len
(
left
):
-
1
]
def
last_boxed_only_string
(
self
,
string
):
def
last_boxed_only_string
(
self
,
string
):
idx
=
string
.
rfind
(
"
\\
boxed"
)
idx
=
string
.
rfind
(
"
\\
boxed"
)
if
"
\\
boxed "
in
string
:
return
"
\\
boxed "
+
string
.
split
(
"
\\
boxed "
)[
-
1
].
split
(
"$"
)[
0
]
if
idx
<
0
:
if
idx
<
0
:
idx
=
string
.
rfind
(
"
\\
fbox"
)
idx
=
string
.
rfind
(
"
\\
fbox"
)
if
idx
<
0
:
if
idx
<
0
:
...
...
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