Skip to content

[Fix] OpenICL Math Evaluator Config #2007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions opencompass/openicl/icl_evaluator/math_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def score(self, predictions, references):
details = []
for i, j in zip(predictions, references):
count += 1
j_with_env = f'${j}$'
gold_parsed = parse(
j,
j_with_env,
extraction_mode='first_match',
extraction_config=[
LatexExtractionConfig(),
Expand All @@ -32,16 +33,16 @@ def score(self, predictions, references):
)
# If parsing result is empty, try adding LaTeX
# environment and parse again
if len(gold_parsed) == 0:
j_with_env = f'${j}$'
gold_parsed = parse(
j_with_env,
extraction_mode='first_match',
extraction_config=[
LatexExtractionConfig(),
ExprExtractionConfig(),
],
)
# if len(gold_parsed) == 0:
# j_with_env = f'${j}$'
# gold_parsed = parse(
# j_with_env,
# extraction_mode='first_match',
# extraction_config=[
# LatexExtractionConfig(),
# ExprExtractionConfig(),
# ],
# )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the comments

if len(gold_parsed) != 0:
# We require the answer to be provided in correct
# latex (no malformed operators)
Expand Down