Unconditional image generation
Unconditional image generation
Unconditional image generation is a relatively straightforward task. The model only generates images - without any additional context like text or an image - resembling the training data it was trained on.
The DiffusionPipeline is the easiest way to use a pre-trained diffusion system for inference.
Start by creating an instance of DiffusionPipeline and specify which pipeline checkpoint you would like to download. You can use any of the ๐งจ Diffusers checkpoints from the Hub (the checkpoint youโll use generates images of butterflies).
๐ก Want to train your own unconditional image generation model? Take a look at the training guide to learn how to generate your own images.
In this guide, youโll use DiffusionPipeline for unconditional image generation with DDPM:
Copied
The DiffusionPipeline downloads and caches all modeling, tokenization, and scheduling components. Because the model consists of roughly 1.4 billion parameters, we strongly recommend running it on a GPU. You can move the generator object to a GPU, just like you would in PyTorch:
Copied
Now you can use the generator
to generate an image:
Copied
The output is by default wrapped into a PIL.Image
object.
You can save the image by calling:
Copied
Try out the Spaces below, and feel free to play around with the inference steps parameter to see how it affects the image quality!
Unconditional butterflies
A DDPM scheduler and UNet model trained (from this checkpoint) on a subset of the Smithsonian Butterflies dataset for unconditional image generation
Last updated