Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -165,13 +165,13 @@ def main():
|
|
165 |
global dtype
|
166 |
|
167 |
device = "cuda"
|
168 |
-
dtype = torch.
|
169 |
result=[]
|
170 |
step = 2
|
171 |
|
172 |
base = "stabilityai/stable-diffusion-xl-base-1.0"
|
173 |
repo = "ByteDance/SDXL-Lightning"
|
174 |
-
ckpt = "
|
175 |
|
176 |
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
177 |
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
|
@@ -182,7 +182,7 @@ def main():
|
|
182 |
adapter = MotionAdapter().to(device, dtype)
|
183 |
adapter.load_state_dict(load_file(hf_hub_download(repo ,ckpt), device=device))
|
184 |
|
185 |
-
pipe = AnimateDiffPipeline.from_pretrained(base, motion_adapter=adapter, unet=unet, torch_dtype=dtype, variant="fp16").to(device, dtype
|
186 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
|
187 |
|
188 |
mp.set_start_method("spawn", force=True)
|
|
|
165 |
global dtype
|
166 |
|
167 |
device = "cuda"
|
168 |
+
dtype = torch.bfloat16
|
169 |
result=[]
|
170 |
step = 2
|
171 |
|
172 |
base = "stabilityai/stable-diffusion-xl-base-1.0"
|
173 |
repo = "ByteDance/SDXL-Lightning"
|
174 |
+
ckpt = f"sdxl_lightning_{step}step_unet.safetensors"
|
175 |
|
176 |
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
177 |
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
|
|
|
182 |
adapter = MotionAdapter().to(device, dtype)
|
183 |
adapter.load_state_dict(load_file(hf_hub_download(repo ,ckpt), device=device))
|
184 |
|
185 |
+
pipe = AnimateDiffPipeline.from_pretrained(base, motion_adapter=adapter, unet=unet, torch_dtype=dtype, variant="fp16").to(device=device, dtype=dtype)
|
186 |
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
|
187 |
|
188 |
mp.set_start_method("spawn", force=True)
|