Python
added ditto support
deepbeepmeepa31cb5d98302
diff --git a/README.md b/README.mdindex 34f10de..bcb802a 100644--- a/README.md+++ b/README.md@@ -21,9 +21,7 @@ WanGP supports the Wan (and derived models), Hunyuan Video and LTV Video models**Follow DeepBeepMeep on Twitter/X to get the Latest News**: https://x.com/deepbeepmeep## 🔥 Latest Updates :-### October 20 2025: WanGP v9.01 - 0.001 Later--What else will you ever need after this one ?+### October 24 2025: WanGP v9.10, What else will you ever need after this one ?With WanGP v9 you will have enough features to go to a desert island with no internet connection and comes back with a full Hollywood movie.@@ -31,6 +29,7 @@ First here are the new models supported:- **Wan 2.1 Alpha** : a very requested model that can generate videos with *semi transparent background* (as it is very lora picky it supports only the *Self Forcing / lightning* loras accelerators)- **Chatterbox Multilingual**: the first *Voice Generator* in WanGP. Let's say you have a flu and lost your voice (somehow I can't think of another usecase), the world will still be able to hear you as *Chatterbox* can generate up to 15s clips of your voice using a recorded voice sample. Chatterbox works with numerous languages out the box.- **Flux DreamOmni2** : another wannabe *Nano Banana* image Editor / image composer. The *Edit Mode* ("Conditional Image is first Main Subject ...") seems to work better than the *Gen Mode* (Conditional Images are People / Objects ..."). If you have at least 16 GB of VRAM it is recommended to force profile 3 for this model (it uses an autoregressive model for the prompt encoding and the start may be slow).+- **Ditto** (new with *WanGP 9.1* !): a powerful Video 2 Video model, can change for instance the style or the material visible in the video. Be aware it is an instruct based model, so the prompt should contain intructions.Upgraded Features:- A new **Audio Gallery** to store your Chatterbox generations and import your audio assets. *Metadata support* (stored gen settings) for *Wav files* generated with WanGP available from day one.diff --git a/defaults/vace_ditto_14B.json b/defaults/vace_ditto_14B.jsonnew file mode 100644index 0000000..93a68c3--- /dev/null+++ b/defaults/vace_ditto_14B.json@@ -0,0 +1,18 @@+{+ "model": {+ "name": "Ditto 14B",+ "architecture": "vace_ditto_14B",+ "modules": [+ "vace_14B"+ ],+ "description": "Ditto demonstrates superior instruction-following ability and establish a new SOTA in instruction-based video editing (style, transfer, change of material, etc...). This model expects the Prompt to contain instructions to apply to the whole frames. The Masked Area option is experimental.",+ "URLs": "t2v",+ "preload_URLs": [+ "https://huggingface.co/DeepBeepMeep/Wan2.1/resolve/main/ditto_global.safetensors",+ "https://huggingface.co/DeepBeepMeep/Wan2.1/resolve/main/ditto_global_style.safetensors",+ "https://huggingface.co/DeepBeepMeep/Wan2.1/resolve/main/ditto_sim2real.safetensors"+ ]++ },+ "prompt": "Render the subjects as classical sculptures carved from single blocks of pristine white marble"+}\ No newline at end of filediff --git a/models/wan/any2video.py b/models/wan/any2video.pyindex 92c73e9..6484f41 100644--- a/models/wan/any2video.py+++ b/models/wan/any2video.py@@ -1171,5 +1171,10 @@ class WanAny2V:preloadURLs = get_model_recursive_prop(model_type, "preload_URLs")if len(preloadURLs) > 0:return [fl.locate_file(os.path.basename(preloadURLs[0]))] , [1]+ elif base_model_type == "vace_ditto_14B":+ preloadURLs = get_model_recursive_prop(model_type, "preload_URLs")+ model_mode = int(model_mode)+ if len(preloadURLs) > model_mode:+ return [fl.locate_file(os.path.basename(preloadURLs[model_mode]))] , [1]return [], []diff --git a/models/wan/configs/vace_ditto_14B.json b/models/wan/configs/vace_ditto_14B.jsonnew file mode 100644index 0000000..e48a816--- /dev/null+++ b/models/wan/configs/vace_ditto_14B.json@@ -0,0 +1,16 @@+{+ "_class_name": "VaceWanModel",+ "_diffusers_version": "0.30.0",+ "dim": 5120,+ "eps": 1e-06,+ "ffn_dim": 13824,+ "freq_dim": 256,+ "in_dim": 16,+ "model_type": "t2v",+ "num_heads": 40,+ "num_layers": 40,+ "out_dim": 16,+ "text_len": 512,+ "vace_layers": [0, 5, 10, 15, 20, 25, 30, 35],+ "vace_in_dim": 96+}diff --git a/models/wan/modules/model.py b/models/wan/modules/model.pyindex c90540f..7485c01 100644--- a/models/wan/modules/model.py+++ b/models/wan/modules/model.py@@ -900,8 +900,8 @@ class WanModel(ModelMixin, ConfigMixin):if first == None:return sd- new_sd = {}+ # new_sd = {}# for k,v in sd.items():# if k.endswith("modulation.diff"):# pass@@ -914,6 +914,25 @@ class WanModel(ModelMixin, ConfigMixin):# for k,v in sd.items():# new_sd["diffusion_model." + k] = v# sd = new_sd+ if ".default." in first:+ new_sd = {}+ for k,v in sd.items():+ k = k.replace(".default.", ".")+ new_sd[k] = v+ sd = new_sd++ if first.startswith("vace_blocks."):+ new_sd = {}+ for k,v in sd.items():+ if k.startswith("vace_blocks."):+ l = k.split(".")+ block_no = self.vace_layers[int(l[1])]+ l[0] = "blocks." + str(block_no)+ l[1] = "vace"+ k = ".".join(l)+ print(k)+ new_sd[k] = v+ sd = new_sdif first.startswith("lora_unet_"):new_sd = {}diff --git a/models/wan/wan_handler.py b/models/wan/wan_handler.pyindex e4cd602..853ac1c 100644--- a/models/wan/wan_handler.py+++ b/models/wan/wan_handler.py@@ -4,7 +4,7 @@ import gradio as grfrom shared.utils import files_locator as fldef test_vace(base_model_type):- return base_model_type in ["vace_14B", "vace_14B_2_2", "vace_1.3B", "vace_multitalk_14B", "vace_standin_14B", "vace_lynx_14B"]+ return base_model_type in ["vace_14B", "vace_14B_2_2", "vace_1.3B", "vace_multitalk_14B", "vace_standin_14B", "vace_lynx_14B", "vace_ditto_14B"]def test_class_i2v(base_model_type):return base_model_type in ["i2v", "i2v_2_2", "fun_inp_1.3B", "fun_inp", "flf2v_720p", "fantasy", "multitalk", "infinitetalk", "i2v_2_2_multitalk", "animate" ]@@ -37,7 +37,7 @@ class family_handler():@staticmethoddef query_supported_types():return ["multitalk", "infinitetalk", "fantasy", "vace_14B", "vace_14B_2_2", "vace_multitalk_14B", "vace_standin_14B", "vace_lynx_14B",- "t2v_1.3B", "standin", "lynx_lite", "lynx", "t2v", "t2v_2_2", "vace_1.3B", "phantom_1.3B", "phantom_14B",+ "t2v_1.3B", "standin", "lynx_lite", "lynx", "t2v", "t2v_2_2", "vace_1.3B", "vace_ditto_14B", "phantom_1.3B", "phantom_14B","recam_1.3B", "animate", "alpha", "alpha_lynx","i2v", "i2v_2_2", "i2v_2_2_multitalk", "ti2v_2_2", "lucy_edit", "flf2v_720p", "fun_inp_1.3B", "fun_inp"]@@ -332,7 +332,17 @@ class family_handler():("Positioned Frames followed by People / Objects (if any) then a Face", "FI")]extra_model_def["background_removal_label"]= "Remove Backgrounds behind People / Objects, keep it for Landscape, Lynx Face or Positioned Frames"extra_model_def["no_processing_on_last_images_refs"] = 1-+ if base_model_type in ["vace_ditto_14B"]:+ del extra_model_def["guide_preprocessing"], extra_model_def["image_ref_choices"], extra_model_def["video_guide_outpainting"]+ extra_model_def["mask_preprocessing"] = { "selection": ["", "A"], }+ extra_model_def["model_modes"] = {+ "choices": [+ ("Global", 0),+ ("Global Style", 1),+ ("Sim 2 Real", 2)],+ "default": 0,+ "label" : "Ditto Process"+ }if (not vace_class) and standin:@@ -655,6 +665,10 @@ class family_handler():"mask_expand": 20,"audio_prompt_type": "R",})+ elif base_model_type in ["vace_ditto_14B"]:+ ui_defaults.update({+ "video_prompt_type": "V",+ })if text_oneframe_overlap(base_model_type):ui_defaults["sliding_window_overlap"] = 1diff --git a/requirements.txt b/requirements.txtindex 22bac3b..db9f5f0 100644--- a/requirements.txt+++ b/requirements.txt@@ -52,7 +52,7 @@ pydantic==2.10.6# Math & modelingtorchdiffeq>=0.2.5tensordict>=0.6.1-mmgp==3.6.6+mmgp==3.6.7peft==0.15.0matplotlibdiff --git a/wgp.py b/wgp.pyindex 049242e..5a951f4 100644--- a/wgp.py+++ b/wgp.py@@ -73,8 +73,8 @@ from collections import defaultdictglobal_queue_ref = []AUTOSAVE_FILENAME = "queue.zip"PROMPT_VARS_MAX = 10-target_mmgp_version = "3.6.6"-WanGP_version = "9.01"+target_mmgp_version = "3.6.7"+WanGP_version = "9.10"settings_version = 2.39max_source_video_frames = 3000prompt_enhancer_image_caption_model, prompt_enhancer_image_caption_processor, prompt_enhancer_llm_model, prompt_enhancer_llm_tokenizer = None, None, None, None@@ -3469,7 +3469,7 @@ def refresh_gallery(state): #, msgqueue = gen.get("queue", [])abort_interactive = not gen.get("abort", False)if not in_progress or len(queue) == 0:- return gr.Gallery(value = file_list) if last_was_audio else gr.Gallery(selected_index=choice, value = file_list), *pack_audio_gallery_state(audio_file_list, audio_choice), gr.HTML("", visible= False), gr.Button(visible=True), gr.Button(visible=False), gr.Row(visible=False), gr.Row(visible=False), update_queue_data(queue), gr.Button(interactive= abort_interactive), gr.Button(visible= False)+ return gr.Gallery(value = file_list) if last_was_audio else gr.Gallery(selected_index=choice, value = file_list), gr.update() if last_was_audio else choice, *pack_audio_gallery_state(audio_file_list, audio_choice), gr.HTML("", visible= False), gr.Button(visible=True), gr.Button(visible=False), gr.Row(visible=False), gr.Row(visible=False), update_queue_data(queue), gr.Button(interactive= abort_interactive), gr.Button(visible= False)else:task = queue[0]prompt = task["prompt"]@@ -3527,7 +3527,11 @@ def refresh_gallery(state): #, msggen_buttons_visible = Truehtml = f"<TABLE WIDTH=100% ID=PINFO style='{table_style}'><TR style='height:140px'><TD width=100% style='{table_style}'>" + prompt + "</TD>" + thumbnails + "</TR></TABLE>"html_output = gr.HTML(html, visible= True)- return gr.Gallery(value = file_list) if last_was_audio else gr.Gallery(selected_index=choice, value = file_list), *pack_audio_gallery_state(audio_file_list, audio_choice), html_output, gr.Button(visible=False), gr.Button(visible=True), gr.Row(visible=True), gr.Row(visible= gen_buttons_visible), update_queue_data(queue), gr.Button(interactive= abort_interactive), gr.Button(visible= onemorewindow_visible)+ if last_was_audio:+ audio_choice = max(0, audio_choice)+ else:+ choice = max(0, choice)+ return gr.Gallery(value = file_list) if last_was_audio else gr.Gallery(selected_index=choice, value = file_list), gr.update() if last_was_audio else choice, *pack_audio_gallery_state(audio_file_list, audio_choice), html_output, gr.Button(visible=False), gr.Button(visible=True), gr.Row(visible=True), gr.Row(visible= gen_buttons_visible), update_queue_data(queue), gr.Button(interactive= abort_interactive), gr.Button(visible= onemorewindow_visible)@@ -6992,7 +6996,8 @@ def use_video_settings(state, input_file_list, choice, source):if any_audio:input_file_list = unpack_audio_list(input_file_list)file_list, file_settings_list = get_file_list(state, input_file_list, audio_files=any_audio)- if choice != None and choice >=0 and len(file_list)>0:+ if choice != None and len(file_list)>0:+ choice= max(0, choice)configs = file_settings_list[choice]file_name= file_list[choice]if configs == None:@@ -7027,7 +7032,7 @@ def use_video_settings(state, input_file_list, choice, source):else:return *generate_dropdown_model_list(model_type), gr.update()else:- gr.Info(f"No Medium is Selected")+ gr.Info(f"Please Select a File")return gr.update(), gr.update(), gr.update(), gr.update()loras_url_cache = None@@ -9096,7 +9101,7 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Nonif tab_id == 'generate':output_trigger.change(refresh_gallery,inputs = [state],- outputs = [output, audio_files_paths, audio_file_selected, audio_gallery_refresh_trigger, gen_info, generate_btn, add_to_queue_btn, current_gen_column, current_gen_buttons_row, queue_html, abort_btn, onemorewindow_btn],+ outputs = [output, last_choice, audio_files_paths, audio_file_selected, audio_gallery_refresh_trigger, gen_info, generate_btn, add_to_queue_btn, current_gen_column, current_gen_buttons_row, queue_html, abort_btn, onemorewindow_btn],show_progress="hidden")