Spaces:
Running
on
Zero
Running
on
Zero
Update optimization.py
Browse files- optimization.py +14 -13
optimization.py
CHANGED
@@ -43,21 +43,22 @@ def optimize_pipeline_(pipeline: Callable[P, Any], *args: P.args, **kwargs: P.kw
|
|
43 |
@spaces.GPU(duration=1500)
|
44 |
def compile_transformer():
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
adapter_name="
|
50 |
)
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
adapter_name="
|
57 |
)
|
58 |
-
|
59 |
-
|
60 |
-
pipeline.fuse_lora(adapter_names=["
|
|
|
61 |
pipeline.unload_lora_weights()
|
62 |
|
63 |
with capture_component_call(pipeline, 'transformer') as call:
|
|
|
43 |
@spaces.GPU(duration=1500)
|
44 |
def compile_transformer():
|
45 |
|
46 |
+
pipe.load_lora_weights(
|
47 |
+
"Kijai/WanVideo_comfy",
|
48 |
+
weight_name="Wan22-Lightning/Wan2.2-Lightning_T2V-A14B-4steps-lora_HIGH_fp16.safetensors",
|
49 |
+
adapter_name="lightning"
|
50 |
)
|
51 |
+
kwargs = {}
|
52 |
+
kwargs["load_into_transformer_2"] = True
|
53 |
+
pipe.load_lora_weights(
|
54 |
+
"Kijai/WanVideo_comfy",
|
55 |
+
weight_name="Wan22-Lightning/Wan2.2-Lightning_T2V-A14B-4steps-lora_LOW_fp16.safetensors",
|
56 |
+
adapter_name="lightning_2", **kwargs
|
57 |
)
|
58 |
+
pipe.set_adapters(["lightning", "lightning_2"], adapter_weights=[1., 1.])
|
59 |
+
|
60 |
+
pipeline.fuse_lora(adapter_names=["lightning"], lora_scale=1., components=["transformer"])
|
61 |
+
pipeline.fuse_lora(adapter_names=["lightning_2"], lora_scale=1., components=["transformer_2"])
|
62 |
pipeline.unload_lora_weights()
|
63 |
|
64 |
with capture_component_call(pipeline, 'transformer') as call:
|