From 0c7d017dbbaa7bafd62e78f4920f845637985165 Mon Sep 17 00:00:00 2001 From: Bingxu Chen Date: Fri, 28 Aug 2026 16:11:53 +0800 Subject: [PATCH] [AMD][Fix] Qwen3.5: make empty-batch guard tuple-aware on fused AR+quant path (#35341) --- python/sglang/srt/models/qwen3_5.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/models/qwen3_5.py b/python/sglang/srt/models/qwen3_5.py index f5771a957..30fd062df 100644 --- a/python/sglang/srt/models/qwen3_5.py +++ b/python/sglang/srt/models/qwen3_5.py @@ -891,7 +891,9 @@ class Qwen3_5LinearDecoderLayer(nn.Module): ) ) - if not forward_batch.forward_mode.is_idle() and hidden_states.shape[0] > 0: + # fused AR+quant hands down a (fp8, scale) / (bf16, fp8, scale) tuple + hs = hidden_states[0] if isinstance(hidden_states, tuple) else hidden_states + if not forward_batch.forward_mode.is_idle() and hs.shape[0] > 0: hidden_states = self.linear_attn( hidden_states, forward_batch, @@ -1295,7 +1297,9 @@ class Qwen3_5AttentionDecoderLayer(nn.Module): ) ) - if not forward_batch.forward_mode.is_idle() and hidden_states.shape[0] > 0: + # fused AR+quant hands down a (fp8, scale) / (bf16, fp8, scale) tuple + hs = hidden_states[0] if isinstance(hidden_states, tuple) else hidden_states + if not forward_batch.forward_mode.is_idle() and hs.shape[0] > 0: hidden_states = self.self_attention( positions=positions, hidden_states=hidden_states,