@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2fd0e52252
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 2, 06:00 UTC

[Bugfix] Fix Gemma4 startup crash with recent transformers multimodal processor (#44232)

Signed-off-by: Luciano Martins <lucianommartins@users.noreply.github.com> Co-authored-by: Luciano Martins <lucianommartins@users.noreply.github.com>

Luciano Martins committed Jun 2, 2026 at 10:42 UTC 2fd0e52252f3bf459c9504d850ec2fc74f0ceee3
1 file changed +19
vllm/model_executor/models/gemma4_mm.py
+19
@@ -519,6 +519,25 @@ class Gemma4DummyInputsBuilder(BaseDummyInputsBuilder[Gemma4ProcessingInfo]):
519
520
521 class Gemma4MultiModalProcessor(BaseMultiModalProcessor[Gemma4ProcessingInfo]):
522 + def _apply_hf_processor_text_only(
523 + self,
524 + prompt_text: str,
525 + tokenization_kwargs: Mapping[str, object],
526 + ) -> list[int]:
527 + # Bypass the HF processor and tokenize directly. The HF
528 + # processor expands multimodal placeholders (<|video|>, etc.)
529 + # via get_text_with_replacements, which raises StopIteration
530 + # when the prompt contains placeholders without matching data.
531 + # The text-only path only needs token IDs, so the tokenizer
532 + # alone is sufficient.
533 + processor = self.info.get_hf_processor()
534 + text_inputs = processor.tokenizer([prompt_text], **tokenization_kwargs)
535 + input_ids = text_inputs["input_ids"]
536 + if not isinstance(input_ids, list):
537 + input_ids = input_ids.tolist()
538 + (prompt_ids,) = input_ids
539 + return prompt_ids
540 +
541 def _call_hf_processor(
542 self,
543 prompt: str,