DeepBeepMeep commited on
Commit ·
c309a1f
1
Parent(s): 4cb7e96
Code cleaning
Browse files- wan/modules/model.py +1 -1
- wan/text2video.py +3 -3
- wgp.py +15 -4
wan/modules/model.py
CHANGED
|
@@ -960,7 +960,7 @@ class WanModel(ModelMixin, ConfigMixin):
|
|
| 960 |
])
|
| 961 |
|
| 962 |
kwargs['context_scale'] = vace_context_scale
|
| 963 |
-
hints_list = [ [c]
|
| 964 |
del c
|
| 965 |
|
| 966 |
should_calc = True
|
|
|
|
| 960 |
])
|
| 961 |
|
| 962 |
kwargs['context_scale'] = vace_context_scale
|
| 963 |
+
hints_list = [ [c] for _ in range(len(x_list)) ]
|
| 964 |
del c
|
| 965 |
|
| 966 |
should_calc = True
|
wan/text2video.py
CHANGED
|
@@ -511,9 +511,9 @@ class WanT2V:
|
|
| 511 |
def adapt_vace_model(self):
|
| 512 |
model = self.model
|
| 513 |
modules_dict= { k: m for k, m in model.named_modules()}
|
| 514 |
-
for
|
| 515 |
-
module = modules_dict[f"vace_blocks.{
|
| 516 |
-
target = modules_dict[f"blocks.{
|
| 517 |
setattr(target, "vace", module )
|
| 518 |
delattr(model, "vace_blocks")
|
| 519 |
|
|
|
|
| 511 |
def adapt_vace_model(self):
|
| 512 |
model = self.model
|
| 513 |
modules_dict= { k: m for k, m in model.named_modules()}
|
| 514 |
+
for model_layer, vace_layer in model.vace_layers_mapping.items():
|
| 515 |
+
module = modules_dict[f"vace_blocks.{vace_layer}"]
|
| 516 |
+
target = modules_dict[f"blocks.{model_layer}"]
|
| 517 |
setattr(target, "vace", module )
|
| 518 |
delattr(model, "vace_blocks")
|
| 519 |
|
wgp.py
CHANGED
|
@@ -421,7 +421,8 @@ def save_queue_action(state):
|
|
| 421 |
if image_filenames_for_json:
|
| 422 |
params_copy[key] = image_filenames_for_json if is_originally_list else image_filenames_for_json[0]
|
| 423 |
else:
|
| 424 |
-
|
|
|
|
| 425 |
|
| 426 |
for key in video_keys:
|
| 427 |
video_path_orig = params_copy.get(key)
|
|
@@ -885,6 +886,15 @@ def autoload_queue(state):
|
|
| 885 |
update_global_queue_ref([])
|
| 886 |
dataframe_update = update_queue_data([])
|
| 887 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 888 |
else:
|
| 889 |
if original_queue:
|
| 890 |
print("Autoload skipped: Queue is not empty.")
|
|
@@ -895,6 +905,7 @@ def autoload_queue(state):
|
|
| 895 |
update_global_queue_ref([])
|
| 896 |
dataframe_update = update_queue_data([])
|
| 897 |
|
|
|
|
| 898 |
return dataframe_update, loaded_flag, state
|
| 899 |
|
| 900 |
def run_autoload_and_prepare_ui(current_state):
|
|
@@ -2313,10 +2324,10 @@ def generate_video(
|
|
| 2313 |
progress(*progress_args )
|
| 2314 |
gen["progress_args"] = progress_args
|
| 2315 |
video_guide = preprocess_video(preprocess_type, width=width, height=height,video_in=video_guide, max_frames= video_length)
|
| 2316 |
-
|
| 2317 |
src_video, src_mask, src_ref_images = wan_model.prepare_source([video_guide],
|
| 2318 |
[video_mask],
|
| 2319 |
-
[image_refs],
|
| 2320 |
video_length, VACE_SIZE_CONFIGS[resolution_reformated], "cpu",
|
| 2321 |
original_video= "O" in video_prompt_type,
|
| 2322 |
trim_video=max_frames)
|
|
@@ -3598,7 +3609,7 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Non
|
|
| 3598 |
queue_df = gr.DataFrame(
|
| 3599 |
headers=["Qty","Prompt", "Length","Steps","", "", "", "", ""],
|
| 3600 |
datatype=[ "str","markdown","str", "markdown", "markdown", "markdown", "str", "str", "str"],
|
| 3601 |
-
column_widths= ["5%", None, "7%", "7%", "10%", "10%", "3%", "3%", "
|
| 3602 |
interactive=False,
|
| 3603 |
col_count=(9, "fixed"),
|
| 3604 |
wrap=True,
|
|
|
|
| 421 |
if image_filenames_for_json:
|
| 422 |
params_copy[key] = image_filenames_for_json if is_originally_list else image_filenames_for_json[0]
|
| 423 |
else:
|
| 424 |
+
pass
|
| 425 |
+
# params_copy.pop(key, None) #cant pop otherwise crash during reload
|
| 426 |
|
| 427 |
for key in video_keys:
|
| 428 |
video_path_orig = params_copy.get(key)
|
|
|
|
| 886 |
update_global_queue_ref([])
|
| 887 |
dataframe_update = update_queue_data([])
|
| 888 |
|
| 889 |
+
# need to remove queue otherwise every new tab will be processed it again
|
| 890 |
+
try:
|
| 891 |
+
if os.path.isfile(AUTOSAVE_FILENAME):
|
| 892 |
+
os.remove(AUTOSAVE_FILENAME)
|
| 893 |
+
print(f"Clear Queue: Deleted autosave file '{AUTOSAVE_FILENAME}'.")
|
| 894 |
+
except OSError as e:
|
| 895 |
+
print(f"Clear Queue: Error deleting autosave file '{AUTOSAVE_FILENAME}': {e}")
|
| 896 |
+
gr.Warning(f"Could not delete the autosave file '{AUTOSAVE_FILENAME}'. You may need to remove it manually.")
|
| 897 |
+
|
| 898 |
else:
|
| 899 |
if original_queue:
|
| 900 |
print("Autoload skipped: Queue is not empty.")
|
|
|
|
| 905 |
update_global_queue_ref([])
|
| 906 |
dataframe_update = update_queue_data([])
|
| 907 |
|
| 908 |
+
|
| 909 |
return dataframe_update, loaded_flag, state
|
| 910 |
|
| 911 |
def run_autoload_and_prepare_ui(current_state):
|
|
|
|
| 2324 |
progress(*progress_args )
|
| 2325 |
gen["progress_args"] = progress_args
|
| 2326 |
video_guide = preprocess_video(preprocess_type, width=width, height=height,video_in=video_guide, max_frames= video_length)
|
| 2327 |
+
image_refs = image_refs.copy() if image_refs != None else None # required since prepare_source do inplace modifications
|
| 2328 |
src_video, src_mask, src_ref_images = wan_model.prepare_source([video_guide],
|
| 2329 |
[video_mask],
|
| 2330 |
+
[image_refs],
|
| 2331 |
video_length, VACE_SIZE_CONFIGS[resolution_reformated], "cpu",
|
| 2332 |
original_video= "O" in video_prompt_type,
|
| 2333 |
trim_video=max_frames)
|
|
|
|
| 3609 |
queue_df = gr.DataFrame(
|
| 3610 |
headers=["Qty","Prompt", "Length","Steps","", "", "", "", ""],
|
| 3611 |
datatype=[ "str","markdown","str", "markdown", "markdown", "markdown", "str", "str", "str"],
|
| 3612 |
+
column_widths= ["5%", None, "7%", "7%", "10%", "10%", "3%", "3%", "34"],
|
| 3613 |
interactive=False,
|
| 3614 |
col_count=(9, "fixed"),
|
| 3615 |
wrap=True,
|