patrickvonplaten
commited on
Commit
•
c4e9027
1
Parent(s):
5026aca
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
---
|
3 |
+
license: apache-2.0
|
4 |
+
tags:
|
5 |
+
- pytorch
|
6 |
+
- diffusers
|
7 |
+
- unconditional-image-generation
|
8 |
+
---
|
9 |
+
|
10 |
+
# Denoising Diffusion Probabilistic Models (DDPM)
|
11 |
+
|
12 |
+
**Paper**: [Denoising Diffusion Probabilistic Models](https://arxiv.org/abs/2006.11239)
|
13 |
+
|
14 |
+
**Abstract**:
|
15 |
+
|
16 |
+
*We present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models inspired by considerations from nonequilibrium thermodynamics. Our best results are obtained by training on a weighted variational bound designed according to a novel connection between diffusion probabilistic models and denoising score matching with Langevin dynamics, and our models naturally admit a progressive lossy decompression scheme that can be interpreted as a generalization of autoregressive decoding. On the unconditional CIFAR10 dataset, we obtain an Inception score of 9.46 and a state-of-the-art FID score of 3.17. On 256x256 LSUN, we obtain sample quality similar to ProgressiveGAN.*
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
|
20 |
+
```python
|
21 |
+
# !pip install diffusers
|
22 |
+
from diffusers import DiffusionPipeline
|
23 |
+
import PIL.Image
|
24 |
+
import numpy as np
|
25 |
+
|
26 |
+
model_id = "google/ddpm-celeba-hq"
|
27 |
+
|
28 |
+
# load model and scheduler
|
29 |
+
ddpm = DiffusionPipeline.from_pretrained(model_id)
|
30 |
+
|
31 |
+
# run pipeline in inference (sample random noise and denoise)
|
32 |
+
image = ddpm()
|
33 |
+
|
34 |
+
# process image to PIL
|
35 |
+
image_processed = image.cpu().permute(0, 2, 3, 1)
|
36 |
+
image_processed = (image_processed + 1.0) * 127.5
|
37 |
+
image_processed = image_processed.numpy().astype(np.uint8)
|
38 |
+
image_pil = PIL.Image.fromarray(image_processed[0])
|
39 |
+
|
40 |
+
# save image
|
41 |
+
image_pil.save("test.png")
|
42 |
+
```
|
43 |
+
|
44 |
+
## Samples
|
45 |
+
|
46 |
+
TODO ...
|