---
title: "ControlNet in 🧨 Diffusers"
description: "ControlNet conditions Stable Diffusion on spatial inputs such as Canny edges, segmentation maps, scribbles or OpenPose keypoints."
url: "https://swe.quest/articles/controlnet-in-diffusers-2c39bfe039d68caf"
canonical: "https://huggingface.co/blog/controlnet"
source: "Hugging Face"
published: "2023-03-03"
difficulty: "medium"
kind: "How-to"
reading_minutes: 11
tags: ["computer-vision","inference","python","machine-learning"]
---

# ControlNet in 🧨 Diffusers

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-03-03, 11 min read, How-to. Original: [https://huggingface.co/blog/controlnet](https://huggingface.co/blog/controlnet)

## Summary

ControlNet conditions Stable Diffusion on spatial inputs such as Canny edges, segmentation maps, scribbles or OpenPose keypoints. It does this by training a copy of the UNet that is linked to the frozen original through zero-convolution layers, so swapping conditionings only means swapping ControlNet weights (about 700M extra parameters for SD 1.5). The Diffusers StableDiffusionControlNetPipeline makes this practical with fp16 weights, the UniPCMultistepScheduler (cutting steps from 50 to 20), model CPU offloading and xformers attention for fast, memory-efficient inference. Worked examples cover Canny edge control, DreamBooth fine-tuned models, pose transfer with OpenPose, and combining multiple ControlNets with masked conditionings and per-condition scales.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)

## Prerequisites

- Stable Diffusion basics
- PyTorch
- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))

## Keywords

ControlNet, Diffusers, Stable Diffusion, UniPCMultistepScheduler, xformers, OpenPose, DreamBooth, controlnet\_aux

## Related posts

- [Train your ControlNet with diffusers](https://swe.quest/articles/train-your-controlnet-with-diffusers-0fe323cd4b532fe5.md): Hugging Face · 2023-03-24 · Medium · 9 min read · Model training, Computer vision, Machine learning, Python
  Training a custom ControlNet for Stable Diffusion comes down to three steps: choose a condition that an existing model can extract from ordinary images, build a dataset of image/conditioning-image/caption triples, and run the diffusers train\_controlnet.py script.
- [How Diffusion Controller unifies and simplifies AI image generation](https://swe.quest/articles/how-diffusion-controller-unifies-and-simplifies-ai-image-generation-261f5c78987e6b2e.md): Google Research · 2026-09-29 · Hard · 7 min read · Model training, Computer vision, Machine learning
  Diffusion Controller reframes diffusion denoising as a continuous control problem, unifying inference-time guidance and fine-tuning methods such as LoRA, reward-weighted regression and policy gradients under one framework.
- [Stable Diffusion with 🧨 Diffusers](https://swe.quest/articles/stable-diffusion-with-diffusers-03ca8448e680e397.md): Hugging Face · 2022-08-22 · Medium · 15 min read · Computer vision, Inference & serving, Machine learning, Python
  Stable Diffusion is a latent diffusion model that denoises compressed 64×64 latents rather than pixels, combining a VAE, a text-conditioned U-Net with cross-attention, and a frozen CLIP text encoder.
- [Efficient Controllable Generation for SDXL with T2I-Adapters](https://swe.quest/articles/efficient-controllable-generation-for-sdxl-with-t2i-adapters-4ef46153eee1c0c4.md): Hugging Face · 2023-09-08 · Medium · 5 min read · Computer vision, Model training, Inference & serving, Python
  T2I-Adapter-SDXL drives the 2.6B-parameter SDXL model with a 79M-parameter adapter that runs once per generation, unlike ControlNet, which runs alongside the UNet at every denoising step.
- [Diffusers welcomes Stable Diffusion 3](https://swe.quest/articles/diffusers-welcomes-stable-diffusion-3-f6ced777e2fcbd47.md): Hugging Face · 2024-06-12 · Medium · 7 min read · Computer vision, Inference & serving, Model training, Python
  Stable Diffusion 3 Medium (2B parameters) is now usable through Diffusers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
