<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > SD - Stable Diffusion AI > SDO. Stable Diffusion Online |
Technical Background (Info)
Understanding Samplers in SDL. and SDO.
Generated using the SPR and SDL.-Command
Samplers play a crucial role with AI generated Images. They are responsible for various sampling methods, each with its unique characteristics and applications.
They are the backbone of the system, determining how images are processed and refined.
This chapter aims to provide a simplified understanding of these samplers, helping users make informed decisions about which one to use.
- Definition: The sampler is responsible for carrying out the denoising steps. It gradually produces cleaner and cleaner images through a denoising process.
At its core, sampling is about refining images. The sampler oversees the denoising steps, ensuring that with each iteration, the image becomes clearer and more defined.
- Noise Schedule: This is a predetermined schedule that dictates the noise level at each sampling step.
For instance, a noise schedule for 15 sampling steps starts with the highest amount of noise, which gradually decreases to zero by the last step.
Think of this as a roadmap for the sampler.
It's a predetermined plan that indicates the noise level at each step of the sampling process.
For instance, a 15-step noise schedule would commence with a high noise level, which would then taper off, reaching zero by the 15th step. This schedule can be adjusted based on the number of steps, with more steps leading to a smoother noise reduction process.
Index |
validSampler |
0 |
Euler |
1 |
Euler a |
2 |
LMS |
3 |
Heun |
4 |
DPM2 |
5 |
DPM2 a |
6 |
DPM++ 2S a |
7 |
DPM++ 2M |
8 |
DPM++ SDE |
9 |
DPM++ 2M SDE |
10 |
DPM fast |
11 |
DPM adaptive |
12 |
LMS Karras |
13 |
DPM2 Karras |
14 |
DPM2 a Karras |
15 |
DPM++ 2S a Karras |
16 |
DPM++ 2M Karras |
17 |
DPM++ SDE Karras |
18 |
DPM++ 2M SDE Karras |
19 |
DDIM |
20 |
PLMS |
21 |
UniPC |
- Old-School ODE Solvers:
These are traditional solvers for ordinary differential equations (ODE) that have been around for over a century.
Examples include Euler, Heun, and LMS.
- Ancestral Samplers:
These samplers have names with a single letter “a” (e.g., Euler a, DPM2 a).
They are stochastic in nature. However, images generated using ancestral samplers like Euler a do not converge at high sampling steps, making them less desirable for reproducibility.
Therefore, a significant drawback is their inability to ensure image convergence at high sampling steps, which can be a hurdle for those seeking consistent reproducibility.
- Karras Noise Schedule: Introduced by Karras, this is a specialized noise schedule that offers a distinct approach to noise management during sampling.
- DDIM and PLMS: Though once popular, these samplers have now fallen out of favor and are considered relics of the past.
- DPM and DPM++: These represent the new age of samplers. They come in various iterations and versions, each with its unique features.
- **UniPC**: This sampler supports any solver and noise predictors. Its a versatile sampler, making it a valuable tool in the Samplers arsenal.
- **Image Convergence**: This refers to how quickly a sampler can produce a clear image. For instance, DDIM can produce a high-quality image in as few as 8 steps.
- **Speed**: Some samplers, especially 2nd order solvers, might be slower as they evaluate the denoising U-Net twice.
- **Quality**: The ultimate goal is to produce high-quality images. For example, ancestral samplers tend to converge to an image of a kitten, while deterministic ones converge to a cat.
Looking at this graph the Heun Sampler looks superior. In a third dimension, it needs twice as much time as other Samplers. Right Chart: The image quality of ancestral samplers (Lower the better).
Therefore we must compare it with other samplers and a twice as high rate of steps.
1. **Euler**: The most straightforward sampler. It operates deterministically, reducing noise according to a predetermined noise schedule.
2. **DDIM (Denoising Diffusion Implicit Models)**: This sampler approximates the final image with a denoised image during its steps.
3. **LMS and LMS Karras**: These are linear multistep methods.
4. **DPM Samplers**: These are Diffusion Probabilistic Model Solvers with various versions available.
5. **UniPC**: This sampler consists of a Unified predictor (UniP) and a Unified corrector (UniC).
Priority |
Recommended Sampler |
Steps |
Additional Notes |
Fast, Converging, New, Quality |
DPM++ 2M Karras |
20-30 |
|
UniPC |
20-30 |
||
High Quality (No Convergence) |
DPM++ SDE Karras |
10-15 |
Slower sampler |
DDIM |
10-15 |
||
Stability & Reproducibility |
Avoid Ancestral Samplers |
- |
Ensures stable, reproducible images |
Simplicity |
Euler |
Variable |
Simple and straightforward |
Heun |
Reduced |
Reduce steps to save time |
When selecting a sampler, it's essential to consider your priorities, whether it's speed, convergence, quality, or simplicity.
Here's a guide to help you make an informed decision:
For Speed, Convergence, and Quality:
If you're looking for a sampler that's both modern and efficient, the DPM++ 2M Karras and UniPC are excellent choices.
For optimal results, use them with 20-30 steps.
For Quality Without Convergence:
If your primary concern is the quality of images and you're less bothered about convergence, the DPM++ SDE Karras and DDIM are your best bets.
However, note that the DPM++ SDE Karras is a bit slower in its operation. For these samplers, 10-15 steps are ideal.
For Stability and Reproducibility:
If you prioritize stable and reproducible images, it's advisable to steer clear of any ancestral samplers.
For Simplicity:
If you're a fan of simplicity and straightforwardness, Euler is a great choice.
Heun is another simple option, but to save time, you might want to reduce the number of steps when using it.
With this guide, you can now select the sampler that aligns best with your requirements.
*Source: [Stable Diffusion Art]*