You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-31Lines changed: 48 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,17 +74,18 @@ You need to accept the model license before downloading or using the Stable Diff
74
74
75
75
### Text-to-Image generation with Stable Diffusion
76
76
77
+
We recommend using the model in [half-precision (`fp16`)](https://pytorch.org/blog/accelerating-training-on-nvidia-gpus-with-pytorch-automatic-mixed-precision/) as it gives almost always the same results as full
78
+
precision while being roughly twice as fast and requiring half the amount of GPU RAM.
79
+
77
80
```python
78
81
# make sure you're logged in with `huggingface-cli login`
-[Unconditional Diffusion with discrete scheduler](https://huggingface.co/google/ddpm-celebahq-256)
280
286
```python
281
287
# !pip install diffusers
282
-
from torch import autocast
283
288
from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline
284
289
285
290
model_id ="google/ddpm-celebahq-256"
@@ -290,8 +295,7 @@ ddpm = DDPMPipeline.from_pretrained(model_id) # you can replace DDPMPipeline wi
290
295
ddpm.to(device)
291
296
292
297
# run pipeline in inference (sample random noise and denoise)
293
-
with autocast("cuda"):
294
-
image = ddpm().images[0]
298
+
image = ddpm().images[0]
295
299
296
300
# save image
297
301
image.save("ddpm_generated_image.png")
@@ -377,3 +381,16 @@ This library concretizes previous work by many different authors and would not h
377
381
-@yang-song's Score-VE and Score-VP implementations, available [here](https://github.com/yang-song/score_sde_pytorch)
378
382
379
383
We also want to thank @heejkoo for the very helpful overview of papers, code and resources on diffusion models, available [here](https://github.com/heejkoo/Awesome-Diffusion-Models) as well as @crowsonkb and @rromb for useful discussions and insights.
384
+
385
+
## Citation
386
+
387
+
```bibtex
388
+
@misc{von-platen-etal-2022-diffusers,
389
+
author = {Patrick von Platen and Suraj Patil and Anton Lozhkov and Pedro Cuenca and Nathan Lambert and Kashif Rasul and Mishig Davaadorj and Thomas Wolf},
390
+
title = {Diffusers: State-of-the-art diffusion models},
0 commit comments