Initializing time step embeddings
We introduced the scheduler in Chapter 3. By using the scheduler, we can sample key steps for image generation. Instead of denoising 1,000 steps to generate an image in the original diffusion model (DDPM), by using a scheduler, we can generate an image in a mere 20 steps.
In this section, we are going to use the Euler scheduler to generate time step embeddings, and then we’ll take a look at what the time step embeddings look like. No matter how good the diagram that tries to plot the process is, we can only understand how it works by reading the actual data and code:
- Initialize a scheduler from the scheduler configuration for the model:
from diffusers import EulerDiscreteScheduler as Euler
# initialize scheduler from a pretrained checkpoint
scheduler = Euler.from_pretrained(
"runwayml/stable-diffusion-v1-5",
subfolder = "scheduler"
)
The preceding code will initialize a...