Skip to content

[1/N] Harden Transformers modelling backend multi-modal path - #51408

Merged
hmellor merged 3 commits into
vllm-project:mainfrom
hmellor:transformers-mm-harden-1
Aug 7, 2026
Merged

[1/N] Harden Transformers modelling backend multi-modal path#51408
hmellor merged 3 commits into
vllm-project:mainfrom
hmellor:transformers-mm-harden-1

Conversation

@hmellor

@hmellor hmellor commented Aug 7, 2026

Copy link
Copy Markdown
Member

Fixed

  • Text-only prompts crashed multimodal models with KeyError: "Modality 'image' not found". apply() ran _apply_vision whenever the model supported images, not when items were present; the mm_token_type_ids is None guard never fires because HF returns an all-zero tensor. Repro: BAAI/Emu3-Chat-hf + a plain text prompt
  • Token-ID prompts had special tokens added twice on re-tokenisation: Gemma3 [2] became [2, 2], so ID and text prompts disagreed
  • Memory profiling allocated 1 audio placeholder for N audio items. get_dummy_text emitted audio_token * n with no separator, so the run-length scan merged them. Verified: 3 items produced 1 placeholder, now 3
  • Audio and image field configs overwrote each other. Both branches of _get_mm_fields_config mapped every key in hf_inputs, so whichever ran last took ownership. Keys are now attributed to the modality that produced them, derived from each sub-processor's model_input_names
  • Removed a redundant all-True is_embed mask allocated per audio placeholder

Changed

  • Adjacent audio placeholders now raise instead of silently collapsing into one. No HF-generic per-item audio token count exists to split the run with. Stopgap: text_replacement_offsets will fix it properly

Tests

  • Added test_processing_correctness_transformers. The backend was excluded from _test_processing_correctness, so it had no cached-vs-uncached coverage at all. This caught the first two bugs
  • Added adjacent-placeholder, text-only, and modality-partition cases. Both existing multi-item tests put a separator between placeholders, so the merge path was untested

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

@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.

@mergify mergify Bot added the multi-modality Related to multi-modality (#4194) label Aug 7, 2026

@DarkLight1337 DarkLight1337 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.

Let's get this fix in first, though I have a comment

Comment thread vllm/model_executor/models/transformers/multimodal.py Outdated
@AndreasKaratzas

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #82867 for commit fff4dd11aaa1.

hmellor added 2 commits August 7, 2026 16:58
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor
hmellor enabled auto-merge (squash) August 7, 2026 16:05
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 7, 2026
@hmellor
hmellor merged commit 45273b8 into vllm-project:main Aug 7, 2026
92 checks passed
@hmellor
hmellor deleted the transformers-mm-harden-1 branch August 7, 2026 17:30
@github-project-automation github-project-automation Bot moved this from In review to Shipped in Transformers modeling backend Aug 7, 2026
xwu-intel pushed a commit to xwu-intel/vllm that referenced this pull request Aug 13, 2026
…oject#51408)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Wu, Xiaochang <xiaochang.wu@intel.com>
skavulya pushed a commit to skavulya/vllm that referenced this pull request Aug 15, 2026
…oject#51408)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multi-modality Related to multi-modality (#4194) ready ONLY add when PR is ready to merge/full CI is needed

Projects

Development

Successfully merging this pull request may close these issues.

4 participants