Skip to content

[2/N] Harden Transformers modelling backend multi-modal path - #51657

Merged
DarkLight1337 merged 8 commits into
vllm-project:mainfrom
hmellor:transformers-mm-harden-2
Aug 10, 2026
Merged

[2/N] Harden Transformers modelling backend multi-modal path#51657
DarkLight1337 merged 8 commits into
vllm-project:mainfrom
hmellor:transformers-mm-harden-2

Conversation

@hmellor

@hmellor hmellor commented Aug 10, 2026

Copy link
Copy Markdown
Member

Continues from #51408

Added

  • --mm-encoder-only and --limit-mm-per-prompt <modality>=0 now skip weights for this backend, via a _mark_model_components hook around AutoModel.from_config
  • Audio encoders can be torch compiled; compile_mm_encoder was hardcoded to the image encoder

Fixed

  • _get_prompt_updates returned None against a declared Sequence[PromptUpdate]
  • The overridden apply() skipped the placeholder/item count validation the base class performs
  • _split_embeddings silently padded or truncated encoder output to fit; it now warns

Changed

  • _embed_audio/_embed_vision -> _process_audio_input/_process_image_input; embed_multimodal returns []
  • get_max_image_size -> get_image_size_with_most_features returning ImageSize
  • Modality detection deduplicated into _get_supported_modalities; dead _is_video_model removed
  • Decoder and encoder lookups share one throwaway meta model instead of one each: 3 builds -> 1 per load

Notes

  • HF's get_decoder/get_encoder are best-effort hasattr probes over a constructed model, with no class-level equivalent — hence the throwaway meta model
  • They report the same class for image and video, so marking and compile decoration both dedupe by class. Otherwise image=0 could skip a tower video needs, and support_torch_compile would apply twice
  • Supported modalities must be intersected before marking: get_limit_per_prompt returns 999 for unspecified ones, so all(limit == 0) would never hold
  • Emu3 and granite-speech degrade to unmarked; HF can't distinguish their encoder from the model

Tests

  • Added test_tower_weights_skipped_when_modality_disabled — nothing in the repo asserted weight skipping for any model
  • Added test_marking_skipped_without_tokenizer

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
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.

@hmellor hmellor changed the title [2/N] Harden Transformers modelling backend multi-modal path - #51408 [2/N] Harden Transformers modelling backend multi-modal path Aug 10, 2026
@DarkLight1337

Copy link
Copy Markdown
Member

/ci run

@DarkLight1337
DarkLight1337 enabled auto-merge (squash) August 10, 2026 11:29
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 10, 2026
@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #83134 for commit 7b6380fa80e3.

@DarkLight1337
DarkLight1337 merged commit cf8f3a3 into vllm-project:main Aug 10, 2026
95 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Shipped in Transformers modeling backend Aug 10, 2026
@hmellor
hmellor deleted the transformers-mm-harden-2 branch August 10, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

Development

Successfully merging this pull request may close these issues.

2 participants