[Bugfix][Models] Fix OpenPangu sleep mode with static sinks (#53696)
Signed-off-by: Ronald1995 <ronaldautomobile@163.com>
This commit is contained in:
@@ -152,8 +152,6 @@ class StaticSinkAttention(Attention, CustomOp):
|
|||||||
attn_backend=attn_backend,
|
attn_backend=attn_backend,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
CustomOp.__init__(self)
|
|
||||||
|
|
||||||
self.sink_len = sink_len
|
self.sink_len = sink_len
|
||||||
self.sink_populated = False
|
self.sink_populated = False
|
||||||
self.sink_key = None
|
self.sink_key = None
|
||||||
|
|||||||
@@ -677,14 +677,18 @@ class OpenPanguSinkAttention(nn.Module):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.param_sink_value = torch.zeros(
|
self.register_buffer(
|
||||||
(
|
"param_sink_value",
|
||||||
self.param_sink_number,
|
torch.zeros(
|
||||||
self.num_kv_heads,
|
(
|
||||||
self.v_channels,
|
self.param_sink_number,
|
||||||
|
self.num_kv_heads,
|
||||||
|
self.v_channels,
|
||||||
|
),
|
||||||
|
device=current_platform.current_device(),
|
||||||
|
dtype=config.torch_dtype,
|
||||||
),
|
),
|
||||||
device=current_platform.current_device(),
|
persistent=False,
|
||||||
dtype=config.torch_dtype,
|
|
||||||
)
|
)
|
||||||
# To enable dummy run with out weight
|
# To enable dummy run with out weight
|
||||||
self.post_weight_load()
|
self.post_weight_load()
|
||||||
|
|||||||
Reference in New Issue
Block a user