Skip to content

fix: respect attention mask in CLS pooling - #215

Merged
akshayballal95 merged 1 commit into
StarlightSearch:devfrom
mikemikimike:fix/cls-left-padding
Aug 12, 2026
Merged

fix: respect attention mask in CLS pooling#215
akshayballal95 merged 1 commit into
StarlightSearch:devfrom
mikemikimike:fix/cls-left-padding

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

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.

@akshayballal95
akshayballal95 self-requested a review August 12, 2026 08:26
@akshayballal95
akshayballal95 merged commit 5108f13 into StarlightSearch:dev Aug 12, 2026
@akshayballal95

Copy link
Copy Markdown
Collaborator

Merged! Thanks for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants