Open-source codebase for efficient high-resolution image and video generation using linear diffusion transformers, with training and inference pipelines.
huggingface/diffusers
A PyTorch library of pretrained diffusion models, noise schedulers and building blocks for image, video and audio generation.
Open-source alternative to:Midjourney
- Stars
- 34,771
- Forks
- 7,411
- Open issues
- 1,507
- Last commit
- 9 hours ago
What is it?
Diffusers is a Hugging Face library for running and training diffusion models. Its pipelines let you load a pretrained checkpoint from the Hugging Face Hub with a few lines of code and generate outputs from text, images or video inputs. Interchangeable noise schedulers control the trade-off between generation speed and output quality.
Beyond ready-made pipelines, the library exposes pretrained models such as UNets and transformers as modular components that can be combined with schedulers to build custom diffusion systems. It is designed for both inference and training, with guides covering loading, optimization for speed and memory, and training techniques for different tasks.
The library is written in Python on top of PyTorch and is installable from PyPI or conda-forge. It supports common tasks including text-to-image, image-to-image, inpainting, super-resolution, text-to-video and unconditional image generation.
Key features
- 01Pipelines load pretrained diffusion checkpoints from the Hugging Face Hub in a few lines of code.
- 02Interchangeable noise schedulers trade off generation speed against output quality.
- 03Pretrained models can be combined with schedulers to build custom diffusion systems.
- 04Covers text-to-image, image-to-image, inpainting, super-resolution and text-to-video tasks.
- 05Includes guides for inference optimization and training diffusion models.
Use cases
- Generating images from text prompts with Stable Diffusion or Flux checkpoints.
- Building a custom diffusion pipeline from individual models and schedulers.
- Training or fine-tuning a diffusion model for a specific image or video task.
- Adding image editing features such as inpainting or image-to-image to an application.
Quick start
- 1
Create a virtual environment and install Diffusers with PyTorch from PyPI
pip install --upgrade diffusers[torch] - 2
Load a pretrained pipeline and generate an image from text in Python
from diffusers import DiffusionPipeline
Things to know
- Generating images with the example models needs a GPU for practical speed.
- Large pretrained checkpoints must be downloaded from the Hugging Face Hub, which takes significant disk space.
Topics
FAQ
- What is diffusers?
- A PyTorch library of pretrained diffusion models, noise schedulers and building blocks for image, video and audio generation. Diffusers is a Hugging Face library for running and training diffusion models. Its pipelines let you load a pretrained checkpoint from the Hugging Face Hub with a few lines of code and generate outputs from text, images or video inputs. Interchangeable noise schedulers control the trade-off between generation speed and output quality.
- Is diffusers free to use? What license does it have?
- diffusers is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is diffusers still maintained?
- Actively maintained. The last commit to diffusers was on Oct 20, 2026.
- What can I use diffusers for?
- Generating images from text prompts with Stable Diffusion or Flux checkpoints. Building a custom diffusion pipeline from individual models and schedulers. Training or fine-tuning a diffusion model for a specific image or video task. Adding image editing features such as inpainting or image-to-image to an application.
- How do I install diffusers?
- Create a virtual environment and install Diffusers with PyTorch from PyPI: pip install --upgrade diffusers[torch] Load a pretrained pipeline and generate an image from text in Python: from diffusers import DiffusionPipeline
- Where can I get diffusers?
- The source code and installation instructions are on GitHub: https://github.com/huggingface/diffusers
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An open-source Diffusion model engine for image, video, and audio generation, with low-VRAM inference and training support.
A Gradio-based web UI for running Stable Diffusion and newer image/video models, continuing the Forge fork with added model support and optimizations.
Open-source 5B-parameter text-to-image diffusion model focused on accurate text rendering, JSON layout control, and fine-tuning.
A node-graph GUI, API and backend for running diffusion models locally to generate images, video, audio and 3D content.
A web-based creative engine for generating and editing images with Stable Diffusion and other AI models, featuring a unified canvas and node-based workflows.