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

Could this lead to a bug due to dimension mismatch? #32

Open
sonrisa07 opened this issue Dec 2, 2024 · 0 comments
Open

Could this lead to a bug due to dimension mismatch? #32

sonrisa07 opened this issue Dec 2, 2024 · 0 comments

Comments

@sonrisa07
Copy link

https://github.com/hyunwoongko/transformer/blob/0e5ce57589d7307cf76b53241cc523841ff67655/models/layers/scale_dot_product_attention.py#L35C5-L35C57

The dimensions of q, k, v entering the ScaledDotProductAttention module are [batch, head, seq_len, d_model], which results in the score dimension being [batch, head, seq_len, seq_len]. However, the mask does not have the head dimension and is only [batch, seq_len, seq_len]. Could this dimension mismatch in the referenced code cause an error?

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