AMD is in the process of moving over to a brand new build system (TheRock). They have a preview release stream for it, and it includes some significant performance uplifts. To let people experiment with both stacks generate artifacts both for the stable (7.2.1) and preview (7.12) stacks. In both cases - ROCm must be installed first to use this artifact. It's intentionally not bundled because so many ISAs are included and the size of the artifact balloons to an untenable size.
stable-diffusion.cpp
Diffusion model(SD,Flux,Wan,...) inference in pure C/C++
Note that this project is under active development.
API and command-line option may change frequently.
🔥Important News
-
2026/01/18 🚀 stable-diffusion.cpp now supports FLUX.2-klein
👉 Details: PR #1193 -
2025/12/01 🚀 stable-diffusion.cpp now supports Z-Image
👉 Details: PR #1020 -
2025/11/30 🚀 stable-diffusion.cpp now supports FLUX.2-dev
👉 Details: PR #1016 -
2025/10/13 🚀 stable-diffusion.cpp now supports Qwen-Image-Edit / Qwen-Image-Edit 2509
👉 Details: PR #877 -
2025/10/12 🚀 stable-diffusion.cpp now supports Qwen-Image
👉 Details: PR #851 -
2025/09/14 🚀 stable-diffusion.cpp now supports Wan2.1 Vace
👉 Details: PR #819 -
2025/09/06 🚀 stable-diffusion.cpp now supports Wan2.1 / Wan2.2
👉 Details: PR #778
Features
- Plain C/C++ implementation based on ggml, working in the same way as llama.cpp
- Super lightweight and without external dependencies
- Supported models
- Image Models
- Image Edit Models
- Video Models
- PhotoMaker support.
- Control Net support with SD 1.5
- LoRA support, same as stable-diffusion-webui
- Latent Consistency Models support (LCM/LCM-LoRA)
- Faster and memory efficient latent decoding with TAESD
- Upscale images generated with ESRGAN
- Supported backends
- CPU (AVX, AVX2 and AVX512 support for x86 architectures)
- CUDA
- Vulkan
- Metal
- OpenCL
- SYCL
- Supported weight formats
- Pytorch checkpoint (
.ckptor.pth) - Safetensors (
.safetensors) - GGUF (
.gguf)
- Pytorch checkpoint (
- Supported platforms
- Linux
- Mac OS
- Windows
- Android (via Termux, Local Diffusion)
- Flash Attention for memory usage optimization
- Negative prompt
- stable-diffusion-webui style tokenizer (not all the features, only token weighting for now)
- VAE tiling processing for reduce memory usage
- Sampling method
Euler AEulerHeunDPM2DPM++ 2MDPM++ 2M v2DPM++ 2S aLCM
- Cross-platform reproducibility
--rng cuda, default, consistent with thestable-diffusion-webui GPU RNG--rng cpu, consistent with thecomfyui RNG
- Embedds generation parameters into png output as webui-compatible text string
Quick Start
Get the sd executable
- Download pre-built binaries from the releases page
- Or build from source by following the build guide
Download model weights
-
download weights(.ckpt or .safetensors or .gguf). For example
- Stable Diffusion v1.5 from https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5
curl -L -O https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
Generate an image with just one command
./bin/sd-cli -m ../models/v1-5-pruned-emaonly.safetensors -p "a lovely cat"
For detailed command-line arguments, check out cli doc.
Performance
If you want to improve performance or reduce VRAM/RAM usage, please refer to performance guide.
More Guides
- SD1.x/SD2.x/SDXL
- SD3/SD3.5
- FLUX.1-dev/FLUX.1-schnell
- FLUX.2-dev/FLUX.2-klein
- FLUX.1-Kontext-dev
- Chroma
- 🔥Qwen Image
- 🔥Qwen Image Edit series
- 🔥Wan2.1/Wan2.2
- 🔥Z-Image
- Ovis-Image
- Anima
- LoRA
- LCM/LCM-LoRA
- Using PhotoMaker to personalize image generation
- Using ESRGAN to upscale results
- Using TAESD to faster decoding
- Docker
- Quantization and GGUF
- Inference acceleration via caching
Bindings
These projects wrap stable-diffusion.cpp for easier use in other languages/frameworks.
- Golang (non-cgo): seasonjs/stable-diffusion
- Golang (cgo): Binozo/GoStableDiffusion
- C#: DarthAffe/StableDiffusion.NET
- Python: william-murray1204/stable-diffusion-cpp-python
- Rust: newfla/diffusion-rs
- Flutter/Dart: rmatif/Local-Diffusion
UIs
These projects use stable-diffusion.cpp as a backend for their image generation.
- Jellybox
- Stable Diffusion GUI
- Stable Diffusion CLI-GUI
- Local Diffusion
- sd.cpp-webui
- LocalAI
- Neural-Pixel
- KoboldCpp
Contributors
Thank you to all the people who have already contributed to stable-diffusion.cpp!
