Closed trfnhle closed 1 year ago
@l4zyf9x hey Trinh! thank you for opening this issue! i've neglected this feature when adding multi-headed VQ, and since so few researchers reported good results using it, i haven't bothered fixing it
all your points should be addressed in the latest commit. are you using this successfully in any model?
Thank you for fixing the issue. While experimenting with orthogonal reg loss, I do not see it affecting reconstructing loss much besides the effect that makes codebook vectors far from each other.
Hello, thank you for the great work of VQ-VAE. While reading your implementation when turning on the flag
orthogonal_reg_active_codes_only
. https://github.com/lucidrains/vector-quantize-pytorch/blob/b449efc35c0414d0338752d6a81b44142a8779af/vector_quantize_pytorch/vector_quantize_pytorch.py#L592-L603 I think it does not work properly. The codebook shape after the linecodebook = self._codebook.embed
is [num_codebook, codebook_size, codebook_dim]. Therefore this linecodebook = codebook[unique_code_ids]
should becodebook = codebook[:, unique_code_ids]
andnum_codes = codebook.shape[0]
should benum_codes = codebook.shape[1]
. Am I correct? Overall this above code should beAnd even with the above code,
orthogonal_reg_active_codes_only
only work properly whennum_codebook = 1
Looking forward to hearing your opinion.