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

Fix sliding window mask size in one_file_ref.py #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MrYxJ
Copy link

@MrYxJ MrYxJ commented Mar 18, 2024

Fixed a minor encoding error in the mask matrix size in one_file_ref.py where the original mask would display one more column than expected size.

fix sliding window mask size bug
@MrYxJ
Copy link
Author

MrYxJ commented Mar 18, 2024

tensor = torch.ones((5, 5))
sliding_window = 3

mask = torch.tril(tensor, diagonal=0)
# make the mask banded to account for sliding window
# mask = torch.triu(mask, diagonal=-sliding_window)  # actually produces a large column of slide window size
mask = torch.triu(mask, diagonal=-sliding_window+1)  
mask = torch.log(mask)
mask
tensor([[0., -inf, -inf, -inf, -inf],
        [0., 0., -inf, -inf, -inf],
        [0., 0., 0., -inf, -inf],
        [-inf, 0., 0., 0., -inf],
        [-inf, -inf, 0., 0., 0.]])

@MrYxJ MrYxJ changed the title Update one_file_ref.py Fix sliding window mask size in one_file_ref.py Mar 18, 2024
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

Successfully merging this pull request may close these issues.

None yet

1 participant