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

Allow mask-free usage #1

Merged
merged 5 commits into from
May 17, 2023
Merged

Conversation

mranzinger
Copy link

I tried to use your implementation, and ended up having to make a few tweaks in order to get the code to work again when I'm not supplying attn_mask, which should be a valid mode.

Even when I did try to supply attn_mask, I ran into some problems where using += was breaking broadcasting rules (implicit with the attn_mask.unsqueeze(0) call for batch), and also needed the

attn = attn.permute(0, 2, 1, 3).flatten(2)

to get the attn tensor into the expected format.

@usryokousha
Copy link
Owner

That looks about right! Sorry I should have included a unit test!

@usryokousha usryokousha merged commit dd69dcb into usryokousha:efficient May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants