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

VQ-VAE VQ-loss is missing? only find reconstruct, and commitment loss #39

Open
yiqiwang8177 opened this issue Oct 9, 2023 · 1 comment

Comments

@yiqiwang8177
Copy link

yiqiwang8177 commented Oct 9, 2023

Hi,
I am currently studying the VideoGPT and have some doubts on VQ-VAE losses.

Where is VQ loss?

  • In the original paper, there're 3 loss, a reconstruction loss, a VQ loss (bring embedding to encoder_output.detach()). and a commitment loss (bring encoder_output to the embdding.detach()).
  • I could only find the commitment loss implemented, but not the VQ loss.

Any information to resolve the situation will be highly appreciated

@yiqiwang8177 yiqiwang8177 changed the title VQ-VAE commitment loss problem and VQ-loss is missing? VQ-VAE VQ-loss is missing? only find reconstruct, and commitment loss Oct 9, 2023
@shahrushi2003
Copy link

That is because the codebook is being updated using exponential moving average (EMA), not by the gradient of the codebook loss (see line 176 of vqvae.py).

It's shown in this paper that EMA-based updation is equivalent to updating the codebook using SGD over codebook loss.

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