EricGuo5513/momask-codes

Gumbel Softmax in Quantizer

Closed this issue · 2 comments

Thank you for your amazing work.
I just want to make sure I understand the code correctly. The Gumbel Sampling is not necessary here, the Argmin version (line 76) will be exactly the same result, correct?

# code_idx = torch.argmin(distance, dim=-1)
code_idx = gumbel_sample(-distance, dim = -1, temperature = sample_codebook_temp, stochastic=True, training = self.training)

Hi, we set the sampling temperature here:

x_quantized, code_idx, commit_loss, perplexity = self.quantizer(x_encoder, sample_codebook_temp=0.5)

So the Gumbel Sampling results would be different from Argmin version. They are from argmin w/ noise.

Thank you for clarification.