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
1a28d18f
Commit
1a28d18f
authored
Sep 18, 2024
by
Baber
Browse files
add custom regex
parent
c6259cf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
lm_eval/tasks/mathvista/utils.py
lm_eval/tasks/mathvista/utils.py
+6
-0
No files found.
lm_eval/tasks/mathvista/utils.py
View file @
1a28d18f
...
...
@@ -101,6 +101,12 @@ def extract_answer(response: str, problem: dict) -> str:
if
response
==
""
:
return
""
### This is not in the original code:
extract
=
re
.
findall
(
r
"[tT]he answer is (\d+)"
,
response
)
if
extract
:
return
str
(
extract
[
0
])
###
if
question_type
==
"multi_choice"
and
response
in
choices
:
return
response
...
...
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