[Bugfix][Multimodal] Keep Gemma 4 video frame counts on CPU (#52441)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>

Chauncey committed Aug 16, 2026 at 17:17 UTC 84530eb235dc3d866fa7d4588217f2fb53f43e76
2 files changed +7 -1
tests/models/multimodal/generation/test_vit_cudagraph.py
+6
@@ -286,6 +286,12 @@ MODEL_CONFIGS: dict[str, VitCudagraphTestConfig] = {
286 "<bos><start_of_turn>user\n<|video|>\nDescribe this video in one sentence."
287 "<end_of_turn>\n<start_of_turn>model\n"
288 ),
289 + # The 16-frame test video produces 1056 vision tokens. Capture only
290 + # the smallest supported bucket that covers it instead of all default
291 + # buckets through max_model_len, which adds unrelated memory pressure.
292 + compilation_config_overrides={
293 + "encoder_cudagraph_token_budgets": [1120],
294 + },
295 needs_video_metadata=True,
296 marks=[pytest.mark.core_model],
297 ),
vllm/model_executor/models/gemma4_mm.py
+1 -1
@@ -801,7 +801,7 @@ class Gemma4MultiModalProcessor(BaseMultiModalProcessor[Gemma4ProcessingInfo]):
801 MultiModalFieldConfig.flat_from_sizes("video", vfc)
802 ),
803 video_frame_counts=MultiModalFieldConfig.batched(
804 - "video",
804 + "video", keep_on_cpu=True
805 ),
806 video_num_soft_tokens=MultiModalFieldConfig.batched(
807 "video", keep_on_cpu=True