Open yangming0724 opened 8 months ago
Please read the paper "CLASSIFIER-FREE DIFFUSION GUIDANCE". The label 0 refers to the model without conditions. The labels 1 to 10 refer to the CIFAR10 labels.
The paper says: "Instead of training a separate classifier model, we choose to train an unconditional denoising diffusion model pθ(z) parameterized through a score estimator θ(zλ) together with the conditional model pθ(z|c) parameterized through θ(zλ, c)."
When doing conditional generation, the CIFAR10 labels (index from 0 to 9) need to be embedding into a latent space with the same dimension as time embedding. When read your code, I noticed the following line:
nn.Embedding(num_embeddings=num_labels + 1, embedding_dim=d_model, padding_idx=0)
Why the num_embeddings set to be num_labels + 1, and the padding is for what kind of purpose?Thanks in advance.