Skip to content

[model] support Qwen3.5-397B-A17B#8058

Merged
Jintao-Huang merged 5 commits intomodelscope:mainfrom
Jintao-Huang:support_qwen3_5_moe
Feb 16, 2026
Merged

[model] support Qwen3.5-397B-A17B#8058
Jintao-Huang merged 5 commits intomodelscope:mainfrom
Jintao-Huang:support_qwen3_5_moe

Conversation

@Jintao-Huang
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Jintao-Huang, 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 enhances the model bridging capabilities by introducing specific support for the qwen3_5 model, particularly for its multi-transformer layer (MTP) configurations within Mixture-of-Experts (MoE) setups. The changes involve propagating a new is_mtp_layer flag through several internal state conversion functions, allowing for tailored handling of qwen3_5_moe's unique architectural requirements during model state loading and conversion.

Highlights

  • New Parameter for Layer Type: Introduced an is_mtp_layer boolean parameter to _set_moe_state, _get_hf_grouped, _set_mlp_state, and _set_layer_mlp functions to distinguish between standard and multi-transformer layers.
  • Qwen3_5 MoE Specific Handling: Modified the _get_hf_grouped method to conditionally handle the qwen3_5_moe model type based on the is_mtp_layer flag, ensuring correct grouping behavior for its specific Mixture-of-Experts architecture.
  • MTP Layer Conversion Update: Updated the _convert_mtp_layer function to pass the is_mtp_layer=True flag when converting MLP layers, ensuring the new logic is applied where necessary for multi-transformer layer configurations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • swift/megatron/model/gpt_bridge.py
    • Added is_mtp_layer parameter to _set_moe_state, _get_hf_grouped, _set_mlp_state, and _set_layer_mlp functions.
    • Adjusted _get_hf_grouped logic to specifically manage qwen3_5_moe model's grouped state when is_mtp_layer is true.
    • Modified _convert_mtp_layer to pass is_mtp_layer=True to _set_layer_mlp.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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
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 adds support for the qwen3_5_moe model by introducing specific handling for its MTP (Multi-Token Prediction) layers. The changes are well-contained within gpt_bridge.py and involve propagating an is_mtp_layer flag to differentiate behavior. The implementation is correct, and I have one suggestion to refactor a method for improved readability.

@Jintao-Huang
Copy link
Collaborator Author

/gemini review

@Jintao-Huang Jintao-Huang changed the title [model] support qwen3_5 [model] support Qwen3.5-397B-A17B Feb 16, 2026
Copy link
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 adds support for the Qwen3.5 model series. The changes include updating documentation, registering the new model with its specific configurations, and adjusting the Megatron bridge for proper weight conversion. The implementation looks solid, and I've identified one important bug fix. Overall, the changes are well-integrated into the existing framework.

@Jintao-Huang
Copy link
Collaborator Author

/gemini review

Copy link
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 adds support for the Qwen3.5-397B-A17B model. The changes include updating documentation, refactoring argument initialization, and adding model-specific logic for weight conversion, especially for MoE and MTP layers. The implementation looks mostly correct, but I've identified a potential regression in swift/megatron/model/gpt_bridge.py that might affect the existing qwen3_vl_moe model. Please see my specific comment on that file.

'glm4_moe_lite', 'glm4v_moe', 'minimax_m2', 'olmoe', 'qwen3_next', 'kimi_vl', 'qwen3_omni_moe',
'qwen3_vl_moe', 'qwen3_5_moe'
'glm4_moe_lite', 'glm4v_moe', 'minimax_m2', 'olmoe', 'qwen3_next', 'kimi_vl', 'qwen3_omni_moe'
}:
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The model type qwen3_vl_moe was removed from this set, which will change its behavior. Previously, _get_hf_grouped would return (False, False) for this model, but now it will fall through and return (None, None). This will affect the hf_grouped flag in _set_mlp_state. Was this change intentional? If not, qwen3_vl_moe should be added back to the set to maintain existing functionality.

                'glm4_moe_lite', 'glm4v_moe', 'minimax_m2', 'olmoe', 'qwen3_next', 'kimi_vl', 'qwen3_omni_moe', 'qwen3_vl_moe'

@Jintao-Huang Jintao-Huang merged commit effe597 into modelscope:main Feb 16, 2026
2 of 3 checks passed
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.

1 participant