fix fused_set_kv_buffer for rope with Ling-v2 (#20316)
This commit is contained in:
@@ -532,6 +532,10 @@ class BailingMoEAttention(nn.Module):
|
||||
head_dim=self.head_dim,
|
||||
alt_stream=self.alt_stream,
|
||||
)
|
||||
can_fuse_set_kv = (
|
||||
self.head_dim == self.rotary_emb.rotary_dim
|
||||
and enable_fused_set_kv_buffer(forward_batch)
|
||||
)
|
||||
q, k = self.rotary_emb(
|
||||
positions,
|
||||
q,
|
||||
@@ -542,7 +546,7 @@ class BailingMoEAttention(nn.Module):
|
||||
layer=self.attn,
|
||||
forward_batch=forward_batch,
|
||||
)
|
||||
if enable_fused_set_kv_buffer(forward_batch)
|
||||
if can_fuse_set_kv
|
||||
else None
|
||||
),
|
||||
)
|
||||
@@ -551,7 +555,7 @@ class BailingMoEAttention(nn.Module):
|
||||
k,
|
||||
v,
|
||||
forward_batch,
|
||||
save_kv_cache=not enable_fused_set_kv_buffer(forward_batch),
|
||||
save_kv_cache=not can_fuse_set_kv,
|
||||
)
|
||||
attn_output, _ = self.dense(context_layer)
|
||||
return attn_output
|
||||
|
||||
Reference in New Issue
Block a user