Skip to content

[Core][Model] Unify XD-RoPE into M-RoPE and derive the channel count - #56078

Merged
vllm-bot merged 2 commits into
vllm-project:mainfrom
hmellor:unify-multimodal-rope
Sep 9, 2026
Merged

vllm-bot merged 2 commits into
vllm-project:mainfrom
hmellor:unify-multimodal-rope

Conversation

@hmellor

@hmellor hmellor commented Sep 9, 2026

Copy link
Copy Markdown
Member

XD-RoPE was added for the native HunYuan-VL implementation, which has since moved to the Transformers modeling backend. Nothing implements SupportsXDRoPE any more, so uses_xdrope_dim can only return 0 and every XD-RoPE branch is unreachable; a config that did trip the detection would fail the supports_xdrope assertion rather than run.

Transformers has collapsed the distinction upstream too: it renames xdrope_section to mrope_section and validates position ids against len(mrope_section). The two vLLM paths only ever differed in whether decode adds a position delta, and M-RoPE with a model-supplied delta subsumes XD-RoPE, whose delta is structurally zero.

Fold XD-RoPE into the M-RoPE path, keep xdrope_section as a legacy alias so no config loses support, and size the position buffers from the model's section count instead of a hardcoded 3.

That count fixes HunyuanOCR (#55140), whose four M-RoPE sections crashed profile_run against the 3-channel buffer. Also pass get_rope_index only the grid arguments its signature accepts: HunYuanVLModel takes no video_grid_thw and has no **kwargs.

Supersedes #55436.

XD-RoPE was added for the native HunYuan-VL implementation, which has
since moved to the Transformers modeling backend. Nothing implements
`SupportsXDRoPE` any more, so `uses_xdrope_dim` can only return 0 and
every XD-RoPE branch is unreachable; a config that did trip the
detection would fail the `supports_xdrope` assertion rather than run.

Transformers has collapsed the distinction upstream too: it renames
`xdrope_section` to `mrope_section` and validates position ids against
`len(mrope_section)`. The two vLLM paths only ever differed in whether
decode adds a position delta, and M-RoPE with a model-supplied delta
subsumes XD-RoPE, whose delta is structurally zero.

Fold XD-RoPE into the M-RoPE path, keep `xdrope_section` as a legacy
alias so no config loses support, and size the position buffers from
the model's section count instead of a hardcoded 3.

That count fixes HunyuanOCR (vllm-project#55140), whose four M-RoPE sections
crashed `profile_run` against the 3-channel buffer. Also pass
`get_rope_index` only the grid arguments its signature accepts:
`HunYuanVLModel` takes no `video_grid_thw` and has no `**kwargs`.

Supersedes vllm-project#55436.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V52AokcYhV51yU6QTD62i2
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor
hmellor force-pushed the unify-multimodal-rope branch from 8fac598 to f26841b Compare September 9, 2026 13:09
@hmellor

hmellor commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

/ci run

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@hmellor
hmellor requested a review from tlrmchlsmth as a code owner September 9, 2026 13:12
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87917 for commit f26841b53656.

Comment thread vllm/v1/worker/gpu_model_runner.py
@Isotr0py Isotr0py self-assigned this Sep 9, 2026
`XDRotaryEmbedding` came with the native HunyuanOCR implementation and had
only ever one consumer, which moved to the Transformers modeling backend
in vllm-project#53615. That backend builds its rotary embedding in HF modeling code,
so `get_rope` is never reached for these models.

The `xdrope` branch is unreachable even in principle now: HunYuanVL's
config class rewrites `rope_type` from `xdrope` to `dynamic` and renames
`xdrope_section` to `mrope_section` in `convert_rope_params_to_dict`,
which runs on every `from_pretrained`, so `tencent/HunyuanOCR` loads as a
4-section dynamic-alpha config.

Keep the `xdrope_section` alias in `_mrope_section` for configs loaded
outside that class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFmmDwBKjFxBKkVSYyrWQW
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

@Isotr0py Isotr0py left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the cleanup!

@hmellor

hmellor commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

/ci run

@hmellor
hmellor enabled auto-merge (squash) September 9, 2026 15:03
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87940 for commit 867a1e3a4ed3.

@vllm-bot
vllm-bot merged commit 719284f into vllm-project:main Sep 9, 2026
173 of 179 checks passed
@hmellor
hmellor deleted the unify-multimodal-rope branch September 9, 2026 16:24
ItsRoy69 pushed a commit to ItsRoy69/vllm that referenced this pull request Sep 10, 2026
…llm-project#56078)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jyotirmoy Roy <jyotirmoyroy649@gmail.com>
MrlixiangWE added a commit to MrlixiangWE/vllm-omni that referenced this pull request Sep 17, 2026
vLLM 719284f (vllm-project/vllm#56078) unified XD-RoPE into M-RoPE and removed
`uses_xdrope_dim` from the model runner, so on a vLLM containing that commit the
Omni runners raise AttributeError where they read it.

vllm-project#6923 guarded four of the six read sites with getattr. Put the default in
`OmniGPUModelRunner.__init__` instead and read the flag plainly everywhere: one
enforcement point, and it reaches the two NPU runners that inherit this
constructor, which the guards did not cover. The pinned version's value is
preserved.

The test constructs both GPU runners through the real parent constructor and the
installed vLLM's config classes, admits a request through `_update_states`, and
checks the position buffers and `_preprocess` output for plain, image and cached
input. One case deletes the attribute after the parent constructor runs, so the
pinned version also covers what the removal does.

Signed-off-by: MrlixiangWE <mrdanaer@gmail.com>
Co-authored-by: zijianc2 <157244773+zijianc2@users.noreply.github.com>
MrlixiangWE added a commit to MrlixiangWE/vllm-omni that referenced this pull request Sep 17, 2026
vLLM 719284f (vllm-project/vllm#56078) unified XD-RoPE into M-RoPE and removed
`uses_xdrope_dim` from the model runner, so on a vLLM containing that commit the
Omni runners raise AttributeError where they read it.

vllm-project#6923 guarded four of the six read sites with getattr. Put the default in
`OmniGPUModelRunner.__init__` instead and read the flag plainly everywhere: one
enforcement point, and it reaches the two NPU runners that inherit this
constructor, which the guards did not cover. The pinned version's value is
preserved.

The test constructs both GPU runners through the real parent constructor and the
installed vLLM's config classes, admits a request through `_update_states`, and
checks the position buffers and `_preprocess` output for plain, image and cached
input. One case deletes the attribute after the parent constructor runs, so the
pinned version also covers what the removal does.

Signed-off-by: MrlixiangWE <mrdanaer@gmail.com>
Co-authored-by: zijianc2 <157244773+zijianc2@users.noreply.github.com>
MrlixiangWE added a commit to MrlixiangWE/vllm-omni that referenced this pull request Sep 17, 2026
vLLM 719284f (vllm-project/vllm#56078) unified XD-RoPE into M-RoPE and removed
`uses_xdrope_dim` from the model runner, so on a vLLM containing that commit the
Omni runners raise AttributeError where they read it.

vllm-project#6923 guarded four of the six read sites with getattr. Put the default in
`OmniGPUModelRunner.__init__` instead and read the flag plainly everywhere: one
enforcement point, and it reaches the two NPU runners that inherit this
constructor, which the guards did not cover. The pinned version's value is
preserved.

The test constructs both GPU runners through the real parent constructor and the
installed vLLM's config classes, admits a request through `_update_states`, and
checks the position buffers and `_preprocess` output for plain, image and cached
input. One case deletes the attribute after the parent constructor runs, so the
pinned version also covers what the removal does.

Signed-off-by: MrlixiangWE <mrdanaer@gmail.com>
Co-authored-by: zijianc2 <157244773+zijianc2@users.noreply.github.com>
MrlixiangWE added a commit to MrlixiangWE/vllm-omni that referenced this pull request Sep 18, 2026
vLLM 719284f (vllm-project/vllm#56078) unified XD-RoPE into M-RoPE and removed
`uses_xdrope_dim` from the model runner, so on a vLLM containing that commit the
Omni runners raise AttributeError where they read it.

Read the flag with a default in `OmniGPUModelRunner.__init__`. vllm-project#6923 guards four
of the six read sites for runners built with `object.__new__`, which this repo
does in tests; those guards stay, and this default is what covers the paths they
do not, including the two NPU runners that inherit this constructor. The pinned
version's value is preserved, and a vLLM that never sets the flag says so once
in the log rather than silently serving 1-D positions.

The test constructs both GPU runners through the real parent constructor and the
installed vLLM's config classes, admits a request through `_update_states`, and
checks the position buffers and `_preprocess` output. One case drops the
attribute after the parent constructor returns, so the pinned version also
covers what the removal does.

Signed-off-by: MrlixiangWE <mrdanaer@gmail.com>
Co-authored-by: zijianc2 <157244773+zijianc2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrv2 Model Runner V2 specific multi-modality Related to multi-modality (#4194) ready ONLY add when PR is ready to merge/full CI is needed scheduler speculative-decoding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] HunyuanOCR (Transformers backend) crashes on startup: "Expected 4 multimodal RoPE channels, got position_ids with shape (3, 1, N)"

3 participants