Spaces:
Running
on
Zero
Running
on
Zero
Update optimization.py (#4)
Browse files- Update optimization.py (23276680e2caa3d0bc9538d4e033724353d69771)
- Update app.py (ff3f17523e995748da0bf396c4d8d98beed17074)
- app.py +2 -2
- optimization.py +9 -9
app.py
CHANGED
@@ -222,9 +222,9 @@ with gr.Blocks() as demo:
|
|
222 |
negative_prompt_input = gr.Textbox(label="Negative Prompt", value=default_negative_prompt, lines=3)
|
223 |
seed_input = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42, interactive=True)
|
224 |
randomize_seed_checkbox = gr.Checkbox(label="Randomize seed", value=True, interactive=True)
|
225 |
-
steps_slider = gr.Slider(minimum=1, maximum=30, step=1, value=
|
226 |
guidance_scale_input = gr.Slider(minimum=0.0, maximum=10.0, step=0.5, value=1, label="Guidance Scale - high noise stage")
|
227 |
-
guidance_scale_2_input = gr.Slider(minimum=0.0, maximum=10.0, step=0.5, value=
|
228 |
|
229 |
generate_button = gr.Button("Generate Video", variant="primary")
|
230 |
with gr.Column():
|
|
|
222 |
negative_prompt_input = gr.Textbox(label="Negative Prompt", value=default_negative_prompt, lines=3)
|
223 |
seed_input = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42, interactive=True)
|
224 |
randomize_seed_checkbox = gr.Checkbox(label="Randomize seed", value=True, interactive=True)
|
225 |
+
steps_slider = gr.Slider(minimum=1, maximum=30, step=1, value=4, label="Inference Steps")
|
226 |
guidance_scale_input = gr.Slider(minimum=0.0, maximum=10.0, step=0.5, value=1, label="Guidance Scale - high noise stage")
|
227 |
+
guidance_scale_2_input = gr.Slider(minimum=0.0, maximum=10.0, step=0.5, value=1, label="Guidance Scale 2 - low noise stage")
|
228 |
|
229 |
generate_button = gr.Button("Generate Video", variant="primary")
|
230 |
with gr.Column():
|
optimization.py
CHANGED
@@ -45,20 +45,20 @@ def optimize_pipeline_(pipeline: Callable[P, Any], *args: P.args, **kwargs: P.kw
|
|
45 |
def compile_transformer():
|
46 |
|
47 |
pipeline.load_lora_weights(
|
48 |
-
|
49 |
-
|
50 |
-
adapter_name="
|
51 |
)
|
52 |
kwargs_lora = {}
|
53 |
kwargs_lora["load_into_transformer_2"] = True
|
54 |
pipeline.load_lora_weights(
|
55 |
-
|
56 |
-
|
57 |
-
adapter_name="
|
58 |
)
|
59 |
-
pipeline.set_adapters(["
|
60 |
-
pipeline.fuse_lora(adapter_names=["
|
61 |
-
pipeline.fuse_lora(adapter_names=["
|
62 |
pipeline.unload_lora_weights()
|
63 |
|
64 |
with capture_component_call(pipeline, 'transformer') as call:
|
|
|
45 |
def compile_transformer():
|
46 |
|
47 |
pipeline.load_lora_weights(
|
48 |
+
"Kijai/WanVideo_comfy",
|
49 |
+
weight_name="Lightx2v/lightx2v_I2V_14B_480p_cfg_step_distill_rank128_bf16.safetensors",
|
50 |
+
adapter_name="lightx2v"
|
51 |
)
|
52 |
kwargs_lora = {}
|
53 |
kwargs_lora["load_into_transformer_2"] = True
|
54 |
pipeline.load_lora_weights(
|
55 |
+
"Kijai/WanVideo_comfy",
|
56 |
+
weight_name="Lightx2v/lightx2v_I2V_14B_480p_cfg_step_distill_rank128_bf16.safetensors",
|
57 |
+
adapter_name="lightx2v_2", **kwargs_lora
|
58 |
)
|
59 |
+
pipeline.set_adapters(["lightx2v", "lightx2v_2"], adapter_weights=[1., 1.])
|
60 |
+
pipeline.fuse_lora(adapter_names=["lightx2v"], lora_scale=3., components=["transformer"])
|
61 |
+
pipeline.fuse_lora(adapter_names=["lightx2v_2"], lora_scale=1., components=["transformer_2"])
|
62 |
pipeline.unload_lora_weights()
|
63 |
|
64 |
with capture_component_call(pipeline, 'transformer') as call:
|