vector-quantize-pytorch
vector-quantize-pytorch copied to clipboard
DDP: RuntimeError: shape mismatch: value tensor of shape [535, 256] cannot be broadcast to indexing result of shape [537, 256]
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, )
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]
@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
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!