Skip to content
fn

stable_diffusion_gen

→StableDiffusionForImageGeneration
stable_diffusion_gen(pretrained: bool = False, overrides: object = {})

v1 as a task model: the denoising objective and the sampler.

Model Size

Parameters

pretrainedbool= False
Load the released v1 checkpoint into the sampler. This is the factory that produces images, so it is the one that most wants the weights — it loads the same entry stable_diffusion does, into the model held inside.
**overridesobject= {}
Optional StableDiffusionConfig field overrides.

Returns

StableDiffusionForImageGeneration

Calling it is one training step, returning a StableDiffusionOutput with the loss; generate samples with classifier-free guidance.

Notes

Reference: Rombach et al., CVPR 2022 (arXiv:2112.10752), §4.3.

Examples

>>> from lucid.models import stable_diffusion_gen
>>> model = stable_diffusion_gen()
Read from the configuration for the same reason as
stable_diffusion — the sampler holds the same network:
>>> from lucid.models.generative.stable_diffusion import (
...     StableDiffusionConfig)
>>> StableDiffusionConfig().sample_size
512

Used by 1