patrickvonplaten
commited on
Commit
•
04c5ec4
1
Parent(s):
74018bd
up
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- a_magical_dragon.png +0 -3
- a_magical_dragon_himalaya.png +0 -3
- a_magical_forest.png +0 -3
- aaa.png +0 -3
- anime_nyc_guided.png +0 -3
- astronaut_comp_vis_2_ddim.png +0 -3
- astronaut_rides_horse.png +0 -3
- check_sde_ve.png +0 -3
- cifar_tf.png +0 -3
- ddim_0_image.png +0 -3
- ddim_compVis_astronaut.png +0 -3
- ddpm_0_image.png +0 -3
- diffusers/batch_1664287705.png → diffusers_reference/reference_image_sd_v1_3.png +0 -0
- diffusers_reference/run.py +39 -0
- dog_in_the_park.png +0 -3
- eiffel_tower_moon.png +0 -3
- eiffel_tower_on_moon.png +0 -3
- fantasy_landscape.png +0 -3
- fantasy_landscape_default.png +0 -3
- generated_image.png +0 -3
- generated_image_0.png +0 -3
- generated_image_0_new.png +0 -3
- grid-0000.png +0 -3
- grid-0001.png +0 -3
- grid-0004.png +0 -3
- grid-0005.png +0 -3
- grid-0006.png +0 -3
- grid-0007.png +0 -3
- grid-0008.png +0 -3
- grid-0009.png +0 -3
- grid-0010.png +0 -3
- hello.png +0 -3
- hello.txt +0 -0
- hey.png +0 -3
- hf/ddim-celeba-hq/image_0.png +0 -0
- hf/ddim-celeba-hq/image_1.png +0 -0
- hf/ddim-celeba-hq/image_2.png +0 -0
- hf/ddim-celeba-hq/image_3.png +0 -0
- hf/ddim-lsun-bedroom/image_0.png +0 -0
- hf/ddim-lsun-bedroom/image_1.png +0 -0
- hf/ddim-lsun-bedroom/image_2.png +0 -0
- hf/ddim-lsun-bedroom/image_3.png +0 -0
- hf/ddim-lsun-church/image_0.png +0 -0
- hf/ddim-lsun-church/image_1.png +0 -0
- hf/ddim-lsun-church/image_2.png +0 -0
- hf/ddim-lsun-church/image_3.png +0 -0
- hf/ddpm-celeba-hq-ema/image_0.png +0 -0
- hf/ddpm-celeba-hq-ema/image_1.png +0 -0
- hf/ddpm-celeba-hq-ema/image_2.png +0 -0
- hf/ddpm-celeba-hq-ema/image_3.png +0 -0
a_magical_dragon.png
DELETED
Git LFS Details
|
a_magical_dragon_himalaya.png
DELETED
Git LFS Details
|
a_magical_forest.png
DELETED
Git LFS Details
|
aaa.png
DELETED
Git LFS Details
|
anime_nyc_guided.png
DELETED
Git LFS Details
|
astronaut_comp_vis_2_ddim.png
DELETED
Git LFS Details
|
astronaut_rides_horse.png
DELETED
Git LFS Details
|
check_sde_ve.png
DELETED
Git LFS Details
|
cifar_tf.png
DELETED
Git LFS Details
|
ddim_0_image.png
DELETED
Git LFS Details
|
ddim_compVis_astronaut.png
DELETED
Git LFS Details
|
ddpm_0_image.png
DELETED
Git LFS Details
|
diffusers/batch_1664287705.png → diffusers_reference/reference_image_sd_v1_3.png
RENAMED
File without changes
|
diffusers_reference/run.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
#!/usr/bin/env python3
|
3 |
+
from diffusers import StableDiffusionPipeline, DDIMScheduler
|
4 |
+
from time import time
|
5 |
+
from PIL import Image
|
6 |
+
from einops import rearrange
|
7 |
+
import numpy as np
|
8 |
+
import torch
|
9 |
+
from torch import autocast
|
10 |
+
from torchvision.utils import make_grid
|
11 |
+
|
12 |
+
torch.manual_seed(42)
|
13 |
+
|
14 |
+
prompts = ["a photograph of an astronaut riding a horse"]
|
15 |
+
|
16 |
+
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-3", revision="fp16", torch_dtype=torch.float16, use_auth_token=True) # make sure you're logged in with `huggingface-cli login`
|
17 |
+
#scheduler = DDIMScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", clip_sample=False, set_alpha_to_one=False)
|
18 |
+
#pipe.scheduler = scheduler
|
19 |
+
pipe.to("cuda")
|
20 |
+
|
21 |
+
all_images = []
|
22 |
+
num_rows = 1
|
23 |
+
num_columns = 4
|
24 |
+
for prompt in prompts:
|
25 |
+
with autocast("cuda"):
|
26 |
+
images = pipe(num_columns * [prompt], guidance_scale=7.5, output_type="np")["sample"] # image here is in [PIL format](https://pillow.readthedocs.io/en/stable/)
|
27 |
+
all_images.append(torch.from_numpy(images))
|
28 |
+
|
29 |
+
# additionally, save as grid
|
30 |
+
grid = torch.stack(all_images, 0)
|
31 |
+
grid = rearrange(grid, 'n b h w c -> (n b) h w c')
|
32 |
+
grid = rearrange(grid, 'n h w c -> n c h w')
|
33 |
+
grid = make_grid(grid, nrow=num_rows)
|
34 |
+
|
35 |
+
# to image
|
36 |
+
grid = 255. * rearrange(grid, 'c h w -> h w c').cpu().numpy()
|
37 |
+
image = Image.fromarray(grid.astype(np.uint8))
|
38 |
+
|
39 |
+
image.save(f"../images/diffusers/batch_{round(time())}.png")
|
dog_in_the_park.png
DELETED
Git LFS Details
|
eiffel_tower_moon.png
DELETED
Git LFS Details
|
eiffel_tower_on_moon.png
DELETED
Git LFS Details
|
fantasy_landscape.png
DELETED
Git LFS Details
|
fantasy_landscape_default.png
DELETED
Git LFS Details
|
generated_image.png
DELETED
Git LFS Details
|
generated_image_0.png
DELETED
Git LFS Details
|
generated_image_0_new.png
DELETED
Git LFS Details
|
grid-0000.png
DELETED
Git LFS Details
|
grid-0001.png
DELETED
Git LFS Details
|
grid-0004.png
DELETED
Git LFS Details
|
grid-0005.png
DELETED
Git LFS Details
|
grid-0006.png
DELETED
Git LFS Details
|
grid-0007.png
DELETED
Git LFS Details
|
grid-0008.png
DELETED
Git LFS Details
|
grid-0009.png
DELETED
Git LFS Details
|
grid-0010.png
DELETED
Git LFS Details
|
hello.png
DELETED
Git LFS Details
|
hello.txt
DELETED
File without changes
|
hey.png
DELETED
Git LFS Details
|
hf/ddim-celeba-hq/image_0.png
DELETED
Binary file (101 kB)
|
|
hf/ddim-celeba-hq/image_1.png
DELETED
Binary file (106 kB)
|
|
hf/ddim-celeba-hq/image_2.png
DELETED
Binary file (90.8 kB)
|
|
hf/ddim-celeba-hq/image_3.png
DELETED
Binary file (66.3 kB)
|
|
hf/ddim-lsun-bedroom/image_0.png
DELETED
Binary file (81.8 kB)
|
|
hf/ddim-lsun-bedroom/image_1.png
DELETED
Binary file (94.1 kB)
|
|
hf/ddim-lsun-bedroom/image_2.png
DELETED
Binary file (80 kB)
|
|
hf/ddim-lsun-bedroom/image_3.png
DELETED
Binary file (85.7 kB)
|
|
hf/ddim-lsun-church/image_0.png
DELETED
Binary file (95.9 kB)
|
|
hf/ddim-lsun-church/image_1.png
DELETED
Binary file (144 kB)
|
|
hf/ddim-lsun-church/image_2.png
DELETED
Binary file (104 kB)
|
|
hf/ddim-lsun-church/image_3.png
DELETED
Binary file (170 kB)
|
|
hf/ddpm-celeba-hq-ema/image_0.png
DELETED
Binary file (67.1 kB)
|
|
hf/ddpm-celeba-hq-ema/image_1.png
DELETED
Binary file (74.7 kB)
|
|
hf/ddpm-celeba-hq-ema/image_2.png
DELETED
Binary file (79.7 kB)
|
|
hf/ddpm-celeba-hq-ema/image_3.png
DELETED
Binary file (88.8 kB)
|
|