- Notifications
You must be signed in to change notification settings - Fork473
Diffusion model(SD,Flux,Wan,Qwen Image,Z-Image,...) inference in pure C/C++
License
leejet/stable-diffusion.cpp
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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.
2025/12/01 🚀 stable-diffusion.cpp now supportsZ-Image
👉 Details:PR #10202025/11/30 🚀 stable-diffusion.cpp now supportsFLUX.2-dev
👉 Details:PR #10162025/10/13 🚀 stable-diffusion.cpp now supportsQwen-Image-Edit / Qwen-Image-Edit 2509
👉 Details:PR #8772025/10/12 🚀 stable-diffusion.cpp now supportsQwen-Image
👉 Details:PR #8512025/09/14 🚀 stable-diffusion.cpp now supportsWan2.1 Vace
👉 Details:PR #8192025/09/06 🚀 stable-diffusion.cpp now supportsWan2.1 / Wan2.2
👉 Details:PR #778
- Plain C/C++ implementation based onggml, working in the same way asllama.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 asstable-diffusion-webui
- Latent Consistency Models support (LCM/LCM-LoRA)
- Faster and memory efficient latent decoding withTAESD
- Upscale images generated withESRGAN
- 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
- Download pre-built binaries from thereleases page
- Or build from source by following thebuild guide
download weights(.ckpt or .safetensors or .gguf). For example
- Stable Diffusion v1.5 fromhttps://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
./bin/sd-cli -m ../models/v1-5-pruned-emaonly.safetensors -p"a lovely cat"For detailed command-line arguments, check outcli doc.
If you want to improve performance or reduce VRAM/RAM usage, please refer toperformance guide.
- SD1.x/SD2.x/SDXL
- SD3/SD3.5
- FlUX.1-dev/FlUX.1-schnell
- FLUX.2-dev
- FLUX.1-Kontext-dev
- Chroma
- 🔥Qwen Image
- 🔥Qwen Image Edit/Qwen Image Edit 2509
- 🔥Wan2.1/Wan2.2
- 🔥Z-Image
- Ovis-Image
- LoRA
- LCM/LCM-LoRA
- Using PhotoMaker to personalize image generation
- Using ESRGAN to upscale results
- Using TAESD to faster decoding
- Docker
- Quantization and GGUF
These projects wrapstable-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
These projects usestable-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
Thank you to all the people who have already contributed to stable-diffusion.cpp!
About
Diffusion model(SD,Flux,Wan,Qwen Image,Z-Image,...) inference in pure C/C++
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
