-
Notifications
You must be signed in to change notification settings - Fork 272
Add mean pooling strategy for Modernbert classifier #616
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dbbbf24
Add different pooling stategies for Modernbert classifier
kwnath 683d0db
update test to use reranker model
kwnath 9832f20
Add test snapshot
kwnath 665294d
update snapshots
kwnath 95f90ac
Remove unneeded snapshot
kwnath b07060d
Add new snapshot for classifier mean pooling strat
kwnath aed7457
Update pooling method
kwnath 3ab78be
remove use std::str::FromStr;
kwnath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
7 changes: 7 additions & 0 deletions
7
...s/candle/tests/snapshots/test_modernbert__modernbert_classification_mean_pooling.snap.new
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: backends/candle/tests/test_modernbert.rs | ||
assertion_line: 229 | ||
expression: predictions_single | ||
--- | ||
- - -0.30617672 | ||
|
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Having a bit of trouble running this test (unable to download the HF model, hitting a 429, just lacking a HF token) and not super pleased with this test but it;s just to test that both cls/mean produce different outputs as expected.
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.
How about just testing with the reranker-ModernBERT-large-gooaq-bce model directly, which is a mean classifier-pooling, instead of
gte-reranker
model with mean pooling?I think we can check whether classifier pooling correctly works by running the
reranker-ModernBERT-gooqa-bce
model, whilecls
classifier pooling has already been verified in the above test! (implicitly assume cls and mean will behave differently)when I faced that issue, in my case, I manually download the model via git or huggingface-cli on my local, and then set
HUGGINGFACE_HUB_CACHE
to point to that local path.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.
That sounds like a good idea, will try this!
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.
It couldn't find from the cache but I managed to just export a hugginface token, all good!