Address review nits on NONE and LAST_TOKEN pooling PRs#4744
Address review nits on NONE and LAST_TOKEN pooling PRs#4744aneesh-db wants to merge 2 commits intoopensearch-project:mainfrom
Conversation
|
Failed to generate code suggestions for PR |
ee5558e to
a00348e
Compare
|
Failed to generate code suggestions for PR |
|
@aneesh-db Thanks for the follow-up PRs. Could you also remove the feature details from the older release notes? This was added in your previous PR.s |
- Early return for NONE pooling in HuggingfaceTextEmbeddingTranslator to skip unnecessary attention mask creation and switch statement - Extract lastTokenPool to shared TextEmbeddingPoolingUtils class, eliminating duplication between ONNX and Huggingface translators - Use toLongArray() consistently for attention mask sum, avoiding float-to-long precision concerns Signed-off-by: Aneesh Nema <aneesh.nema@databricks.com>
a00348e to
3214126
Compare
PR Reviewer Guide 🔍(Review updated until commit 74bc0d2)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 74bc0d2
Previous suggestionsSuggestions up to commit 3214126
|
Release notes are auto-generated, removing entries added in opensearch-project#4710 and opensearch-project#4711. Signed-off-by: Aneesh Nema <aneesh.nema@databricks.com>
|
Persistent review updated to latest commit 74bc0d2 |
|
@pyek-bot done, removed the feature details from the older release notes |
Description
Follow-up to address review comments from #4710 and #4711:
Early return for NONE pooling (comment):
HuggingfaceTextEmbeddingTranslatornow returns immediately when pooling isnone, skipping unnecessary attention mask creation and switch statement.Extract shared
lastTokenPool(comment): Moved duplicatedlastTokenPoolmethod from both translators into a sharedTextEmbeddingPoolingUtilsclass. Also normalizes to usetoLongArray()consistently, avoiding float-to-long precision concerns.Related Issues
Follow-up to #4710 and #4711
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.