Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more general mask support #5

Open
GallagherCommaJack opened this issue Sep 20, 2022 · 1 comment
Open

more general mask support #5

GallagherCommaJack opened this issue Sep 20, 2022 · 1 comment

Comments

@GallagherCommaJack
Copy link

the general case of attention is (using annotations from jaxtyping)

q: Float["lq d"]
k: Float["lkv d"]
v: Float["lkv o"]
mask: Bool["lq lkv"]

returns: Float["lq o"]

but it looks like right now this library only supports a 1 dimensional mask?

@lucidrains
Copy link
Owner

@GallagherCommaJack at the moment, it only supports key masking

generalized 2d masking would defeat the purpose of flash attention, as you incur the quadratic cost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants