Skip to content

Conversation

sigridjineth
Copy link

What does this PR do?

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the documentation guidelines.
  • Did you write any new necessary tests? If applicable, did you include or update the insta snapshots?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

danielchalef and others added 5 commits August 12, 2025 16:56
- Added Qwen3ClassificationHead with flexible tensor loading that handles:
  - score.weight at top level (for converted Qwen3 rerankers)
  - classifier.weight/bias patterns for standard models
- Updated Qwen3Model and FlashQwen3Model to support classification
- Added predict() method implementations for both model variants
- Extended Qwen3Config with id2label field for classification
- Added test case for Qwen3 reranker models with snapshot

The implementation supports Qwen3 models converted to sequence classifiers
for reranking tasks (e.g., tomaarsen/Qwen3-Reranker-0.6B-seq-cls).
The classification head gracefully handles different tensor naming
conventions from various conversion approaches.

Tested with both embedding and reranking Qwen3 models.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Daniel Chalef <131175+danielchalef@users.noreply.github.com>
- Added optional fields `instruction` and `use_template` to `RerankRequest` for custom instructions and template usage.
- Updated rerank logic to apply templates conditionally based on model type and user input.
- Introduced template formatting for Qwen3 models to improve reranking results.

This update allows for more flexible and context-aware reranking capabilities, particularly for Qwen3 models.
@alvarobartt
Copy link
Member

Hey @sigridjineth, thanks for re-opening this PR! Given the amount of changes this might fall into 1.9.0 rather than 1.8.3, but please let me organize the roadmap and come up with a plan 🤗

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.

3 participants