From 6bb8753db1076f498c240fffdd88b1ab983b7f40 Mon Sep 17 00:00:00 2001 From: Weida Hong Date: Fri, 22 May 2026 15:21:35 +0800 Subject: [PATCH] Correcting the mock classes for MM GC tests (#43321) Signed-off-by: Weida Hong --- tests/v1/cudagraph/test_encoder_cudagraph.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/v1/cudagraph/test_encoder_cudagraph.py b/tests/v1/cudagraph/test_encoder_cudagraph.py index a4d7b68544..c67b5ec39b 100644 --- a/tests/v1/cudagraph/test_encoder_cudagraph.py +++ b/tests/v1/cudagraph/test_encoder_cudagraph.py @@ -17,6 +17,7 @@ from typing import Any import pytest import torch +from vllm.model_executor.models.interfaces import SupportsEncoderCudaGraph from vllm.platforms import current_platform from vllm.v1.worker.encoder_cudagraph import ( EncoderCudaGraphManager, @@ -75,7 +76,7 @@ class _MockVllmConfig: self.parallel_config = _MockParallelConfig() -class _MockModel: +class _MockModel(SupportsEncoderCudaGraph): """Minimal mock implementing SupportsEncoderCudaGraph for __init__.""" def __init__(self, min_budget: int = 4, max_budget: int = 128): @@ -250,7 +251,7 @@ def _count_output_tokens( return sum(t * (h // m) * (w // m) for t, h, w in grid_thw_list) -class SimpleMockViTModel(torch.nn.Module): +class SimpleMockViTModel(torch.nn.Module, SupportsEncoderCudaGraph): """Minimal ViT model for CUDA graph tests. Implements the SupportsEncoderCudaGraph protocol by providing @@ -258,8 +259,6 @@ class SimpleMockViTModel(torch.nn.Module): simulates spatial merge by averaging groups of m^2 patches. """ - supports_encoder_cudagraph = True - def __init__(self): super().__init__() self.proj = torch.nn.Linear(_FLAT, _HIDDEN)