Repolode
huggingface

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. 1

    Create a virtual environment and install Diffusers with PyTorch from PyPI

    pip install --upgrade diffusers[torch]
  2. 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