Skip to content

Commit

Permalink
fix mask for linear attention
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Apr 8, 2022
1 parent 50bb27c commit 8e0d2fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion flash_pytorch/flash_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ def forward(
# mask out linear attention keys

if exists(mask):
lin_k = lin_k.masked_fill(~mask, 0.)
lin_mask = rearrange(mask, '... -> ... 1')
lin_k = lin_k.masked_fill(~lin_mask, 0.)

# rotate queries and keys

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'FLASH-pytorch',
packages = find_packages(exclude=[]),
version = '0.1.1',
version = '0.1.2',
license='MIT',
description = 'FLASH - Transformer Quality in Linear Time - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 8e0d2fd

Please sign in to comment.