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

Enable batch mode for SAS cross encoders #1987

Merged
merged 3 commits into from
Jan 11, 2022
Merged

Enable batch mode for SAS cross encoders #1987

merged 3 commits into from
Jan 11, 2022

Conversation

tstadel
Copy link
Member

@tstadel tstadel commented Jan 10, 2022

Proposed changes:

  • process all prediction-label-combinations at once

closes #1769

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

These changes look good to me. 👍 I had to think a moment to understand the difference in the two lines:

top_1_sas.append(np.max(scores_window[:len_l]))
top_k_sas.append(np.max(scores_window))

Maybe a comment could have explained here that we consider the best score out of len_l labels for the top prediction for the first line of code, etc. and for the second line the best score out of multiple predictions. However, I'd be fine with merging it as is.

@@ -405,6 +405,8 @@ def semantic_answer_similarity(predictions: List[List[str]],
current_position = 0
for len_p, len_l in lengths:
scores_window = scores[current_position:current_position+len_p*len_l]
# Per predicted doc there are len_l entries comparing it to all len_l labels.
Copy link
Member

Choose a reason for hiding this comment

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

👍

@tstadel tstadel merged commit c861fdb into master Jan 11, 2022
@tstadel tstadel deleted the sas_batch_mode branch January 11, 2022 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:eval type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Batch Mode for Metrics Calculation
2 participants