From 6d4879c2e3d473b97b8dfe82912c2a1ca660be1c Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Thu, 2 Jun 2022 00:42:08 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 470b64fd96..820259bdcb 100644 --- a/README.md +++ b/README.md @@ -1 +1,39 @@ -Super cool library about diffusion models +# Diffusers + +## Library structure: + +``` +├── models +│   ├── dalle2 +│   │   ├── modeling_dalle2.py +│   │   ├── README.md +│   │   └── run_dalle2.py +│   ├── ddpm +│   │   ├── modeling_ddpm.py +│   │   ├── README.md +│   │   └── run_ddpm.py +│   ├── glide +│   │   ├── modeling_glide.py +│   │   ├── README.md +│   │   └── run_dalle2.py +│   ├── imagen +│   │   ├── modeling_dalle2.py +│   │   ├── README.md +│   │   └── run_dalle2.py +│   └── latent_diffusion +│   ├── modeling_latent_diffusion.py +│   ├── README.md +│   └── run_latent_diffusion.py +├── src +│   └── diffusers +│   ├── configuration_utils.py +│   ├── __init__.py +│   ├── modeling_utils.py +│   ├── models +│   │   └── unet.py +│   ├── processors +│   └── samplers +│   ├── gaussian.py +├── tests +│   └── test_modeling_utils.py +``` From 2894be2a4fd021d99333b404d9990b3905636720 Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Thu, 2 Jun 2022 00:42:43 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 820259bdcb..6c76122215 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,26 @@ ├── tests │   └── test_modeling_utils.py ``` + +## Dummy Example +```python +from diffusers import UNetModel, GaussianDiffusion +import torch + +# 1. Load model +unet = UNetModel.from_pretrained("fusing/ddpm_dummy") + +# 2. Do one denoising step with model +batch_size, num_channels, height, width = 1, 3, 32, 32 +dummy_noise = torch.ones((batch_size, num_channels, height, width)) +time_step = torch.tensor([10]) +image = unet(dummy_noise, time_step) + +# 3. Load sampler +sampler = GaussianDiffusion.from_config("fusing/ddpm_dummy") + +# 4. Sample image from sampler passing the model +image = sampler.sample(model, batch_size=1) + +print(image) +```