Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

self conditioning not working (size mismatch) #35

Closed
inspirit opened this issue Sep 11, 2024 · 6 comments
Closed

self conditioning not working (size mismatch) #35

inspirit opened this issue Sep 11, 2024 · 6 comments

Comments

@inspirit
Copy link

When enabling self_cond there is size mismatch when trying to sum embeds:

this happens because 'sum_embeds' tensor is not reduced as it was projected to:

nn.Linear(dim, dim * num_effective_quantizers),
Rearrange('b n (h d) -> b (n h) d', h = num_effective_quantizers)

so 'sum_embeds' is actually 'b (n h) d' while 'x' is 'b n d'

lucidrains added a commit that referenced this issue Sep 11, 2024
@lucidrains
Copy link
Owner

@inspirit ah, thanks for uncovering this

how about 0.4.4?

@inspirit
Copy link
Author

you forgot to put 'sum' argument to 'reduce' call :)

@inspirit
Copy link
Author

ohh, and btw there is a special case when 'generate' is called because you will get 'null_embed' at the first iteration which is just [dim] shape/size

lucidrains added a commit that referenced this issue Sep 11, 2024
@inspirit
Copy link
Author

probably smth like:

if sum_embeds.ndim == 3:
    sum_embeds = reduce(sum_embeds, 'b (n h) d -> b n d', 'sum', h = self.num_effective_quantizers)

should do the trick

lucidrains added a commit that referenced this issue Sep 11, 2024
@lucidrains
Copy link
Owner

@inspirit ok done

does self conditioning work for you? haven't heard of many people using it

@inspirit
Copy link
Author

i just started digging it for one of my projects with Residual Quantizers, so too early to comment, was validating that all works after incorporating it to my pipeline and found this issue, so might be completely useless in the end :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants