File size: 730 Bytes
0bd77de 9d0c1f2 0bd77de 9d0c1f2 dc14b11 9d0c1f2 dc14b11 9d0c1f2 c9de2e1 a09a880 dc14b11 9d0c1f2 dc14b11 9d0c1f2 |
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 |
---
tags:
- hf_diffuse
---
# Dummy diffusion model following architecture of https://github.com/lucidrains/denoising-diffusion-pytorch
Run the model as follows:
```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)
``` |