Skip to content

Commit 78ec6b0

Browse files
committed
fix a bug
1 parent a19f02d commit 78ec6b0

File tree

1 file changed

+2
-2
lines changed
  • native_sparse_attention_pytorch

1 file changed

+2
-2
lines changed

native_sparse_attention_pytorch/nsa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def __init__(
102102
dim = dim_head,
103103
window_size = sliding_window_size,
104104
causal = True,
105-
exact_windowsize = True
105+
exact_windowsize = True,
106+
autopad = True
106107
)
107108

108109
# compress strategy
@@ -220,7 +221,6 @@ def forward(
220221
remainder = fine_divisible_seq_len - seq_len
221222
fk = pad_at_dim(fk, (0, remainder), value = 0., dim = -2)
222223
fv = pad_at_dim(fv, (0, remainder), value = 0., dim = -2)
223-
fmask = F.pad(fmask, (0, remainder), value = False)
224224

225225
fk = rearrange(fk, 'b h (w n) d -> b h w n d', w = num_fine_blocks)
226226
fv = rearrange(fv, 'b h (w n) d -> b h w n d', w = num_fine_blocks)

0 commit comments

Comments
 (0)