From 2e87c2bd5e43bfad57150ff878761bc6cffc0ab8 Mon Sep 17 00:00:00 2001 From: Zack Yu Date: Wed, 4 Feb 2026 13:18:02 -0800 Subject: [PATCH] fix: fix MockModelRunner in attention tests (#18240) --- python/sglang/test/attention/test_flashattn_backend.py | 10 +++++++--- .../test/attention/test_flashattn_mla_backend.py | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/python/sglang/test/attention/test_flashattn_backend.py b/python/sglang/test/attention/test_flashattn_backend.py index a134d18a7..560b34837 100644 --- a/python/sglang/test/attention/test_flashattn_backend.py +++ b/python/sglang/test/attention/test_flashattn_backend.py @@ -24,6 +24,9 @@ class MockModelRunner: ): self.device = "cuda" self.dtype = torch.float16 + self.kv_cache_dtype = torch.float16 + self.is_hybrid_swa = False + self.attention_chunk_size = None attention_arch = AttentionArch.MHA # Max batch size for the test. max_batch_size = 160 @@ -36,10 +39,11 @@ class MockModelRunner: "context_len": max_context_len, "is_multimodal": False, "attention_arch": attention_arch, + "is_encoder_decoder": False, + "is_local_attention_model": False, }, - ) + )() self.sliding_window_size = None - self.device = self.device # Create a large enough req_to_token_pool to fit the test usage. self.req_to_token_pool = type( "TokenPool", @@ -55,7 +59,7 @@ class MockModelRunner: device=self.device, ), }, - ) + )() self.page_size = page_size max_total_num_tokens = max_batch_size * max_context_len self.token_to_kv_pool = MHATokenToKVPool( diff --git a/python/sglang/test/attention/test_flashattn_mla_backend.py b/python/sglang/test/attention/test_flashattn_mla_backend.py index c2971aee4..98eaa5913 100644 --- a/python/sglang/test/attention/test_flashattn_mla_backend.py +++ b/python/sglang/test/attention/test_flashattn_mla_backend.py @@ -28,6 +28,8 @@ class MockModelRunner: { "context_len": context_len, "attention_arch": attention_arch, + "is_encoder_decoder": False, + "is_local_attention_model": False, }, ) self.sliding_window_size = None