From fa0219fbf80c7d8a187cc4957fe849a4c93a7164 Mon Sep 17 00:00:00 2001 From: Chranos <826995883@qq.com> Date: Tue, 10 Feb 2026 18:22:13 +0800 Subject: [PATCH] add qwen3_moe --- vllm-v0.6.2/vllm/model_executor/models/qwen3_moe.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vllm-v0.6.2/vllm/model_executor/models/qwen3_moe.py b/vllm-v0.6.2/vllm/model_executor/models/qwen3_moe.py index 26415a8..8e95c52 100644 --- a/vllm-v0.6.2/vllm/model_executor/models/qwen3_moe.py +++ b/vllm-v0.6.2/vllm/model_executor/models/qwen3_moe.py @@ -258,11 +258,13 @@ class Qwen3MoeAttention(nn.Module): k_by_head = self.k_norm(k_by_head) k = k_by_head.reshape(k_shape) - # MLU's forward_mlu signature is (positions, x, offsets=None), - # so we must call separately for q and k to avoid k being - # treated as offsets. - q = self.rotary_emb(positions, q) - k = self.rotary_emb(positions, k) + # MLU rotary_emb expects a single concatenated 3D tensor, not + # separate q and k (forward_mlu signature differs from forward_native). + qk = torch.cat([q, k], dim=-1) + self.rotary_emb(positions, + qk.view(-1, self.num_heads + self.num_kv_heads, + self.head_dim)) + q, k = qk.split([self.q_size, self.kv_size], dim=-1) attn_output = self.attn(q, k, v, kv_cache, attn_metadata) output, _ = self.o_proj(attn_output) return output