[Bugfix][MRV2] Support encoder timing stats in model runner V2 (#50020)

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Guan-Ming Chiu
2026-08-12 00:00:49 +08:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 5426311d91
commit 457a5f34db
7 changed files with 99 additions and 22 deletions
+9 -1
View File
@@ -60,6 +60,7 @@ class ModelState(ABC):
self.supports_mm_inputs = encoder_cache is not None
if encoder_cache is not None:
self.encoder_cache = encoder_cache
observability_config = vllm_config.observability_config
self.encoder_runner = EncoderRunner(
model=self.model,
max_num_tokens=self.max_num_tokens,
@@ -67,6 +68,10 @@ class ModelState(ABC):
encoder_cache=encoder_cache,
dtype=self.dtype,
device=self.device,
enable_timing=bool(
observability_config
and observability_config.enable_mm_processor_stats
),
)
def get_supported_generation_tasks(self) -> tuple[GenerationTask, ...]:
@@ -150,7 +155,10 @@ class ModelState(ABC):
scheduled_encoder_inputs
)
if mm_kwargs:
encoder_outputs = self.encoder_runner.execute_mm_encoder(mm_kwargs)
with self.encoder_runner.timed_encoder_operation(
scheduled_encoder_inputs.keys()
):
encoder_outputs = self.encoder_runner.execute_mm_encoder(mm_kwargs)
self.encoder_cache.encoder_outputs.update(zip(mm_hashes, encoder_outputs))
def gather_mm_embeddings(