leejet/stable-diffusion.cpp

GitHub Trending (daily) 工具

摘要

一个用于扩散模型的轻量级 C/C++ 推理引擎,支持广泛的图像和视频生成模型,并积极开发,对新发布提供日零支持。

使用纯 C/C++ 进行扩散模型(SD, Flux, Wan, Qwen Image, Z-Image, ...)推理
查看原文
查看缓存全文

缓存时间: 2026/09/24 15:10

leejet/stable-diffusion.cpp

来源:https://github.com/leejet/stable-diffusion.cpp

stable-diffusion.cpp

纯 C/C++ 实现的扩散模型(SD, Flux, Wan 等)推理。 注意:此项目正在积极开发中。API 和命令行选项可能频繁变更。

🔥重要新闻

  • 2026/09/20 🚀 stable-diffusion.cpp 新增 对 Qwen-Image-2.1 的 Day-0 支持
  • 2026/08/20 🚀 stable-diffusion.cpp 现已支持 LTX-2.5
  • 2026/08/04 🚀 stable-diffusion.cpp 新增 对 MiniMax-H3 的 Day-1 支持
  • 2026/06/25 🚀 stable-diffusion.cpp 现已支持 Krea2
  • 2026/06/04 🚀 stable-diffusion.cpp 现已支持 Ideogram4
  • 2026/05/31 🚀 stable-diffusion.cpp 现已支持 PiD
  • 2026/05/27 🚀 stable-diffusion.cpp 现已支持 Lens
  • 2026/05/17 🚀 stable-diffusion.cpp 现已支持 LTX-2.3
  • 2026/04/11 🚀 stable-diffusion.cpp 现已使用全新的内置 Web UI。
  • 2026/01/18 🚀 stable-diffusion.cpp 现已支持 FLUX.2-klein
  • 2025/12/01 🚀 stable-diffusion.cpp 现已支持 Z-Image
  • 2025/11/30 🚀 stable-diffusion.cpp 现已支持 FLUX.2-dev
  • 2025/10/13 🚀 stable-diffusion.cpp 现已支持 Qwen-Image-Edit / Qwen-Image-Edit 2509
  • 2025/10/12 🚀 stable-diffusion.cpp 现已支持 Qwen-Image
  • 2025/09/14 🚀 stable-diffusion.cpp 现已支持 Wan2.1 Vace
  • 2025/09/06 🚀 stable-diffusion.cpp 现已支持 Wan2.1 / Wan2.2

功能特性

快速开始

获取 sd 可执行文件

  • 从 releases 页面 (https://github.com/leejet/stable-diffusion.cpp/releases) 下载预编译二进制文件
  • 或者按照 构建指南 从源代码构建

下载模型权重

  • 下载权重(.ckpt 或 .safetensors 或 .gguf)。例如
    • Stable Diffusion v1.5 来自 https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5
    curl -L -O https://huggingface.co/stable-diffusion-v1-5/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"

有关详细的命令行参数,请查看 cli 文档。

性能

如果您想提升性能或降低 VRAM/RAM 使用量,请参考 性能指南。关于运行时和参数后端放置,请参阅 后端选择指南。

更多指南

绑定

这些项目封装了 stable-diffusion.cpp,以便在其他语言/框架中更轻松地使用。

  • Golang (非 cgo): seasonjs/stable-diffusion (https://github.com/seasonjs/stable-diffusion)
  • Golang (cgo): Binozo/GoStableDiffusion (https://github.com/Binozo/GoStableDiffusion)
  • Golang (非 cgo): l8bloom/gosd (https://github.com/l8bloom/gosd)
  • C#: DarthAffe/StableDiffusion.NET (https://github.com/DarthAffe/StableDiffusion.NET)
  • Python: william-murray1204/stable-diffusion-cpp-python (https://github.com/william-murray1204/stable-diffusion-cpp-python)
  • Rust: newfla/diffusion-rs (https://github.com/newfla/diffusion-rs)
  • Flutter/Dart: rmatif/Local-Diffusion (https://github.com/rmatif/Local-Diffusion)

用户界面

这些项目使用 stable-diffusion.cpp 作为其图像生成的后端。

  • GIMP 插件 (https://github.com/themanyone/gimp-plugins)
  • Jellybox (https://jellybox.com)
  • Stable Diffusion GUI (https://github.com/fszontagh/sd.cpp.gui.wx)
  • Stable Diffusion CLI-GUI (https://github.com/piallai/stable-diffusion.cpp)
  • Local Diffusion (https://github.com/rmatif/Local-Diffusion)
  • sd.cpp-webui (https://github.com/daniandtheweb/sd.cpp-webui)
  • LocalAI (https://github.com/mudler/LocalAI)
  • Neural-Pixel (https://github.com/Luiz-Alcantara/Neural-Pixel)
  • KoboldCpp (https://github.com/LostRuins/koboldcpp)

贡献者

感谢所有已为 stable-diffusion.cpp 做出贡献的人! 贡献者列表 (https://github.com/leejet/stable-diffusion.cpp/graphs/contributors)

相似文章

AUTOMATIC1111/stable-diffusion-webui

GitHub Trending (daily)

该开源项目为 Stable Diffusion 提供了一个功能丰富的 Web 界面,使用户能够借助各种 AI 模型和扩展轻松生成、编辑和放大图像。项目基于 Gradio 构建,支持 txt2img、img2img、inpainting 以及众多由社区驱动的本地 AI 图像生成工具。

将 Nunchaku 4-bit 扩散推理引入 Diffusers

Hugging Face Blog

Nunchaku 是一款基于 SVDQuant 的 4-bit 扩散推理引擎,现已原生集成到 Hugging Face Diffusers 中,通过简单的 from_pretrained() 调用即可快速、节省内存地加载量化扩散模型。

DiffusionGemma

Simon Willison's Blog

Google 发布了 DiffusionGemma,这是一个采用 Apache 2 许可证的开源权重文本生成模型(总参数量 26B,活跃参数量 4B),通过 NVIDIA 的 NIM 云 API 展示了极高的推理速度。

来自NVIDIA的Nemotron-Labs-Diffusion

Reddit r/LocalLLaMA

NVIDIA发布了Nemotron-Labs-Diffusion模型系列(3B至14B),该系列同时支持AR解码和扩散解码,并采用新颖的自推测机制,在多种硬件平台上相比标准AR和Eagle3方法实现了显著加速(最高达4倍)。