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

DDP: RuntimeError: shape mismatch: value tensor of shape [535, 256] cannot be broadcast to indexing result of shape [537, 256] #169

Open
forwiat opened this issue Nov 6, 2024 · 3 comments

Comments

@forwiat
Copy link

forwiat commented Nov 6, 2024

hi @lucidrains
I found the same error #142
this is my code
self.vq = VectorQuantize( dim=in_channels, codebook_size=codebook_size, codebook_dim=codebook_dim, threshold_ema_dead_code=threshold_ema_dead_code, kmeans_init=False, )

@forwiat
Copy link
Author

forwiat commented Nov 6, 2024

ERROR info:
File "vector_quantize_pytorch/vector_quantize_pytorch.py", line 529, in forward
self.expire_codes_(x)
File "vector_quantize_pytorch/vector_quantize_pytorch.py", line 458, in expire_codes_
self.replace(batch_samples, batch_mask = expired_codes)
File "vector_quantize_pytorch/vector_quantize_pytorch.py", line 444, in replace
self.embed.data[ind][mask] = sampled
RuntimeError: shape mismatch: value tensor of shape [535, 256] cannot be broadcast to indexing result of shape [537, 256]

@lucidrains
Copy link
Owner

lucidrains commented Nov 6, 2024

@forwiat is this the latest version? thought i fixed this 🤔

try actually turning off code expiration, and just use rotation_trick = True. this new research finding may obsolete all these old hacks

@forwiat
Copy link
Author

forwiat commented Nov 7, 2024

I try in many versions, such as 1.14.43, 1.15.x, 1.18.x ...
thx for the solution! I will try it again!

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

2 participants