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: masking in token shifting #208

Open
pfeatherstone opened this issue Nov 24, 2023 · 1 comment
Open

Question: masking in token shifting #208

pfeatherstone opened this issue Nov 24, 2023 · 1 comment

Comments

@pfeatherstone
Copy link
Contributor

In token shifting, you explicitly zero out masked items:

if exists(mask):
t = t.masked_fill(~mask[..., None], 0.)

Is this strictly necessary? Since we are shifting right, the shifted tokens should be valid right?
Or is this accounting for items masked on the left? In which case you might be shifting and adding with an invalid token?

I noticed that RecurrentMemoryTransformer didn't do this:

https://github.com/lucidrains/recurrent-memory-transformer-pytorch/blob/d45ef72a40324c6224ffacb890d5593a69db73de/recurrent_memory_transformer_pytorch/recurrent_memory_transformer.py#L65-L70

Hence why I'm asking if it's strictly necessary.

@lucidrains
Copy link
Owner

@pfeatherstone i think i allow for bidirectional shifting, maybe that's why

i can check later

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