-
Notifications
You must be signed in to change notification settings - Fork 861
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
Suppport realtime inference for matcher #2613
Conversation
Job PR-2613-f7516c6 is done. |
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
prob = F.softmax(logits.float(), dim=1)[:, 1] | ||
else: | ||
cosine_similarity = F.cosine_similarity(embeddings1, embeddings2) | ||
prob = 0.5 * (cosine_similarity + 1) |
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.
Is it necessary to convert similarity into probability in this way? I guess users care more about the real matching similarity in most cases.
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.
This function is to compute the probability, normalized to range (0, 1), which is required in computing some validation metrics, e.g., roc_auc. To compute the cosine similarity, users can call another util function compute_semantic_similarity
.
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
Issue #, if available:
Description of changes:
predict()
,realtime_predict()
, andprocess_batch()
util functions to support both predictor and matcher._predict()
,_realtime_predict()
, and_process_batch
frompredictor.py
.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.