Go to file
2026-02-09 23:34:19 +08:00
.github ci: add a github action to generate a Linux ROCm artifact (#1258) 2026-02-09 23:23:06 +08:00
assets docs: add z-image-base example 2026-01-28 21:47:36 +08:00
docs docs: add z-image-base example 2026-01-28 21:47:36 +08:00
examples fix: correct sdapi handling of cfg_scale and steps (#1260) 2026-02-09 23:34:19 +08:00
ggml@a8db410a25 sync: update ggml 2026-02-01 20:54:23 +08:00
thirdparty chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
.clang-format style: format code 2024-01-29 23:05:18 +08:00
.clang-tidy chore: add .clang-tidy configuration and apply modernize checks (#902) 2025-10-18 23:23:40 +08:00
.dockerignore chore: add Linux Vulkan build and Docker image workflows (#1164) 2026-01-05 23:42:12 +08:00
.gitignore feat: add image preview support (#522) 2025-11-10 00:12:02 +08:00
.gitmodules feat: add wan2.1/2.2 support (#778) 2025-09-06 18:08:03 +08:00
cache_dit.hpp chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
clip.hpp refactor: unify the processing of attention mask (#1230) 2026-01-26 00:33:34 +08:00
CMakeLists.txt chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
common.hpp refactor: unify the processing of attention mask (#1230) 2026-01-26 00:33:34 +08:00
conditioner.hpp feat: add --fa option (#1242) 2026-02-01 21:44:54 +08:00
control.hpp feat: handle ggml compute failures without crashing the program (#1003) 2025-12-04 22:04:27 +08:00
denoiser.hpp feat: add res_multistep, res_2s sampler and bong tangent scheduler (#1234) 2026-02-01 20:05:27 +08:00
diffusion_model.hpp feat: add --fa option (#1242) 2026-02-01 21:44:54 +08:00
Dockerfile chore: add Linux Vulkan build and Docker image workflows (#1164) 2026-01-05 23:42:12 +08:00
Dockerfile.musa chore: downgrade ubuntu base image in musa container image (#1176) 2026-01-05 23:56:34 +08:00
Dockerfile.sycl chore: add Linux Vulkan build and Docker image workflows (#1164) 2026-01-05 23:42:12 +08:00
Dockerfile.vulkan chore: add Linux Vulkan build and Docker image workflows (#1164) 2026-01-05 23:42:12 +08:00
easycache.hpp feat: add easycache support (#940) 2025-11-19 23:19:32 +08:00
esrgan.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00
face_detect.py feat: add PhotoMaker Version 2 support (#358) 2024-11-23 11:50:14 +08:00
flux.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00
format-code.sh feat: simple openai image generation api compatiple server (#1037) 2025-12-13 13:53:21 +08:00
ggml_extend.hpp fix: improve handling of VAE decode failures (#1222) 2026-02-09 23:29:41 +08:00
gguf_reader.hpp chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
gits_noise.inl fix: clang complains about needless braces (#618) 2025-03-09 12:26:41 +08:00
latent-preview.h chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
LICENSE Initial commit 2023-08-13 16:00:22 +08:00
llm.hpp refactor: unify the processing of attention mask (#1230) 2026-01-26 00:33:34 +08:00
lora.hpp feat: optimize LoKr at runtime (#1233) 2026-02-08 00:08:09 +08:00
ltxv.hpp refactor: introduce GGMLRunnerContext (#928) 2025-11-02 02:11:04 +08:00
mmdit.hpp refactor: unify the processing of attention mask (#1230) 2026-01-26 00:33:34 +08:00
model.cpp chore: clarify warning about missing model files (#1219) 2026-01-21 22:34:11 +08:00
model.h feat: add support for Segmind's Vega model (#1195) 2026-01-19 23:15:47 +08:00
name_conversion.cpp fix: improve LoCon support with other naming conventions (#1239) 2026-02-01 20:00:16 +08:00
name_conversion.h feat: support applying LoRA at runtime (#969) 2025-11-13 21:48:44 +08:00
ordered_map.hpp refactor: optimize the logic for name conversion and the processing of the LoRA model (#955) 2025-11-10 00:12:20 +08:00
pmid.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00
preprocessing.hpp chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
qwen_image.hpp fix: avoid the issue of NaN for qwen-image on certain devices (#1249) 2026-02-04 23:49:05 +08:00
README.md docs: add FLUX.2-klein support to news 2026-01-19 23:56:50 +08:00
rng_mt19937.hpp chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
rng_philox.hpp chore: add .clang-tidy configuration and apply modernize checks (#902) 2025-10-18 23:23:40 +08:00
rng.hpp chore: add .clang-tidy configuration and apply modernize checks (#902) 2025-10-18 23:23:40 +08:00
rope.hpp refactor: unify the processing of attention mask (#1230) 2026-01-26 00:33:34 +08:00
stable-diffusion.cpp fix: improve handling of VAE decode failures (#1222) 2026-02-09 23:29:41 +08:00
stable-diffusion.h feat: add --fa option (#1242) 2026-02-01 21:44:54 +08:00
t5.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00
tae.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00
tokenize_util.cpp feat: add flux2 support (#1016) 2025-11-30 11:32:56 +08:00
tokenize_util.h feat: add Qwen Image support (#851) 2025-10-12 23:23:19 +08:00
ucache.hpp feat: add more caching methods (#1066) 2025-12-22 23:52:11 +08:00
unet.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00
upscaler.cpp fix: improve handling of VAE decode failures (#1222) 2026-02-09 23:29:41 +08:00
util.cpp chore: eliminate compilation warnings under MSVC (#1170) 2026-01-04 22:26:57 +08:00
util.h feat: support mmap for model loading (#1059) 2025-12-28 22:38:29 +08:00
vae.hpp feat: add --fa option (#1242) 2026-02-01 21:44:54 +08:00
version.cpp feat: embed version string and git commit hash (#1008) 2025-12-09 22:38:54 +08:00
vocab_mistral.hpp feat: add flux2 support (#1016) 2025-11-30 11:32:56 +08:00
vocab_qwen.hpp feat: add Qwen Image support (#851) 2025-10-12 23:23:19 +08:00
vocab_umt5.hpp feat: add wan2.1/2.2 support (#778) 2025-09-06 18:08:03 +08:00
vocab.hpp feat: add sd3 support (#298) 2024-07-28 15:44:08 +08:00
wan.hpp feat: add --fa option (#1242) 2026-02-01 21:44:54 +08:00
z_image.hpp perf: make dit faster (#1228) 2026-01-25 22:50:10 +08:00

stable-diffusion.cpp

leejet%2Fstable-diffusion.cpp | Trendshift

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

Quick Start

Get the sd executable

Download model weights

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.

Bindings

These projects wrap stable-diffusion.cpp for easier use in other languages/frameworks.

UIs

These projects use stable-diffusion.cpp as a backend for their image generation.

Contributors

Thank you to all the people who have already contributed to stable-diffusion.cpp!

Contributors

Star History

Star History Chart

References