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

[ML] fix NLP question_answering task when best answer is only one token #88347

Merged
merged 6 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
5 changes: 5 additions & 0 deletions docs/changelog/88347.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 88347
summary: Fix NLP `question_answering` task when best answer is only one token
area: Machine Learning
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static void topScores(
if (startNormalized[i] == 0) {
continue;
}
for (int j = i + 1; j < (maxAnswerLength + i) && j < tokenSize; j++) {
for (int j = i; j < (maxAnswerLength + i) && j < tokenSize; j++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 227 still has i + 1. Is that correct? If it is then it would be good to add a comment explaining why a different start point is used in the two places.

double score = startNormalized[i] * endNormalized[j];
if (score > maxScore) {
maxScore = score;
Expand Down