fix: respect attention mask in CLS pooling - #215
Merged
akshayballal95 merged 1 commit intoAug 12, 2026
Conversation
akshayballal95
self-requested a review
August 12, 2026 08:26
akshayballal95
force-pushed
the
fix/cls-left-padding
branch
from
August 12, 2026 08:52
bf82387 to
dfdee3b
Compare
Collaborator
|
Merged! Thanks for the contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n\n- use the first non-padding token for CLS pooling when an attention mask is provided\n- support both Candle Tensor and ndarray output paths\n- preserve the existing first-position behavior when no mask is provided\n- add CPU unit tests for left-padded Tensor/ndarray batches and the no-mask path\n\nFixes #213\n\n## Validation\n\n- cargo test -p embed_anything pooling (5 passed)\n-
ustfmt --edition 2021 --check rust/src/embeddings/local/pooling.rs\n- git diff --check\n- cargo clippy -p embed_anything --lib --tests --no-deps is blocked by the pre-existing clippy::unit_cmp error in
ust/src/file_loader.rs:190; no clippy errors were introduced in the changed file.