Repository navigation
Answer unsupported reranker models with a clear error, not a server error - #399
Merged
Merged
Conversation
…ad of a 500 weight dump
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.
Fixes #398
Problem
/v1/rerankreturns HTTP 500 for BGE and XLM-RoBERTa rerankers and dumps all 393 checkpoint weight names. These checkpoints declare a sequence-classification architecture, but mlx-embeddings loads them without a classification head, so the strict weight load rejects every key and the generic handler maps it to 500.Solution
One gate in the load path: read
config.json, and ifarchitecturesnames a*ForSequenceClassificationmodel other than ModernBERT, raiseUnsupportedRerankerErrorbefore any weight loads. The endpoint maps it to HTTP 400 naming the architecture and two working rerankers. No weight renaming, no widened fallback. Scoring these models needs a classification head added upstream in mlx-embeddings.Test
10 tests were added; 6 fail on main. macos-15 acceptance: 8/8 at the head, the same 4 cells red with the fix reverted, 20 stability repeats clean. ModernBERT and jina scores unchanged.