File size: 1,709 Bytes
5d114a6
 
 
 
 
 
 
 
 
8c5f1a2
 
 
d63dc1f
8c5f1a2
0bae41a
8c5f1a2
d7a8807
8c5f1a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97d2cf7
8c5f1a2
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: README
emoji: 📉
colorFrom: green
colorTo: purple
sdk: static
pinned: false
---

<div class="flex justify-center">
    <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/diffusers-org-logo.png"/>
</div>

[Diffusers](https://github.com/huggingface/diffusers) is a library of state-of-the-art pretrained diffusion models for *all* of your generative AI needs and use cases.

The library provides three main classes.

1. The [Pipeline](https://hf.co/docs/diffusers/api/pipelines/overview) class provides an easy and unified way to perform inference with many models.

```py
import torch
from diffusers import FluxPipeline

pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
pipeline.enable_model_cpu_offload()

prompt = "A cat holding a sign that says hello world"
image = pipeline(prompt, guidance_scale=0.0, output_type="pil", num_inference_steps=4, max_sequence_length=256, generator=torch.Generator("cpu").manual_seed(33)).images[0]
image.save("flux-schnell.png")
```

2. Diffusers also provides [models](https://hf.co/docs/diffusers/api/models/overview) and [schedulers](https://hf.co/docs/diffusers/api/schedulers/overview) that you can mix and match to build or train your own diffusion systems.

In addition to these classes, Diffusers is invested in lowering the barrier for everyone. The library is optimized to run on memory-constrained hardware, accelerate inference on PyTorch, hardware (GPU/CPU/TPUs), and model accelerators.

Visit the [documentation](https://hf.co/docs/diffusers/index) if you're interested in learning more. We're excited to see what you create with Diffusers! 🤗