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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to conditional diffusion with two classes label #128

Closed
Johnson-yue opened this issue Jul 22, 2022 · 2 comments
Closed

how to conditional diffusion with two classes label #128

Johnson-yue opened this issue Jul 22, 2022 · 2 comments

Comments

@Johnson-yue
Copy link

No description provided.

@anton-l
Copy link
Member

anton-l commented Jul 22, 2022

Hi @Johnson-yue,
We don't have any examples for class-conditional diffusion just yet, but you already can train your own model for that!

UNet2DConditionModel's forward() function exposes an encoder_hidden_states parameter: https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L118
So you can encode the class labels in your preferred way (for example, using torch.nn.Embeddings and a couple of Linear layers) and pass them to the UNet during training and inference 馃檪

@anton-l anton-l closed this as completed Jul 22, 2022
@sean-halpin
Copy link

@anton-l Even though it is possible to provide the encoder_hidden_states while training, the DDPMPipeline has no mechanism to provide encoder_hidden_states during inference.

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

3 participants