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 Issue for DiT-like model #84

Open
kliyer-ai opened this issue Dec 10, 2024 · 0 comments
Open

Attention Issue for DiT-like model #84

kliyer-ai opened this issue Dec 10, 2024 · 0 comments

Comments

@kliyer-ai
Copy link

Hey, thanks for this great work.

I'm currently trying to integrate the unit-scaling library in my DiT-like codebase. Unfortunately, the training is not really working, i.e. it is training extremely slowly if at all. I looked at the standard deviation of all the intermediate activation and I think I have localized the issue to the attention operation.

The code is looking like this:

x, skip = self.residual_split(x)
x = self.norm(x)
qkv = self.qkv_proj(x)
q, k, v = rearrange(qkv, "n l (t nh e) -> t n nh l e", t=3, e=self.d_head)
print(q.std(), k.std(), v.std())
x = U.scaled_dot_product_attention(q, k, v)  
print(x.std())

When I look at the std of the q, k and v activation, I get a value very close to 1, which is what I am expecting. However, when I look at the std of the attention output, I often get values larger than 10. Any idea why this could be? Thanks!

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