@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 5c3bae1a6a
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[Fix] Remove divisibility requirement between num_kv_heads and tp_size in bailing_moe (#26876)

Signed-off-by: vito.yy <vito.yy@antgroup.com>

ant-yy committed Oct 15, 2025 at 16:44 UTC 5c3bae1a6a73aad8c0883a097079448b506fbfcc
1 file changed +1 -2
vllm/model_executor/models/bailing_moe.py
+1 -2
@@ -86,13 +86,12 @@ class BailingAttention(nn.Module):
86 tp_size = get_tensor_model_parallel_world_size()
87
88 assert self.total_num_heads % tp_size == 0
89 - assert self.total_kv_heads % tp_size == 0
89 assert self.total_num_heads >= self.total_kv_heads
90
91 self.num_heads = self.total_num_heads // tp_size
92 self.head_dim = config.head_dim or (self.hidden_size // self.total_num_heads)
93 self.q_size_per_rank = self.head_dim * self.num_heads
95 - self.num_kv_heads = self.total_kv_heads // tp_size
94 + self.num_kv_heads = max(1, self.total_kv_heads // tp_size)
95 self.kv_size_per_rank = self.num_kv_heads * self.head_dim
96 self.scale = self.head_dim**-0.5
97 self.use_qk_norm = getattr(config, "use_qk_norm", False)