lucidrains / vector-quantize-pytorch

Vector (and Scalar) Quantization, in Pytorch
MIT License
2.12k stars 179 forks source link

a small bug in GroupedResidualVQ #135

Closed sivannavis closed 2 weeks ago

sivannavis commented 2 weeks ago

https://github.com/lucidrains/vector-quantize-pytorch/blob/97c9b6557c85d8962901c904c63cc028ee294e18/vector_quantize_pytorch/residual_vq.py#L291

It should be random.randint(0, int(1e7) otherwise there's an error TypeError: 'float' object cannot be interpreted as an integer

lucidrains commented 2 weeks ago

@sivannavis oops, thanks!

sivannavis commented 2 weeks ago

And another one here (I'm not sure if this is a bug or a special case for my input): https://github.com/lucidrains/vector-quantize-pytorch/blob/78b36f42c50e1e89fb52a3f7ad767e6e942be5ef/vector_quantize_pytorch/residual_vq.py#L144

My indices is a list of tensors with length of the number of quantizers, so I have to change this line to torch.any(torch.stack(indices) == -1)

lucidrains commented 2 weeks ago

@sivannavis ok, should be handled!