patrickvonplaten
commited on
Commit
•
dc14b11
1
Parent(s):
0bd77de
Update README.md
Browse files
README.md
CHANGED
@@ -11,11 +11,20 @@ Run the model as follows:
|
|
11 |
from diffusers import UNetModel, GaussianDiffusion
|
12 |
import torch
|
13 |
|
14 |
-
|
|
|
15 |
|
|
|
16 |
batch_size, num_channels, height, width = 1, 3, 32, 32
|
17 |
dummy_noise = torch.ones((batch_size, num_channels, height, width))
|
18 |
time_step = torch.tensor([10])
|
|
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
```
|
11 |
from diffusers import UNetModel, GaussianDiffusion
|
12 |
import torch
|
13 |
|
14 |
+
# 1. Load model
|
15 |
+
unet = UNetModel.from_pretrained("fusing/ddpm_dummy")
|
16 |
|
17 |
+
# 2. Do one denoising step with model
|
18 |
batch_size, num_channels, height, width = 1, 3, 32, 32
|
19 |
dummy_noise = torch.ones((batch_size, num_channels, height, width))
|
20 |
time_step = torch.tensor([10])
|
21 |
+
image = unet(dummy_noise, time_step)
|
22 |
|
23 |
+
# 3. Load sampler
|
24 |
+
sampler = GaussianDiffusion.from_config("fusing/ddpm_dummy")
|
25 |
+
|
26 |
+
# 4. Sample image from sampler passing the model
|
27 |
+
image = sampler.sample(model, batch_size=1)
|
28 |
+
|
29 |
+
print(image)
|
30 |
```
|