Spaces:
Runtime error
Runtime error
Update optimization.py
Browse files- optimization.py +57 -3
optimization.py
CHANGED
|
@@ -43,6 +43,28 @@ def optimize_pipeline_(pipeline: Callable[P, Any], *args: P.args, **kwargs: P.kw
|
|
| 43 |
@spaces.GPU(duration=1500)
|
| 44 |
def compile_transformer():
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
pipeline.load_lora_weights(
|
| 47 |
"Kijai/WanVideo_comfy",
|
| 48 |
weight_name="Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank128_bf16.safetensors",
|
|
@@ -50,17 +72,49 @@ def optimize_pipeline_(pipeline: Callable[P, Any], *args: P.args, **kwargs: P.kw
|
|
| 50 |
)
|
| 51 |
kwargs_lora = {}
|
| 52 |
kwargs_lora["load_into_transformer_2"] = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
pipeline.load_lora_weights(
|
| 54 |
-
"
|
| 55 |
-
|
| 56 |
-
#weight_name="
|
|
|
|
|
|
|
|
|
|
| 57 |
adapter_name="lightning_2", **kwargs_lora
|
| 58 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
pipeline.set_adapters(["lightning", "lightning_2"], adapter_weights=[1., 1.])
|
| 60 |
|
| 61 |
|
| 62 |
pipeline.fuse_lora(adapter_names=["lightning"], lora_scale=3., components=["transformer"])
|
| 63 |
pipeline.fuse_lora(adapter_names=["lightning_2"], lora_scale=1., components=["transformer_2"])
|
|
|
|
| 64 |
pipeline.unload_lora_weights()
|
| 65 |
|
| 66 |
with capture_component_call(pipeline, 'transformer') as call:
|
|
|
|
| 43 |
@spaces.GPU(duration=1500)
|
| 44 |
def compile_transformer():
|
| 45 |
|
| 46 |
+
# pipeline.load_lora_weights(
|
| 47 |
+
# "Kijai/WanVideo_comfy",
|
| 48 |
+
# weight_name="Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank128_bf16.safetensors",
|
| 49 |
+
# adapter_name="lightning"
|
| 50 |
+
# )
|
| 51 |
+
# kwargs_lora = {}
|
| 52 |
+
# kwargs_lora["load_into_transformer_2"] = True
|
| 53 |
+
# pipeline.load_lora_weights(
|
| 54 |
+
# "Kijai/WanVideo_comfy",
|
| 55 |
+
# weight_name="Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank128_bf16.safetensors",
|
| 56 |
+
# #weight_name="Wan22-Lightning/Wan2.2-Lightning_T2V-A14B-4steps-lora_LOW_fp16.safetensors",
|
| 57 |
+
# adapter_name="lightning_2", **kwargs_lora
|
| 58 |
+
# )
|
| 59 |
+
# pipeline.set_adapters(["lightning", "lightning_2"], adapter_weights=[1., 1.])
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
# pipeline.fuse_lora(adapter_names=["lightning"], lora_scale=3., components=["transformer"])
|
| 63 |
+
# pipeline.fuse_lora(adapter_names=["lightning_2"], lora_scale=1., components=["transformer_2"])
|
| 64 |
+
# pipeline.unload_lora_weights()
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
pipeline.load_lora_weights(
|
| 69 |
"Kijai/WanVideo_comfy",
|
| 70 |
weight_name="Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank128_bf16.safetensors",
|
|
|
|
| 72 |
)
|
| 73 |
kwargs_lora = {}
|
| 74 |
kwargs_lora["load_into_transformer_2"] = True
|
| 75 |
+
# pipeline.load_lora_weights(
|
| 76 |
+
# #"drozbay/Wan2.2_A14B_lora_extract",
|
| 77 |
+
# "Kijai/WanVideo_comfy",
|
| 78 |
+
# #weight_name="MTVCrafter/Wan2_1_MTV-Crafter_motion_adapter_bf16.safetensors",
|
| 79 |
+
# #weight_name="Skyreels/Wan2_1_Skyreels-v2-T2V-720P_LoRA_rank_64_fp16.safetensors",
|
| 80 |
+
# #weight_name="Pusa/Wan21_PusaV1_LoRA_14B_rank512_bf16.safetensors",
|
| 81 |
+
# weight_name="Wan22-Lightning/Wan2.2-Lightning_T2V-A14B-4steps-lora_LOW_fp16.safetensors",
|
| 82 |
+
# adapter_name="lightning_2", **kwargs_lora
|
| 83 |
+
# )
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
pipeline.load_lora_weights(
|
| 88 |
+
#"drozbay/Wan2.2_A14B_lora_extract",
|
| 89 |
+
"Kijai/WanVideo_comfy",
|
| 90 |
+
#weight_name="MTVCrafter/Wan2_1_MTV-Crafter_motion_adapter_bf16.safetensors",
|
| 91 |
+
#weight_name="Skyreels/Wan2_1_Skyreels-v2-T2V-720P_LoRA_rank_64_fp16.safetensors",
|
| 92 |
+
weight_name="Wan22-Lightning/Wan2.2-Lightning_T2V-A14B-4steps-lora_LOW_fp16.safetensors",
|
| 93 |
+
#weight_name="Wan2.2-T2V-A14B-4steps-lora-rank64-Seko-V1.1/low_noise_model.safetensors",
|
| 94 |
adapter_name="lightning_2", **kwargs_lora
|
| 95 |
)
|
| 96 |
+
|
| 97 |
+
# pipeline.load_lora_weights(
|
| 98 |
+
# #"drozbay/Wan2.2_A14B_lora_extract",
|
| 99 |
+
# "ostris/wan22_i2v_14b_orbit_shot_lora",
|
| 100 |
+
# #weight_name="MTVCrafter/Wan2_1_MTV-Crafter_motion_adapter_bf16.safetensors",
|
| 101 |
+
# #weight_name="Skyreels/Wan2_1_Skyreels-v2-T2V-720P_LoRA_rank_64_fp16.safetensors",
|
| 102 |
+
# weight_name="wan22_14b_i2v_orbit_low_noise.safetensors",
|
| 103 |
+
# #weight_name="Wan2.2-T2V-A14B-4steps-lora-rank64-Seko-V1.1/low_noise_model.safetensors",
|
| 104 |
+
# adapter_name="lightning_200", **kwargs_lora
|
| 105 |
+
# )
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
|
| 112 |
pipeline.set_adapters(["lightning", "lightning_2"], adapter_weights=[1., 1.])
|
| 113 |
|
| 114 |
|
| 115 |
pipeline.fuse_lora(adapter_names=["lightning"], lora_scale=3., components=["transformer"])
|
| 116 |
pipeline.fuse_lora(adapter_names=["lightning_2"], lora_scale=1., components=["transformer_2"])
|
| 117 |
+
|
| 118 |
pipeline.unload_lora_weights()
|
| 119 |
|
| 120 |
with capture_component_call(pipeline, 'transformer') as call:
|