Diffusers
Hugging Face’s Python library for diffusion models.
- Star 数
- 34.7K
- Fork 数
- 7.4K
- 未关闭 Issue
- 1.5K
- 最近提交
- 2026-10-14
数据来自 GitHub API · 更新于 2026-10-15
Diffusers 是什么?
Diffusers is the reference library for running and training diffusion models in Python. Pipelines for Stable Diffusion, FLUX, SD3, video models and audio models load with a single call, with interchangeable schedulers, LoRA loading and memory optimizations such as CPU offload and quantization.
主要功能
- Ready-made pipelines for most open image and video models
- Swappable schedulers and LoRA adapters
- Memory optimizations (offloading, quantization, attention slicing)
- Training scripts for DreamBooth, LoRA and ControlNet
系统要求
- 平台
- Windows · macOS · Linux
- 显卡
- NVIDIA recommended; MPS and CPU supported
- Python
- 3.9+
如何安装 Diffusers
根据项目 README 整理。开源项目更新很快,请以 GitHub 页面上的最新说明为准。
pip
- 1Install the library with PyTorch.
pip install --upgrade diffusers transformers accelerate torch - 2Generate an image in Python.
from diffusers import DiffusionPipeline import torch pipe = DiffusionPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16 ).to("cuda") image = pipe("an astronaut riding a horse on mars").images[0] image.save("astronaut.png")
优势
- Cleanest API for developers
- Supports nearly every open model
不足
- Code-only — no UI
- Requires Python knowledge
Diffusers 替代品对比
| 软件 | Star 数 | 许可证 | 平台 | 显存 |
|---|---|---|---|---|
| Diffusers Hugging Face’s Python library for diffusion models. | 34.7K | Apache-2.0 | — | |
| ComfyUI Node-based interface for diffusion models — images, video and audio. | 137.6K | GPL-3.0 | 4 GB minimum for SD1.5; 12 GB+ recommended for FLUX and video models | |
| FLUX (reference code) Official inference code for Black Forest Labs’ FLUX models. | 26K | Apache-2.0 | 16–24 GB for full precision; less with quantized variants elsewhere | |
| Stability AI Generative Models Stability AI’s reference code for SDXL and Stable Video Diffusion. | 27.3K | MIT | 16 GB+ (more for video) | |
| Stable Diffusion WebUI (AUTOMATIC1111) The classic browser UI for Stable Diffusion with a massive extension ecosystem. | 165.1K | AGPL-3.0 | 4 GB minimum (with --medvram/--lowvram), 8 GB+ recommended | |
| Stable Diffusion WebUI Forge A faster, leaner fork of the A1111 WebUI with FLUX support. | 13.1K | AGPL-3.0 | 6 GB+ (FLUX NF4/GGUF variants run on 6–8 GB) |
相关模型
常见问题
Diffusers 免费吗?
是的——Diffusers 是开源软件,采用 Apache-2.0 许可证。商用前请确认软件及模型权重的许可条款。
Diffusers 支持 Windows、Mac 和 Linux 吗?
Diffusers 支持:Windows, macOS, Linux。
运行 Diffusers 需要什么配置?
NVIDIA recommended; MPS and CPU supported
如何安装 Diffusers?
1. Install the library with PyTorch. 2. Generate an image in Python.
Diffusers 有哪些好的替代品?
常见替代品包括 ComfyUI, FLUX (reference code), Stability AI Generative Models, Stable Diffusion WebUI (AUTOMATIC1111),详见本页对比表。
可以不安装、在线使用 Diffusers 吗?
如果只想要结果,AiLoft 可在浏览器中运行 GPT Image 2.5、Nano Banana Pro 等顶级图像模型,无需显卡和配置。
不想安装?直接在浏览器里生成图片
无需显卡、驱动或 Python。在线使用 GPT Image 2.5 和 Nano Banana Pro,并排对比效果。