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

I have a question about the perplexity term (in the VQ-VAE). #257

Open
SeongYeonPark opened this issue Nov 21, 2022 · 2 comments
Open

I have a question about the perplexity term (in the VQ-VAE). #257

SeongYeonPark opened this issue Nov 21, 2022 · 2 comments

Comments

@SeongYeonPark
Copy link

As far as I understood, the perplexity used in this repo's VQ-VAE is kind of "meaningfully used codebook token numbers".

When only one codebook token is used, perplexity is 1.
When all codebook tokens appear uniformly, the perplexity equals the codebook nums.

So I was wondering, for good output quality, what is the minimum threshold of "perplexity divided by codebook nums"?
(I guess this should be found experimentally. If you have any results related to this question, it would be great to know.)

@PipeDream941
Copy link

I have the same doubts, perhaps does anyone know what the meaning of "perplexity" is (it would be better to be more specific) but I have found a file that is available for exporting perplexity, and you can look at that file in the hope that it is helpful for you.
https://github.com/zalandoresearch/pytorch-vq-vae/blob/master/vq-vae.ipynb

@PipeDream941
Copy link

I looked into the file I sent you and found that encoding uses onehot and avg_probs averages the columns over the range [BHW,num], so avg_probs has a range of [0, 1] (it can't actually get close to one, I tested the maximum value of avg_probs is no more than 0.01) so the minimum value of perplexity is greater than e**0 == 1.

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