All models

UNet2DConditionModel

The latent diffusion denoising UNet, conditioned through cross-attention on text or other tokens.

Diffusion and generative · 1,209 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (28 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
872.3M
Operations
1,209
Framework
PyTorch
Recurrent
No
Published
CVPR 2022
Cited by
736 (as of 5 October 2026)
Authors
Robin Rombach, Andreas Blattmann, Dominik Lorenz and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m3227
Graph hash
866adea5ae533a6ec824bd7f4f82d9d53ab451a31ad1beb00c2b9bf576be9100
Skeleton hash
7ce92bd1d62674a6dcc3078e9eeffd21b032b4ecd81f610f6cb1d3c922dc2d35
Architecture hash
2f16753c7b1f92b44ab1063c01508d1119b8963c4581781b9a443489ff04a71b
Diagram SHA-256
c5c5f0df63a63358d3394dbf2b93efb6fb7ea1ba32178835de96b8a150d0812c
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

UNet2DConditionModel is the denoising backbone of a latent diffusion model, a time-conditional UNet, here in the diffusers port. Latent diffusion models apply diffusion in the latent space of a powerful pretrained autoencoder rather than in pixel space, which lets them train on limited computational resources while retaining quality and flexibility. Diffusion models themselves are read as an equally weighted sequence of denoising autoencoders, each trained to predict a denoised variant of a noisy input.

The Condition in the name is cross-attention: the UNet backbone is augmented with cross-attention layers so that conditioning inputs such as text or bounding boxes can steer generation. A domain specific encoder first projects the conditioning to an intermediate representation, which is then mapped into the intermediate layers of the UNet through cross-attention. The paper describes this as a general-purpose conditioning mechanism that enables multi-modal training.

The authors used it to train class-conditional, text-to-image and layout-to-image models, and released pretrained latent diffusion and autoencoding models in the CompVis latent-diffusion repository. That repository later added a 1.45B latent diffusion model trained on the LAION-400M database, with a web demo on Hugging Face Spaces.

Key idea. Connecting transformers to the diffusion UNet through cross-attention, so arbitrary token-based conditioning such as text can drive image synthesis in a compressed latent space.

  • unet2dconditionmodel
  • unet 2d condition model
  • stable diffusion unet
  • ldm conditional unet
  • latent diffusion
  • latent diffusion models
  • ldm
  • diffusers unet
  • denoising unet
  • cross-attention unet
  • text-to-image
  • rombach
  • compvis

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{rombach2022highresolutionimagesynthesislatent,
      title={High-Resolution Image Synthesis with Latent Diffusion Models}, 
      author={Robin Rombach and Andreas Blattmann and Dominik Lorenz and Patrick Esser and Björn Ommer},
      year={2022},
      eprint={2112.10752},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2112.10752}, 
}