From 3e158ae62d1c227004fa9f702a51126e58ebbcb2 Mon Sep 17 00:00:00 2001 From: Nick Hill Date: Thu, 2 Jul 2026 15:05:16 +0100 Subject: [PATCH] [ModelRunner V2] Fix Mamba2 crash on non-spec-decode (#47428) Signed-off-by: Nick Hill --- vllm/v1/worker/gpu/model_states/mamba_hybrid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vllm/v1/worker/gpu/model_states/mamba_hybrid.py b/vllm/v1/worker/gpu/model_states/mamba_hybrid.py index c6a0632c2d..cf6ab0ac06 100644 --- a/vllm/v1/worker/gpu/model_states/mamba_hybrid.py +++ b/vllm/v1/worker/gpu/model_states/mamba_hybrid.py @@ -246,7 +246,7 @@ class MambaHybridModelState(DefaultModelState): # compute them during actual (non-capture) forward execution. num_accepted_tokens = None num_decode_draft_tokens_cpu = None - if not for_capture: + if not for_capture and self.vllm_config.num_speculative_tokens > 0: num_accepted_tokens = self.num_accepted_tokens_gpu.new_ones(num_reqs) num_accepted_tokens[: input_batch.num_reqs] = self.num_accepted_tokens_gpu[ input_batch.idx_mapping