patrickvonplaten
commited on
Commit
•
daaf23e
1
Parent(s):
b795ca9
up
Browse files- fantasy_landscape.png +2 -2
- run.py +6 -4
fantasy_landscape.png
CHANGED
Git LFS Details
|
Git LFS Details
|
run.py
CHANGED
@@ -2,12 +2,13 @@ import requests
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
|
|
5 |
|
6 |
-
from diffusers import
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
pipe
|
11 |
|
12 |
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
|
13 |
|
@@ -18,4 +19,5 @@ init_image = init_image.resize((768, 512))
|
|
18 |
prompt = "A fantasy landscape, trending on artstation"
|
19 |
|
20 |
images = pipe(prompt, init_image).images
|
|
|
21 |
images[0].save("fantasy_landscape.png")
|
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
+
import time
|
6 |
|
7 |
+
from diffusers import DiffusionPipeline
|
8 |
|
9 |
+
start_time = time.time()
|
10 |
+
pipe = DiffusionPipeline.from_pretrained("/home/patrick_huggingface_co/stable-diffusion-2-1-unclip", torch_dtype=torch.float16, variant="fp16")
|
11 |
+
pipe.enable_model_cpu_offload()
|
12 |
|
13 |
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
|
14 |
|
|
|
19 |
prompt = "A fantasy landscape, trending on artstation"
|
20 |
|
21 |
images = pipe(prompt, init_image).images
|
22 |
+
print(time.time() - start_time)
|
23 |
images[0].save("fantasy_landscape.png")
|