From 292187dd8ca1b1bfa195f25b2886262527269999 Mon Sep 17 00:00:00 2001 From: Lucas Wilkinson Date: Sun, 16 Aug 2026 23:01:13 -0400 Subject: [PATCH] [Bugfix][DSv4] Keep indexer scoring in breakable graphs (#52492) Signed-off-by: Lucas Wilkinson Co-authored-by: OpenAI Codex Co-authored-by: Yongye Zhu --- vllm/models/deepseek_v4/attention.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vllm/models/deepseek_v4/attention.py b/vllm/models/deepseek_v4/attention.py index ff7b92c6b2..128debf70c 100644 --- a/vllm/models/deepseek_v4/attention.py +++ b/vllm/models/deepseek_v4/attention.py @@ -906,7 +906,10 @@ class DeepseekV4Indexer(nn.Module): attn_metadata = get_forward_context().attn_metadata if isinstance(attn_metadata, dict): indexer_metadata = cast(Any, attn_metadata[self.k_cache.prefix]) - if indexer_metadata.max_seq_len // self.compress_ratio <= self.topk_tokens: + if ( + indexer_metadata.max_seq_len // self.compress_ratio <= self.topk_tokens + and not torch.cuda.is_current_stream_capturing() + ): # candidates num smaller than topk, every candidate is selected # but we still need to build k cache compressor(compressed_kv_score, positions, rotary_emb)