diffusion_models.models.conditioned_simple_unet

Module Contents

class ConditionedSimpleUnet(diffuser, image_channels, text_embedding_size)[source]

A Simplified variant of the Unet architecture used in DDPM.

Parameters:
  • diffuser (BaseDiffuser) – A gaussian diffuser.

  • image_channels (int) – The number of image channels.

text_embedding_mlp[source]
time_mlp[source]
conv0[source]
downs[source]
ups[source]
output[source]
forward(x, timestep, labels=None)[source]

Forward pass of the diffusion model.

The forward pass of the diffusion model, predicting the noise at a single step.

Parameters:
  • x (Tensor) – A batch of noisy images.

  • timestep (Tensor) – The timesteps of each image in the batch.

  • labels (Optional[Tensor]) – Optional labels to be passed when conditioning the diffusion model.

Returns:

A tensor representing the noise predicted for each image.