From f1ac67a02b0e15cd9c0f65f4912e9c67a6032a07 Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Tue, 8 Nov 2022 14:43:34 +0100 Subject: [PATCH 1/2] Add link to `diffusers` library --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index ad4d6b7..f2faa3c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,37 @@ The prefix should be passed into the scripts using the `--bucket_name_prefix` fl Models and samples can be found at: https://www.dropbox.com/sh/pm6tn31da21yrx4/AABWKZnBzIROmDjGxpB6vn6Ja +## **Integration with 🤗 Diffusers library in PyTorch** + +If you are looking for a PyTorch version for DDPM, you can check out the [Diffusers library](https://huggingface.co/docs/diffusers/api/pipelines/ddpm). +You can install diffusers as follows: + +``` +pip install diffusers torch accelerate +``` + +And then try out the model with just a couple lines of code: + +```python +from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline + +model_id = "google/ddpm-cifar10-32" + +# load model and scheduler +ddpm = DDPMPipeline.from_pretrained(model_id) # you can replace DDPMPipeline with DDIMPipeline or PNDMPipeline for faster inference + +# run pipeline in inference (sample random noise and denoise) +image = ddpm().images[0] + +# save image +image.save("ddpm_generated_image.png") +``` + +More DDPM models can be found directly [on the Hub](https://huggingface.co/models?library=diffusers&sort=downloads&search=ddpm) + +To better understand DDPM, you can check out [this introductionary google colab](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/diffusers_intro.ipynb) +To train your own DDPM from scratch, feel free to have a look at [unconditional_image_generation](https://github.com/huggingface/diffusers/tree/main/examples/unconditional_image_generation) + ## Citation If you find our work relevant to your research, please cite: ``` From 7ec2aa102c33e87beb1ba0ba623eaf214b41fe3c Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Tue, 8 Nov 2022 14:54:21 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f2faa3c..80a8fb9 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,7 @@ pip install diffusers torch accelerate And then try out the model with just a couple lines of code: ```python -from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline - +from diffusers import DDPMPipeline model_id = "google/ddpm-cifar10-32" # load model and scheduler