leejet/stable-diffusion.cpp
Diffusion model(SD,Flux,Wan,Qwen Image,Z-Image,...) inference in pure C/C++
What it solves
It provides a lightweight, high-performance way to run diffusion models (for image and video generation) locally without needing heavy external dependencies or complex Python environments.
How it works
Written in pure C/C++ and based on the ggml library, it implements inference for a wide variety of diffusion models. It supports multiple hardware backends (CPU, CUDA, Vulkan, Metal, OpenCL, SYCL) and weight formats including GGUF, Safetensors, and PyTorch checkpoints. It optimizes memory usage through techniques like Flash Attention and VAE tiling.
Who it’s for
Developers and users who want to run image and video generation models on a variety of platforms (Linux, macOS, Windows, Android) with minimal overhead and maximum hardware compatibility.
Highlights
- Broad Model Support: Compatible with SD1.x, SD2.x, SDXL, SD3/3.5, FLUX.1/2, Wan2.1/2.2, LTX-2.3, and many others.
- Multi-Modal Capabilities: Supports image generation, image editing, and video generation.
- Hardware Flexibility: Runs on CPU (with AVX/AVX2/AVX512), NVIDIA GPUs (CUDA), Apple Silicon (Metal), and other accelerators via Vulkan, OpenCL, and SYCL.
- Advanced Features: Includes LoRA support, ControlNet (SD 1.5), ADetailer, and various sampling methods (Euler, DPM++, LCM).
- Efficient Formats: Supports GGUF quantization and weight conversion.