leejet/stable-diffusion.cpp

★ 7,936⑂ 941

Diffusion model(SD,Flux,Wan,Qwen Image,Z-Image,...) inference in pure C/C++

About leejet/stable-diffusion.cpp

leejet/stable-diffusion.cpp is an open-source project on GitHub, mainly written in C++. Diffusion model(SD,Flux,Wan,Qwen Image,Z-Image,...) inference in pure C/C++ It currently holds 7,936 stars and 941 forks with 271 open issues, and was last pushed on 2026-11-08 (repository created 2023-08-13).

Project Overview

Git Homed tracks it on the Image Trending board and on the AI Image Trending list.

GitHub Repository Details

Repository leejet/stable-diffusion.cpp · default branch master · size 172909 KB · watchers 80 · source: GitHub REST API and repository README

README

stable-diffusion.cpp

https://github.com/leejet/stable-diffusion.cpp/blob/HEAD/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

Features

Quick Start

Get the executables

The executable examples below run from the build directory (cd build from the repository root). Windows examples use the Visual Studio Release path; adjust the executable path for other build configurations or extracted archives. Model files stay under the repository's models/ directory.

Download model weights

Choose a model from the model guides and download its weights and required components. For a simple example, save Stable Diffusion 1.5 under models/checkpoints/:

Windows (PowerShell)

New-Item -ItemType Directory -Force ..\models\checkpoints | Out-Null
curl.exe -L -o ..\models\checkpoints\v1-5-pruned-emaonly.safetensors https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors

Linux/macOS

mkdir -p ../models/checkpoints
curl -L -o ../models/checkpoints/v1-5-pruned-emaonly.safetensors https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors

Option 1: Web UI

Start the server:

Windows (PowerShell)

.\bin\Release\sd-server.exe --model-dir ..\models

Linux/macOS

./bin/sd-server --model-dir ../models

Open , choose SD 1.x in Recipe, select the checkpoint, and click Load models. Enter a prompt and click Generate. See the Web UI guide for the full workflow.

Option 2: CLI

Generate an image with one command:

Windows (PowerShell)

.\bin\Release\sd-cli.exe -m ..\models\checkpoints\v1-5-pruned-emaonly.safetensors -p "a lovely cat"

Linux/macOS

./bin/sd-cli -m ../models/checkpoints/v1-5-pruned-emaonly.safetensors -p "a lovely cat"

Run .\bin\Release\sd-cli.exe --help on Windows or ./bin/sd-cli --help on Linux/macOS for all command-line options. See the CLI guide for additional usage notes.

Performance

If you want to improve performance or reduce VRAM/RAM usage, please refer to performance guide. For runtime and parameter backend placement, see the backend selection guide.

Documentation

Browse the documentation index or jump to a topic:

Contributors

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

Contributors

GitHub Stars & Activity

7,936Stars
941Forks
271Open issues
C++Language

GitHub Popularity

GitHub stars7,936
Forks941
Open issues271
Primary languageC++
LicenseMIT
Stars gained today0
Created2023-08-13
Last pushed2026-11-08

Trending History

Trending statusnot on today's boards

Related GitHub Projects

1

opencv / opencv

C++★ 91,609⑂ 0
→
2
→
3

dusty-nv / jetson-inference

C++★ 9,034⑂ 0
→
4

openMVG / openMVG

C++★ 6,603⑂ 0
→
5

MaaXYZ / MaaFramework

C++★ 5,201⑂ 0
→
6

xlite-dev / lite.ai.toolkit

C++★ 4,450⑂ 0
→
7
→
8

Comfy-Org / ComfyUI

Python★ 147,283⑂ 0
→

More Trending Repositories