Skip to content

support Qwen3ForSequenceClassification#7314

Closed
bzantium wants to merge 2 commits intosgl-project:mainfrom
bzantium:support_qwen3classification
Closed

support Qwen3ForSequenceClassification#7314
bzantium wants to merge 2 commits intosgl-project:mainfrom
bzantium:support_qwen3classification

Conversation

@bzantium
Copy link
Copy Markdown
Contributor

Motivation

This pull request introduces support for the Qwen3ForSequenceClassification model class to the sglang framework. The recently released Qwen3 model series represents a significant advancement in large language models, offering state-of-the-art performance.

Modifications

Implement qwen3_classification modeling and write docs and testing.

Checklist

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @bzantium, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the sglang framework by integrating comprehensive support for the Qwen3ForSequenceClassification model. This enables users to leverage the advanced capabilities of Qwen3 models for various sequence classification tasks, expanding the framework's utility. The changes involve implementing the new model class, updating system configurations to recognize it, and adding corresponding documentation and unit tests to ensure proper functionality.

Highlights

  • New Model Support: Implemented the Qwen3ForSequenceClassification model class, enabling the sglang framework to utilize Qwen3 models for sequence classification tasks.
  • Core Model Implementation: A new Python module (python/sglang/srt/models/qwen3_classification.py) was added, defining the architecture and forward pass for Qwen3ForSequenceClassification, including integration with the base Qwen3Model and a classification head.
  • System Integration: Updated the model configuration (python/sglang/srt/configs/model_config.py) to recognize Qwen3ForSequenceClassification as a valid model type within the system's is_generation_model function.
  • Documentation and Testing: Added documentation for the new model in docs/supported_models/reward_models.md and included a test case in test/srt/models/test_reward_models.py to verify its functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the Qwen3ForSequenceClassification model. The review focuses on improving code clarity and maintainability.

Comment on lines +65 to +70
def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
# Filter out lm_head weights of Qwen3ForCausalLM
filtered_weights = [
(name, w) for name, w in weights if not name.startswith("lm_head")
]
return Qwen3ForCausalLM.load_weights(self, filtered_weights)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a comment explaining the assumptions made about Qwen3ForCausalLM.load_weights regarding attribute access to improve maintainability.

@b8zhong b8zhong mentioned this pull request Jun 21, 2025
81 tasks
@hnyls2002
Copy link
Copy Markdown
Collaborator

Already supported in #7957

@hnyls2002 hnyls2002 closed this Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants