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

Question about masking #89

Open
Microbiods opened this issue Jul 21, 2022 · 2 comments
Open

Question about masking #89

Microbiods opened this issue Jul 21, 2022 · 2 comments

Comments

@Microbiods
Copy link

Hi, thanks for the wonderful repo, I am new in BERT, so I 'd like to make sure in your example:

model = PerformerLM()
x = torch.randint(0, 20000, (1, 2048))
mask = torch.ones_like(x).bool()
model(x, mask = mask) # (1, 2048, 20000)

is this 'mask' is attention_mask? i.e., TRUE (1) for normal tokens and FALSE (0) for padding tokens? Or set 1 to indicate padding token?
Thanks a lot!

@BomanNg
Copy link

BomanNg commented Nov 10, 2022

@Microbiods this attention mask is just the same as the attention mask of BERT. FALSE for padding tokens

@jdefriel
Copy link

jdefriel commented Feb 7, 2023

Another question on masking: in normal transformer the mask is implemented after QK^T and before softmax but since we do KV first when is the mask implemented? After full attention is calculated?

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

3 participants