Skip to content
fn

stable_diffusion

→StableDiffusionModel
stable_diffusion(pretrained: bool = False, overrides: object = {})

Construct the v1 architecture — 512 pixels, CLIP ViT-L/14 width.

Model Size

Parameters

pretrainedbool= False
Load the released v1 checkpoint from the Lucid hub.
**overridesobject= {}
Optional StableDiffusionConfig field overrides.

Returns

StableDiffusionModel

Autoencoder, conditional U-Net and sampler.

Notes

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

cross_attention_dim is 768, which is exactly lucid.models.clip_vit_large_14's text width — that tower is what produced the conditioning these settings were trained against.

Examples

>>> from lucid.models import stable_diffusion
>>> model = stable_diffusion()
That call materialises 943M parameters — about three gigabytes — and
what it will build is a property of the configuration, so the shape
is read there instead:
>>> from lucid.models.generative.stable_diffusion import (
...     StableDiffusionConfig)
>>> config = StableDiffusionConfig()
>>> config.latent_size, config.cross_attention_dim
(64, 768)

Used by 1