Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -107,7 +107,7 @@ def generate_video(input_image, prompt, height, width,
|
|
107 |
pattern="dense", dense_layers=1, dense_timesteps=12, decay_factor=0.2,
|
108 |
progress=gr.Progress(track_tqdm=True)):
|
109 |
|
110 |
-
|
111 |
|
112 |
if input_image is None:
|
113 |
raise gr.Error("Please upload an input image.")
|
@@ -122,17 +122,17 @@ def generate_video(input_image, prompt, height, width,
|
|
122 |
# --- APPLY RADIAL ATTENTION PATCH ---
|
123 |
# This function is called on every generation to ensure the correct settings
|
124 |
# for either 'dense' or 'radial' attention are applied.
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
|
137 |
resized_image = input_image.resize((target_w, target_h))
|
138 |
|
|
|
107 |
pattern="dense", dense_layers=1, dense_timesteps=12, decay_factor=0.2,
|
108 |
progress=gr.Progress(track_tqdm=True)):
|
109 |
|
110 |
+
from radial_attn.models.wan.inference import replace_wan_attention
|
111 |
|
112 |
if input_image is None:
|
113 |
raise gr.Error("Please upload an input image.")
|
|
|
122 |
# --- APPLY RADIAL ATTENTION PATCH ---
|
123 |
# This function is called on every generation to ensure the correct settings
|
124 |
# for either 'dense' or 'radial' attention are applied.
|
125 |
+
with CalculateTime("Replace attention"):
|
126 |
+
replace_wan_attention(
|
127 |
+
pipe=pipe,
|
128 |
+
height=target_h,
|
129 |
+
width=target_w,
|
130 |
+
num_frames=num_frames,
|
131 |
+
dense_layers=dense_layers,
|
132 |
+
dense_timesteps=dense_timesteps,
|
133 |
+
decay_factor=decay_factor,
|
134 |
+
sparsity_type=pattern,
|
135 |
+
)
|
136 |
|
137 |
resized_image = input_image.resize((target_w, target_h))
|
138 |
|