Overview
Unlock the power of cutting-edge diffusion models with stable-diffusion.cpp, a high-performance inference engine written entirely in pure C/C++. Built upon the efficient ggml library and inspired by the success of llama.cpp, this project delivers remarkably lightweight and dependency-free diffusion model execution. Experience rapid image generation and editing across a vast array of models, optimized for diverse hardware including CPUs, GPUs (CUDA, Metal, Vulkan, OpenCL, SYCL), and even mobile platforms.
Key Features
- Broad Model Support: Generate images with Stable Diffusion (v1.x, v2.x, SDXL, SD3/SD3.5), FLUX, Wan, Qwen-Image, Z-Image, Lens, Chroma, PiD, and many more. Also includes support for image editing models, video generation (Wan, LTX, MiniMax-H3), PhotoMaker, IP-Adapter, Control Net, ADetailer, LoRA, LCM/LCM-LoRA, and faster decoding with TAESD.
- Cross-Platform Performance: Leverages advanced CPU instruction sets (AVX, AVX2, AVX512) and GPU acceleration across CUDA, Vulkan, Metal, OpenCL, and SYCL. Runs on Linux, macOS, Windows, and even Android.
- Flexible Weight Formats: Supports standard PyTorch checkpoints (
.ckpt,.pth,.pt), Safetensors (.safetensors), and the optimized GGUF format. - Lightweight & Dependency-Free: Designed for minimal resource usage and no external library dependencies, making deployment incredibly simple.
- Efficient Memory Management: Features like Flash Attention, VAE tiling, and caching significantly reduce memory consumption.
- Extensive Sampling Methods: Includes a comprehensive list of sampling methods like Euler A, DPM++, and LCM for fine-grained control over generation.
- Reproducible Results: Offers multiple RNG backends for consistent and reproducible image generation.
- Embedded Generation Data: PNG outputs can embed generation parameters in a
stable-diffusion-webui-compatible format. - Active Development: Continuously updated with support for the latest models and features.
Typical Use Cases
- Developers: Integrate powerful diffusion model inference directly into C/C++ applications, game engines, or embedded systems without the overhead of Python dependencies.
- Researchers: Experiment with novel diffusion models and fine-tune parameters on diverse hardware, from powerful workstations to more resource-constrained environments.
- Hobbyists & Creators: Generate high-quality images and videos efficiently on personal computers, including laptops and even mobile devices via Termux, with a focus on performance and ease of use.
- System Integrators: Build custom AI-powered creative tools and pipelines that require reliable and fast diffusion model execution.
