Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -18,19 +18,29 @@ from safetensors.torch import load_file
|
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
dtype = torch.float16
|
20 |
|
21 |
-
step =
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
adapter = MotionAdapter.
|
|
|
25 |
|
26 |
pipe = AnimateDiffPipeline.from_pretrained(
|
27 |
-
model_id,
|
28 |
-
,
|
|
|
29 |
)
|
|
|
30 |
scheduler = DDIMScheduler.from_pretrained(
|
31 |
-
model_id,
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
)
|
|
|
34 |
pipe.scheduler = scheduler
|
35 |
pipe.enable_vae_slicing()
|
36 |
pipe.enable_vae_tiling()
|
|
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
dtype = torch.float16
|
20 |
|
21 |
+
step = 2
|
22 |
+
repo = "ByteDance/AnimateDiff-Lightning"
|
23 |
+
ckpt = f"animatediff_lightning_{step}step_diffusers.safetensors"
|
24 |
+
model_id = "black-forest-labs/FLUX.1-schnell"
|
25 |
|
26 |
+
adapter = MotionAdapter().to(device, dtype)
|
27 |
+
adapter.load_state_dict(load_file(hf_hub_download(repo ,ckpt), device=device))
|
28 |
|
29 |
pipe = AnimateDiffPipeline.from_pretrained(
|
30 |
+
model_id,
|
31 |
+
motion_adapter=adapter,
|
32 |
+
token=os.getenv("hf_token")
|
33 |
)
|
34 |
+
|
35 |
scheduler = DDIMScheduler.from_pretrained(
|
36 |
+
model_id,
|
37 |
+
subfolder="scheduler",
|
38 |
+
clip_sample=False,
|
39 |
+
timestep_spacing="linspace",
|
40 |
+
steps_offset=1,
|
41 |
+
token=os.getenv("hf_token")
|
42 |
)
|
43 |
+
|
44 |
pipe.scheduler = scheduler
|
45 |
pipe.enable_vae_slicing()
|
46 |
pipe.enable_vae_tiling()
|