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

Conditional embedding #30

Open
yangming0724 opened this issue Nov 12, 2023 · 1 comment
Open

Conditional embedding #30

yangming0724 opened this issue Nov 12, 2023 · 1 comment

Comments

@yangming0724
Copy link

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.

@zoubohao
Copy link
Owner

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)."

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