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

Attention masking bug? #12

Closed
rayleizhu opened this issue Jun 8, 2023 · 1 comment
Closed

Attention masking bug? #12

rayleizhu opened this issue Jun 8, 2023 · 1 comment

Comments

@rayleizhu
Copy link

It seems that your attention masking part is wrong, as the image patches from different images should have a different mask, while you use a single mask definition for all patches regardless of where they are from.

if attn_mask is not None:

BTW, how do you cope with mixing more images? I see only mixing 2 images case in the code.

@rayleizhu
Copy link
Author

I've figured out why: complementary masking is implemented in WindowAttention:

mask_new = mask * mask.transpose(2, 3) + (1 - mask) * (1 - mask).transpose(2, 3)

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

1 participant