Skip to content
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

Fix a tiny bug in DROP metric #229

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Conversation

sadra-barikbin
Copy link
Contributor

Hi there!

To fix a tiny bug in DROP metric in dealing with multi-span answers.

Fixes #195

exact_match, f1_score = _get_metrics(predictions, gold_answer)
if gold_answer.strip():
if gold_answer[0].strip():
Copy link
Member

Choose a reason for hiding this comment

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

if gold_answer is a string, this will fail

Copy link
Member

Choose a reason for hiding this comment

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

A simplest solution is to add the check on list after we got the metric results, see suggestion

Comment on lines 150 to 153
if isinstance(gold_answer, list):
gold_answer = gold_answer[0]
exact_match, f1_score = _get_metrics(predictions, gold_answer)
if gold_answer.strip():
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if isinstance(gold_answer, list):
gold_answer = gold_answer[0]
exact_match, f1_score = _get_metrics(predictions, gold_answer)
if gold_answer.strip():
exact_match, f1_score = _get_metrics(predictions, gold_answer)
if isinstance(gold_answer, list):
gold_answer = gold_answer[0]
if gold_answer.strip():

Copy link
Member

@clefourrier clefourrier left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@clefourrier clefourrier merged commit 66ed7a2 into huggingface:main Jul 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An apparent bug in drop's dealing with multi-span answer
2 participants