Repository navigation
Fix decoder reranker export in seq-cls class - #1508
Open
Ibrahim AlRayes (IbrahimRayes) wants to merge 1 commit into
Open
Ibrahim AlRayes (IbrahimRayes) wants to merge 1 commit into
Ibrahim AlRayes (IbrahimRayes) wants to merge 1 commit into
Conversation
Signed-off-by: Ibrahim Alrayes <ialrayes@qti.qualcomm.com>
This branch has not been deployed
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
Decoder-only rerankers such as Qwen3-Reranker (the
*ForSequenceClassificationform vLLM uses fortask: "score") fail to export withQEFFAutoModelForSequenceClassification. This PR fixes that and adds CPU coverage for decoder-based embedding and reranker models.Related to #1445. The Qwen3-Embedding
IndexErrorreported there does not reproduce onmain(transformers 5.19 no longer has the failingsdpa_maskbranch); the release-branch fix will be a separate PR.Root cause
__init__setsconfig.use_cache = True(Adding support of QEFFAutoModelForSequenceClassification #729), so decoder heads return aDynamicCache, which the TorchScript tracer rejects.FP16ClipTransformwithoutSplitTensorsTransform, so weights are inlined and models over 2 GB produce an unloadable ONNX (Qwen3-Reranker-0.6B, andBAAI/bge-reranker-v2-m3on currentmain). Add SplitTensorsTransform to QEFFAutoModel to prevent >2GB protobuf export issue #950 fixed the same issue forQEFFAutoModel.Fix
use_cache = False(a single-pass classifier needs no cache)._onnx_transforms = [FP16ClipTransform, SplitTensorsTransform], as inQEFFAutoModel.Tests
test_qwen3_embedding_and_reranker_cpu_parity_and_export: tiny Qwen3 throughQEFFAutoModelandQEFFAutoModelForSequenceClassification, HF vs QEff vs ORT (atol 1e-5), weights stored as external data.seq_classificationfails onmainwithout the fix and passes with it.qwen3-embedding-export; the export runner now passesmodel_api="embedding"toQEFFAutoModel.test_model_quickcheck.py: 286 passed vs 284 onmain, same 26 offline-download failures on both. Ruff clean.Validation (vs HF fp32, 20 texts / 20 pairs)
QEFFAutoModel)Known limitation
generateright-pads with 0, notpad_token_id; decoder rerankers need inputs pre-padded with the tokenizer's pad id.