Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
180473b
1
Parent(s):
a82b9d6
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ import requests
|
|
22 |
import diffusers
|
23 |
from diffusers.utils import load_image
|
24 |
from diffusers.models import ControlNetModel
|
25 |
-
from diffusers import AutoencoderKL, DPMSolverMultistepScheduler
|
26 |
import cv2
|
27 |
import torch
|
28 |
import numpy as np
|
@@ -129,7 +129,16 @@ et = time.time()
|
|
129 |
elapsed_time = et - st
|
130 |
print('Loading VAE took: ', elapsed_time, 'seconds')
|
131 |
st = time.time()
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
vae=vae,
|
134 |
controlnet=[identitynet, zoedepthnet],
|
135 |
torch_dtype=torch.float16)
|
|
|
22 |
import diffusers
|
23 |
from diffusers.utils import load_image
|
24 |
from diffusers.models import ControlNetModel
|
25 |
+
from diffusers import AutoencoderKL, DPMSolverMultistepScheduler, UNet2DConditionModel
|
26 |
import cv2
|
27 |
import torch
|
28 |
import numpy as np
|
|
|
129 |
elapsed_time = et - st
|
130 |
print('Loading VAE took: ', elapsed_time, 'seconds')
|
131 |
st = time.time()
|
132 |
+
|
133 |
+
base = "stabilityai/stable-diffusion-xl-base-1.0"
|
134 |
+
repo = "ByteDance/SDXL-Lightning"
|
135 |
+
ckpt = "sdxl_lightning_4step_unet.safetensors"
|
136 |
+
|
137 |
+
# Load model.
|
138 |
+
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
139 |
+
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
|
140 |
+
pipe = StableDiffusionXLInstantIDImg2ImgPipeline.from_pretrained(base,
|
141 |
+
unet=unet,
|
142 |
vae=vae,
|
143 |
controlnet=[identitynet, zoedepthnet],
|
144 |
torch_dtype=torch.float16)
|