Skip to content

[Feature][Model] Support text-only Qwen3.5 checkpoints - #14885

Merged
weijinqian0 merged 1 commit into
vllm-project:mainfrom
Karryking3:cc_qwen_bugfix
Aug 25, 2026
Merged

weijinqian0 merged 1 commit into
vllm-project:mainfrom
Karryking3:cc_qwen_bugfix

Conversation

@Karryking3

@Karryking3 Karryking3 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

This PR backports the Qwen3.5 text-only RoPE handling and ModelSlim packed-module mappings from vLLM PR #50734.
Text-only Qwen3.5-family checkpoints use the model types qwen3_5_text or qwen3_5_moe_text. Unlike multimodal Qwen3.5 checkpoints, they do not expose multimodal RoPE fields such as mrope_section.
Before this change, the Ascend Qwen3.5 attention patch selected the multimodal RoPE path based only on the qwen3_5 model-type prefix. This could cause text-only checkpoints to access missing multimodal RoPE attributes. ModelSlim also lacked packed-module mappings for the text-only dense and MoE model types.
The change:

  • selects the multimodal RoPE path only when mrope_section is available;
  • keeps text-only Qwen3.5 checkpoints on the standard RoPE path;
  • adds ModelSlim packed-module mappings for qwen3_5_text;
  • adds ModelSlim packed-module and expert mappings for qwen3_5_moe_text;
  • adds focused unit coverage for RoPE selection and ModelSlim mappings.
    This is a scoped backport. It does not include the model registration, hybrid-cache wrappers, MTP configuration conversion, or documentation changes from the source PR.
    Related PR: vllm-project/vllm#50734

Does this PR introduce any user-facing change?

Yes.
When the corresponding text-only Qwen3.5 model integration is available, checkpoints using qwen3_5_text or qwen3_5_moe_text no longer incorrectly enter the multimodal RoPE path.
ModelSlim W8A8 checkpoints using these model types can also resolve the existing packed QKV, gate/up projection, GDN projection, and MoE expert mappings.

How was this patch tested?

Added unit coverage for:

  • standard RoPE selection for qwen3_5_moe_text;
  • multimodal RoPE selection when mrope_section exists;
  • ModelSlim packed-module mappings for qwen3_5_text;
  • ModelSlim expert mappings for qwen3_5_moe_text.

git diff --check passed.

Python syntax compilation passed for all four changed files.

Targeted pytest execution was not available in the local environment because pytest is not installed.

Ruff was not available in the local environment, so no Ruff result is claimed.

No real Ascend NPU or checkpoint inference validation was performed for this scoped backport.

vLLM version: current branch dependency

vLLM main: current branch dependency

Backport the ModelSlim packed-module mappings and RoPE selection for text-only Qwen3.5 checkpoints from PR vllm-project#14238, together with focused unit tests.

Signed-off-by: Erkong <Erkong@noreply.gitcode.com>
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 backports essential support for text-only Qwen3.5 checkpoints into the vLLM Ascend integration. By refining the RoPE selection logic and extending ModelSlim configuration mappings, the changes prevent incorrect multimodal path execution for text-only models and enable proper weight resolution for quantized checkpoints.

Highlights

  • RoPE Selection Logic: Updated the Qwen3.5 attention patch to conditionally select the multimodal RoPE path only when 'mrope_section' is present, ensuring text-only checkpoints correctly use the standard RoPE path.
  • ModelSlim Mappings: Added packed-module and expert mappings for 'qwen3_5_text' and 'qwen3_5_moe_text' model types to support ModelSlim W8A8 checkpoints.
  • Unit Testing: Added comprehensive unit tests to verify correct RoPE path selection and validate ModelSlim packed-module mappings for the new model types.
New Features

🧠 You can now enable Memory (public preview) 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.

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 the 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 counterproductive. 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.

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.

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

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.

Code Review

Suggested PR Title:

[Attention][Feature] Support Qwen3.5 text and MoE text models

Suggested PR Summary:

### What this PR does / why we need it?
This PR adds support for Qwen3.5 text and Qwen3.5 MoE text models. It refactors the RoPE selection logic in `AscendQwen3NextAttention` by introducing a helper `_uses_multimodal_rope` to check if the model uses multimodal RoPE (mRoPE) based on the model type and the presence of `mrope_section` in `rotary_emb`. Additionally, it adds packed module mappings for `qwen3_5_text` and `qwen3_5_moe_text` in the ModelSlim quantization configuration.

Feedback:
A review comment suggests improving the robustness of `_uses_multimodal_rope` by adding defensive checks for `None` values or missing attributes on `attention`, `config`, and `rotary_emb` to prevent potential `AttributeError` or `TypeError` exceptions.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Tested via new unit tests in `tests/ut/patch/worker/test_patch_qwen3_5_mtp.py` and `tests/ut/quantization/test_modelslim_config.py`.

Comment on lines +59 to +61
def _uses_multimodal_rope(attention: Qwen3NextAttention) -> bool:
"""Return whether a Qwen3.5 attention layer exposes multimodal RoPE."""
return "qwen3_5" in attention.config.model_type and hasattr(attention.rotary_emb, "mrope_section")

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.

high

To ensure robustness and adhere to defensive programming principles, we should guard against cases where attention, attention.config, or attention.rotary_emb might be None or missing their expected attributes. This prevents potential AttributeError or TypeError exceptions during runtime or when testing with partial mock objects.

def _uses_multimodal_rope(attention: Qwen3NextAttention) -> bool:
    """Return whether a Qwen3.5 attention layer exposes multimodal RoPE."""
    config = getattr(attention, "config", None)
    if config is None:
        return False
    model_type = getattr(config, "model_type", "")
    if "qwen3_5" not in model_type:
        return False
    rotary_emb = getattr(attention, "rotary_emb", None)
    return rotary_emb is not None and hasattr(rotary_emb, "mrope_section")
References
  1. Enforce defensive programming by ensuring appropriate null/None checks or other language-idiomatic guards exist before object property accesses.

@Karryking3 Karryking3 changed the title [Model] Support text-only Qwen3.5 checkpoints [Feature][Model] Support text-only Qwen3.5 checkpoints Aug 25, 2026
@Karryking3

Karryking3 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

/rerun
[Bot]: rerun completed.

Rerun (failed jobs only):

  • E2E

@LoganJane LoganJane added the ready-precise run selected e2e test for pr label Aug 25, 2026

@Ronald1995 Ronald1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@weijinqian0
weijinqian0 merged commit 5d09618 into vllm-project:main Aug 25, 2026
57 of 61 checks passed
pisceskkk pushed a commit to pisceskkk/vllm-ascend that referenced this pull request Aug 26, 2026
…14885)

### What this PR does / why we need it?
This PR backports the Qwen3.5 text-only RoPE handling and ModelSlim
packed-module mappings from [vLLM PR
#50734](vllm-project/vllm#50734).
Text-only Qwen3.5-family checkpoints use the model types qwen3_5_text or
qwen3_5_moe_text. Unlike multimodal Qwen3.5 checkpoints, they do not
expose multimodal RoPE fields such as mrope_section.
Before this change, the Ascend Qwen3.5 attention patch selected the
multimodal RoPE path based only on the qwen3_5 model-type prefix. This
could cause text-only checkpoints to access missing multimodal RoPE
attributes. ModelSlim also lacked packed-module mappings for the
text-only dense and MoE model types.
The change:
- selects the multimodal RoPE path only when mrope_section is available;
- keeps text-only Qwen3.5 checkpoints on the standard RoPE path;
- adds ModelSlim packed-module mappings for qwen3_5_text;
- adds ModelSlim packed-module and expert mappings for qwen3_5_moe_text;
- adds focused unit coverage for RoPE selection and ModelSlim mappings.
This is a scoped backport. It does not include the model registration,
hybrid-cache wrappers, MTP configuration conversion, or documentation
changes from the source PR.
Related PR:
[vllm-project/vllm#50734](vllm-project/vllm#50734)

### Does this PR introduce _any_ user-facing change?
Yes.
When the corresponding text-only Qwen3.5 model integration is available,
checkpoints using qwen3_5_text or qwen3_5_moe_text no longer incorrectly
enter the multimodal RoPE path.
ModelSlim W8A8 checkpoints using these model types can also resolve the
existing packed QKV, gate/up projection, GDN projection, and MoE expert
mappings.

### How was this patch tested?
Added unit coverage for:
- standard RoPE selection for qwen3_5_moe_text;
- multimodal RoPE selection when mrope_section exists;
- ModelSlim packed-module mappings for qwen3_5_text;
- ModelSlim expert mappings for qwen3_5_moe_text.

git diff --check passed.

Python syntax compilation passed for all four changed files.

Targeted pytest execution was not available in the local environment
because pytest is not installed.

Ruff was not available in the local environment, so no Ruff result is
claimed.

No real Ascend NPU or checkpoint inference validation was performed for
this scoped backport.

vLLM version: current branch dependency

vLLM main: current branch dependency

- vLLM version: v0.27.1
- vLLM main:
vllm-project/vllm@ba07e4a

Signed-off-by: Erkong <Erkong@noreply.gitcode.com>
Co-authored-by: Erkong <Erkong@noreply.gitcode.com>
Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
frankie-ys pushed a commit to Csrayz/vllm-ascend that referenced this pull request Aug 26, 2026
…14885)

### What this PR does / why we need it?
This PR backports the Qwen3.5 text-only RoPE handling and ModelSlim
packed-module mappings from [vLLM PR
#50734](vllm-project/vllm#50734).
Text-only Qwen3.5-family checkpoints use the model types qwen3_5_text or
qwen3_5_moe_text. Unlike multimodal Qwen3.5 checkpoints, they do not
expose multimodal RoPE fields such as mrope_section.
Before this change, the Ascend Qwen3.5 attention patch selected the
multimodal RoPE path based only on the qwen3_5 model-type prefix. This
could cause text-only checkpoints to access missing multimodal RoPE
attributes. ModelSlim also lacked packed-module mappings for the
text-only dense and MoE model types.
The change:
- selects the multimodal RoPE path only when mrope_section is available;
- keeps text-only Qwen3.5 checkpoints on the standard RoPE path;
- adds ModelSlim packed-module mappings for qwen3_5_text;
- adds ModelSlim packed-module and expert mappings for qwen3_5_moe_text;
- adds focused unit coverage for RoPE selection and ModelSlim mappings.
This is a scoped backport. It does not include the model registration,
hybrid-cache wrappers, MTP configuration conversion, or documentation
changes from the source PR.
Related PR:
[vllm-project/vllm#50734](vllm-project/vllm#50734)

### Does this PR introduce _any_ user-facing change?
Yes.
When the corresponding text-only Qwen3.5 model integration is available,
checkpoints using qwen3_5_text or qwen3_5_moe_text no longer incorrectly
enter the multimodal RoPE path.
ModelSlim W8A8 checkpoints using these model types can also resolve the
existing packed QKV, gate/up projection, GDN projection, and MoE expert
mappings.

### How was this patch tested?
Added unit coverage for:
- standard RoPE selection for qwen3_5_moe_text;
- multimodal RoPE selection when mrope_section exists;
- ModelSlim packed-module mappings for qwen3_5_text;
- ModelSlim expert mappings for qwen3_5_moe_text.

git diff --check passed.

Python syntax compilation passed for all four changed files.

Targeted pytest execution was not available in the local environment
because pytest is not installed.

Ruff was not available in the local environment, so no Ruff result is
claimed.

No real Ascend NPU or checkpoint inference validation was performed for
this scoped backport.

vLLM version: current branch dependency

vLLM main: current branch dependency

- vLLM version: v0.27.1
- vLLM main:
vllm-project/vllm@ba07e4a

Signed-off-by: Erkong <Erkong@noreply.gitcode.com>
Co-authored-by: Erkong <Erkong@noreply.gitcode.com>
Lethobenthos20 pushed a commit to Lethobenthos20/vllm-ascend that referenced this pull request Sep 4, 2026
…14885)

### What this PR does / why we need it?
This PR backports the Qwen3.5 text-only RoPE handling and ModelSlim
packed-module mappings from [vLLM PR
#50734](vllm-project/vllm#50734).
Text-only Qwen3.5-family checkpoints use the model types qwen3_5_text or
qwen3_5_moe_text. Unlike multimodal Qwen3.5 checkpoints, they do not
expose multimodal RoPE fields such as mrope_section.
Before this change, the Ascend Qwen3.5 attention patch selected the
multimodal RoPE path based only on the qwen3_5 model-type prefix. This
could cause text-only checkpoints to access missing multimodal RoPE
attributes. ModelSlim also lacked packed-module mappings for the
text-only dense and MoE model types.
The change:
- selects the multimodal RoPE path only when mrope_section is available;
- keeps text-only Qwen3.5 checkpoints on the standard RoPE path;
- adds ModelSlim packed-module mappings for qwen3_5_text;
- adds ModelSlim packed-module and expert mappings for qwen3_5_moe_text;
- adds focused unit coverage for RoPE selection and ModelSlim mappings.
This is a scoped backport. It does not include the model registration,
hybrid-cache wrappers, MTP configuration conversion, or documentation
changes from the source PR.
Related PR:
[vllm-project/vllm#50734](vllm-project/vllm#50734)

### Does this PR introduce _any_ user-facing change?
Yes.
When the corresponding text-only Qwen3.5 model integration is available,
checkpoints using qwen3_5_text or qwen3_5_moe_text no longer incorrectly
enter the multimodal RoPE path.
ModelSlim W8A8 checkpoints using these model types can also resolve the
existing packed QKV, gate/up projection, GDN projection, and MoE expert
mappings.

### How was this patch tested?
Added unit coverage for:
- standard RoPE selection for qwen3_5_moe_text;
- multimodal RoPE selection when mrope_section exists;
- ModelSlim packed-module mappings for qwen3_5_text;
- ModelSlim expert mappings for qwen3_5_moe_text.

git diff --check passed.

Python syntax compilation passed for all four changed files.

Targeted pytest execution was not available in the local environment
because pytest is not installed.

Ruff was not available in the local environment, so no Ruff result is
claimed.

No real Ascend NPU or checkpoint inference validation was performed for
this scoped backport.

vLLM version: current branch dependency

vLLM main: current branch dependency

- vLLM version: v0.27.1
- vLLM main:
vllm-project/vllm@ba07e4a

Signed-off-by: Erkong <Erkong@noreply.gitcode.com>
Co-authored-by: Erkong <Erkong@noreply.gitcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants