Skip to content

Commit 90457e8

Browse files
authored
Adjust kv_cache_size calculation based on local_attn_size (#1008)
1 parent 68aa773 commit 90457e8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lightx2v/models/networks/wan/infer/lingbot_fast/transformer_infer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ def _initialize_kv_cache(self, dtype, device):
5252
return
5353
kv_cache1 = []
5454
ws = self._sp_world_size()
55-
self.kv_cache_size = self._kv_size // ws
55+
if self.local_attn_size != -1:
56+
kv_cache_size = self.local_attn_size * self.frame_seq_length // ws
57+
else:
58+
kv_cache_size = self._kv_size // ws
59+
self.kv_cache_size = kv_cache_size
5660

5761
n, d = self.num_heads, self.head_dim
5862
if self.kv_quant_config is not None:

0 commit comments

Comments
 (0)