[Bugfix][Pooling] Handle multimodal cache misses without crashing (#58975)

Signed-off-by: linchaoying6 <linchaoying6@jd.com>
Co-authored-by: linchaoying6 <linchaoying6@jd.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Chaoying
2026-10-02 10:14:33 -04:00
committed by GitHub
co-authored by linchaoying6 OpenAI Codex
parent 443dccd3c9
commit 592c6f3fbc
21 changed files with 525 additions and 17 deletions
+34
View File
@@ -2,11 +2,13 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import random
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, call
import pytest
from vllm import LLM
from vllm.sampling_params import SamplingParams, StructuredOutputsParams
from vllm.v1.engine.llm_engine import LLMEngine
from vllm.v1.metrics.reader import Counter, Gauge, Histogram, Metric, Vector
if TYPE_CHECKING:
@@ -18,6 +20,38 @@ MODEL = "facebook/opt-125m"
DTYPE = "half"
@pytest.mark.skip_global_cleanup
def test_step_invalidates_mm_processor_cache_misses():
engine = object.__new__(LLMEngine)
engine.should_execute_dummy_batch = False
engine.log_stats = False
engine.logger_manager = None
mm_processor_cache = MagicMock()
engine.renderer = MagicMock(mm_processor_cache=mm_processor_cache)
engine_core_output = MagicMock(
mm_cache_miss_hashes=["missing-hash-1", "missing-hash-2"]
)
outputs = MagicMock(
outputs=[engine_core_output],
timestamp=0.0,
scheduler_stats=None,
)
engine.engine_core = MagicMock()
engine.engine_core.get_output.return_value = outputs
processed_outputs = MagicMock(reqs_to_abort=[], request_outputs=[])
engine.output_processor = MagicMock()
engine.output_processor.process_outputs.return_value = processed_outputs
assert engine.step() == []
assert mm_processor_cache.invalidate.call_args_list == [
call("missing-hash-1"),
call("missing-hash-2"),
]
def _vllm_model(
apc: bool,
vllm_runner: type[VllmRunner],