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

q,k,v have different shape but torch.stack works? #202

Open
junsukha opened this issue Aug 8, 2023 · 0 comments
Open

q,k,v have different shape but torch.stack works? #202

junsukha opened this issue Aug 8, 2023 · 0 comments

Comments

@junsukha
Copy link

junsukha commented Aug 8, 2023

In labml_nn/diffusion/stable_diffusion/model/unet_attention.py,
def flash_attention(self, q: torch.Tensor, k: torch.Tensor, v: torch.Tensor): has torch.stack((q,k,v), dim=2) where, I believe, q is of different shape from k and v.

How does torch.stack work then?

When I run text_to_image.py,
q, k, v are of shape ([8, 1024, 640]), ([8, 77, 640]), ([8, 77, 640]) respectively.

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