Update README.md
Browse files
README.md
CHANGED
@@ -4,5 +4,29 @@ datasets:
|
|
4 |
library_name: diffusers
|
5 |
pipeline_tag: unconditional-image-generation
|
6 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |

|
|
|
4 |
library_name: diffusers
|
5 |
pipeline_tag: unconditional-image-generation
|
6 |
---
|
7 |
+
```python
|
8 |
+
# !pip install diffusers
|
9 |
+
from diffusers import DiffusionPipeline
|
10 |
+
import torch
|
11 |
+
|
12 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
13 |
+
model_id = "eurecom-ds/scoresdeve-ema-multi-dsprites-64"
|
14 |
+
|
15 |
+
# load model and scheduler
|
16 |
+
pipe = DiffusionPipeline.from_pretrained(model_idm, trust_remote_code=True)
|
17 |
+
pipe.to(device)
|
18 |
+
|
19 |
+
|
20 |
+
# run pipeline in inference (sample random noise and denoise)
|
21 |
+
generator = torch.Generator(device=device).manual_seed(0)
|
22 |
+
image = pipe(
|
23 |
+
batch_size=1,
|
24 |
+
num_inference_steps=1000
|
25 |
+
).images
|
26 |
+
|
27 |
+
|
28 |
+
# save image
|
29 |
+
image[0].save("sde_ve_generated_image.png")
|
30 |
+
```
|
31 |
|
32 |

|