Hugging Face Diffusers
🤗 Diffusers
The library of pretrained diffusion models for generating images, audio and video, with swappable generation pipelines and schedulers.
Basic information
| Name | Hugging Face Diffusers |
|---|---|
| Full name | 🤗 Diffusers |
| Category | Generative AI |
| Developer | Hugging Face |
| Release year | Not specified |
| Official website | github.com/huggingface/diffusers |
| GitHub repository | huggingface/diffusers |
| Official documentation | Not specified |
| Package on PyPI | diffusers |
| License | Apache-2.0 (PyPI license) |
| Project status | Active Had a release in the last 12 months |
| Latest version | 12 November 2026 (version 0.43.0) |
| Programming language | Python |
| Operating systems | OS Independent (as declared by the package on PyPI) |
| Required Python version | >=3.11.0 |
| Difficulty level | Medium |
Data last checked: 21 November 2026 — source: PyPI JSON API (2026-11-21)
Overview
Diffusers separates ready-made pipelines, models (UNet and Transformers) and schedulers, so each part can be swapped. It supports Stable Diffusion and other models published on the Hub, and fine-tuning through LoRA and DreamBooth.
Running large models needs a GPU with enough memory, and model licenses vary from model to model, so check each model's card.
When to choose it? Choose it to generate images programmatically and to try and fine-tune diffusion models.
Uses
Main uses
- Text-to-image generation
- Image editing and inpainting
- Fine-tuning with LoRA
- Teaching diffusion models
Scientific fields
- Generative AI
- Design
- Research
Suitable project types
- An image generator with a custom style
Research applications
- Experiments with diffusion schedulers and architectures
Technical features
A feature is shown as "Supported" only if it is documented in the library's official documentation; anything we have not verified is shown as "Not specified".
| CPU support | SupportedPossible but very slow for large models. |
|---|---|
| GPU support | Supported |
| CUDA compatibility | Supported |
| Distributed training or computing | Partial or through an add-on |
| Automatic differentiation (Autodiff) | SupportedThrough PyTorch. |
| Model deployment | Partial or through an add-on |
| Pre-trained models | Supported |
| Supported data types | Images, text, audio, tensors |
| Integration with other libraries | PyTorch, Hugging Face Transformers, PEFT |
| Flexibility (editorial estimate) | High |
| Performance (editorial estimate) | Depends on the GPU |
| Community (editorial estimate) | Large |
| Documentation quality (editorial estimate) | Excellent documentation |
Installation and running
pip install diffusersCompatibility: Python >=3.11.0 — according to the package data on PyPI, checked on 21 November 2026
Installing inside a virtual environment (venv or conda) is recommended. If you need compatibility with a specific CUDA version or operating system, refer to the official documentation, because this information changes with every release.
Code examples
Examples marked "Run and tested" were actually run, with their output, test date and library versions recorded; the others need a GPU or model downloads, so they were not run in the test environment.
MediumGenerating an image from text with DiffusersNot run
Goal: Loading a diffusion pipeline and generating an image.
import torch
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-base", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
image = pipe("a watercolor painting of a robot reading a book", num_inference_steps=25).images[0]
image.save("robot.png")
Code explanation
DiffusionPipeline.from_pretrained loads all the model's components (the text encoder, the U-Net, the scheduler and the decoder). It needs a GPU with enough memory and a download of several gigabytes, and some models require accepting their license on Hugging Face. Not run in the test environment.
This example was not run in the test environment: needs a GPU and a download of the model weights. Check it against the library documentation before relying on it.
ResearchThe forward diffusion process with a DDPM schedulerRun and tested
Goal: Seeing how the scheduler adds noise gradually, as in the DDPM paper.
import torch
from diffusers import DDPMScheduler
torch.manual_seed(0)
sched = DDPMScheduler(num_train_timesteps=1000, beta_schedule="linear")
x0 = torch.randn(1, 3, 32, 32)
noise = torch.randn_like(x0)
for t in [0, 250, 500, 999]:
xt = sched.add_noise(x0, noise, torch.tensor([t]))
corr = torch.corrcoef(torch.stack([x0.flatten(), xt.flatten()]))[0, 1].item()
print(f"t={t:4d} sqrt(alpha_bar)={sched.alphas_cumprod[t].sqrt().item():.4f} corr(x0,xt)={corr:.3f}")
Code explanation
DDPMScheduler computes the β schedule and the ᾱ_t coefficients. The add_noise function applies x_t = √ᾱ_t·x₀ + √(1−ᾱ_t)·ε. We measure how much of the original signal remains at different steps; this part needs no trained weights.
Output recorded during testing
t= 0 sqrt(alpha_bar)=0.9999 corr(x0,xt)=1.000 t= 250 sqrt(alpha_bar)=0.7221 corr(x0,xt)=0.728 t= 500 sqrt(alpha_bar)=0.2789 corr(x0,xt)=0.293 t= 999 sqrt(alpha_bar)=0.0064 corr(x0,xt)=0.022
This example was actually run and tested on 21 November 2026 on a CPU — diffusers 0.43.0, torch 2.15.0, python 3.13.18
Pros
- A clear modular design
- Many models on the Hub
Limitations
- Needs a powerful GPU for large models
- Model licenses differ
References and verification
- Package page on PyPI (source of the version, licence and release date) Checked directly
https://pypi.org/project/diffusers/
Checked on: 21 November 2026 — version checked: 0.43.0 — reviewed by: the DLArabic team
- Official website A link the package officially declares on PyPI
https://github.com/huggingface/diffusers
Checked on: 21 November 2026 — reviewed by: the DLArabic team
- Official repository A link the package officially declares on PyPI
https://github.com/huggingface/diffusers
Checked on: 21 November 2026 — reviewed by: the DLArabic team
History of verified versions
| Version | Release date | Checked on |
|---|---|---|
| 0.43.0 | 12 November 2026 | 21 November 2026 |
Page information last reviewed: 21 November 2026. The description was written originally for the encyclopedia and is not copied from the official websites.
