-
Notifications
You must be signed in to change notification settings - Fork 109
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
Conversation
exact_match, f1_score = _get_metrics(predictions, gold_answer) | ||
if gold_answer.strip(): | ||
if gold_answer[0].strip(): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
if isinstance(gold_answer, list): | ||
gold_answer = gold_answer[0] | ||
exact_match, f1_score = _get_metrics(predictions, gold_answer) | ||
if gold_answer.strip(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Hi there!
To fix a tiny bug in DROP metric in dealing with multi-span answers.
Fixes #195