Python
added 4K resolutions switch
DeepBeepMeep13645e6e0e4b
diff --git a/README.md b/README.mdindex d170cc5..23749fc 100644--- a/README.md+++ b/README.md@@ -36,22 +36,37 @@ WanGP supports the Wan (and derived models), Hunyuan Video and LTV Video models-----## 🔥 Latest Updates :-### January 11th 2026: WanGP v10.12, When there is no VRAM left there is still some VRAM left ...-- **LTX 2**: here is the long awaited *Ovi Challenger*, LTX-2 generates video and an audio soundtrack. As usual this WanGP version is *low VRAM*. You should be able to run it with as low as 10 GB of VRAM. If you have at least 24 GB of VRAM you will be able to generate 20s at 720p in a single window in only 2 minutes with the distilled model. WanGP LTX 2 version supports on day one, *Start/End keyframes*, *Sliding-Window* / *Video Continuation* and *Generation Preview*. A *LTX 2 distilled* is part of the package for a very fast generation.+### January 11th 2026: WanGP v10.20, When there is no VRAM left there is still some VRAM left ...-With WanGP v10.11 you can now force your soundtrack, it works like *Multitalk* / *Avatar* except in theory it should work with any kind of sound (not just vocals). Thanks to *Kijai* for showing it was possible.+- **LTX 2 - SUPER VRAM OPTIMIZATIONS**++*With WanGP 10.20 HD 720p Video Gens of 10s just need now 8GB of VRAM!*++LTX Team said this video gen was for 4k. So I had no choice but to squeeze more VRAM for further optimizations.-- **LTX 2 - SUPER VRAM OPTIMIZATONS** (new with WanGP v10.12): LTX Team said this video gen was for 4k. So I had no choice but to squeeze more VRAM for further optimizations:-After much suffering I have managed to reduce by at least 1/3 the VRAM requirements for LTX 2, which means:+After much suffering I have managed to reduce by at least 1/3 the VRAM requirements of LTX 2, which means:- 10s at 720p can be done with only 8GB of VRAM- 10s at 1080p with only 12 GB of VRAM- 20s at 1080p with only 16 GB of VRAM- 10s at Full 4k (3840 x 2176 !!!) with 24 GB of VRAM. However the bad news is LTX 2 video is not for 4K, as 4K outputs may give you nightmares ...- Oh and I also added *Ic Lora support* (*Control Video* with Pose, Depth, Canny Edge transfer) , *Start Image Strength* (values lower than 1 seems to reduce the static image effect, that one gets sometime with LTX2 i2v)...+3K/4K resolutions will be available only if you enable them in the *Config* / *General* tab.++- **Ic Loras support**++Use a *Control Video* to transfer *Pose*, *Depth*, *Canny Edges*. I have added some extra tweaks: with WanGP you can restrict the transfer to a *masked area*, define a *denoising strength* (how much the control video is going to be followed) and a *masking strength* (how much unmasked area is impacted)++- **Start Image Strength**: if you set values lower than 1 you may to reduce the static image effect, you get sometime with LTX2 i2v-- **Z Image Twin Folder Turbo**: Z Image even faster as this variant can generate images with as little as 1 step (3 steps recommended)++### January 9st 2026: WanGP v10.11, Spoiled again++- **LTX 2**: here is the long awaited *Ovi Challenger*, LTX-2 generates video and an audio soundtrack. As usual this WanGP version is *low VRAM*. You should be able to run it with as low as 10 GB of VRAM. If you have at least 24 GB of VRAM you will be able to generate 20s at 720p in a single window in only 2 minutes with the distilled model. WanGP LTX 2 version supports on day one, *Start/End keyframes*, *Sliding-Window* / *Video Continuation* and *Generation Preview*. A *LTX 2 distilled* is part of the package for a very fast generation.++With WanGP v10.11 you can now force your soundtrack, it works like *Multitalk* / *Avatar* except in theory it should work with any kind of sound (not just vocals). Thanks to *Kijai* for showing it was possible.++- **Z Image Twin Folder Turbo**: Z Image even faster as this variant can generate images with as little as 1 step (3 steps recommend)- **Qwen LanPaint**: very precise *In Painting*, offers a better integration of the inpainted area in the rest of the image. Beware it is up to 5x slower as it "searches" for the best replacement.diff --git a/plugins/wan2gp-configuration/plugin.py b/plugins/wan2gp-configuration/plugin.pyindex 727daab..17d8536 100644--- a/plugins/wan2gp-configuration/plugin.py+++ b/plugins/wan2gp-configuration/plugin.py@@ -118,6 +118,11 @@ class ConfigTabPlugin(WAN2GPPlugin):choices=[("Default", 1), ("x2", 2), ("x3", 3), ("x4", 4), ("x5", 5), ("x6", 6), ("x7", 7)],value=self.server_config.get("max_frames_multiplier", 1), label="Max Frames Multiplier (requires restart)")+ self.enable_4k_resolutions_choice = gr.Dropdown(+ choices=[("Off", 0), ("On", 1)],+ value=self.server_config.get("enable_4k_resolutions", 0),+ label="3K/4K Resolutions"+ )default_paths = self.fl.default_checkpoints_pathscheckpoints_paths_text = "\n".join(self.server_config.get("checkpoints_paths", default_paths))self.checkpoints_paths_choice = gr.Textbox(@@ -204,7 +209,7 @@ class ConfigTabPlugin(WAN2GPPlugin):self.state,self.transformer_types_choices, self.model_hierarchy_type_choice, self.fit_canvas_choice,self.attention_choice, self.preload_model_policy_choice, self.clear_file_list_choice,- self.display_stats_choice, self.max_frames_multiplier_choice, self.checkpoints_paths_choice,+ self.display_stats_choice, self.max_frames_multiplier_choice, self.enable_4k_resolutions_choice, self.checkpoints_paths_choice,self.UI_theme_choice, self.queue_color_scheme_choice,self.quantization_choice, self.transformer_dtype_policy_choice, self.mixed_precision_choice,self.text_encoder_quantization_choice, self.VAE_precision_choice, self.compile_choice,@@ -253,7 +258,7 @@ class ConfigTabPlugin(WAN2GPPlugin):(transformer_types_choices, model_hierarchy_type_choice, fit_canvas_choice,attention_choice, preload_model_policy_choice, clear_file_list_choice,- display_stats_choice, max_frames_multiplier_choice, checkpoints_paths_choice,+ display_stats_choice, max_frames_multiplier_choice, enable_4k_resolutions_choice, checkpoints_paths_choice,UI_theme_choice, queue_color_scheme_choice,quantization_choice, transformer_dtype_policy_choice, mixed_precision_choice,text_encoder_quantization_choice, VAE_precision_choice, compile_choice,@@ -292,6 +297,7 @@ class ConfigTabPlugin(WAN2GPPlugin):"notification_sound_enabled": notification_sound_enabled_choice,"notification_sound_volume": notification_sound_volume_choice,"max_frames_multiplier": max_frames_multiplier_choice, "display_stats": display_stats_choice,+ "enable_4k_resolutions": enable_4k_resolutions_choice,"video_output_codec": video_output_codec_choice, "image_output_codec": image_output_codec_choice,"audio_output_codec": audio_output_codec_choice,"model_hierarchy_type": model_hierarchy_type_choice,@@ -323,7 +329,7 @@ class ConfigTabPlugin(WAN2GPPlugin):"metadata_type", "clear_file_list", "fit_canvas", "depth_anything_v2_variant","notification_sound_enabled", "notification_sound_volume", "mmaudio_mode","mmaudio_persistence", "mmaudio_enabled",- "max_frames_multiplier", "display_stats", "video_output_codec", "video_container",+ "max_frames_multiplier", "display_stats", "enable_4k_resolutions", "video_output_codec", "video_container","embed_source_images", "image_output_codec", "audio_output_codec", "checkpoints_paths","model_hierarchy_type", "UI_theme", "queue_color_scheme"]diff --git a/wgp.py b/wgp.pyindex bc8dd65..e3dfb53 100644--- a/wgp.py+++ b/wgp.py@@ -85,7 +85,7 @@ AUTOSAVE_TEMPLATE_PATH = AUTOSAVE_FILENAMECONFIG_FILENAME = "wgp_config.json"PROMPT_VARS_MAX = 10target_mmgp_version = "3.6.11"-WanGP_version = "10.12"+WanGP_version = "10.20"settings_version = 2.42max_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@@ -2140,6 +2140,7 @@ if not Path(config_load_filename).is_file():"metadata_type": "metadata","boost" : 1,"clear_file_list" : 5,+ "enable_4k_resolutions": 0,"vae_config": 0,"profile" : profile_type.LowRAM_LowVRAM,"preload_model_policy": [],@@ -2738,6 +2739,7 @@ image_save_path = server_config.get("image_save_path", os.path.join(os.getcwd(),if not "video_output_codec" in server_config: server_config["video_output_codec"]= "libx264_8"if not "video_container" in server_config: server_config["video_container"]= "mp4"if not "embed_source_images" in server_config: server_config["embed_source_images"]= False+if not "enable_4k_resolutions" in server_config: server_config["enable_4k_resolutions"]= 0if not "image_output_codec" in server_config: server_config["image_output_codec"]= "jpeg_95"preload_model_policy = server_config.get("preload_model_policy", [])@@ -8537,6 +8539,14 @@ custom_resolutions = Nonedef get_resolution_choices(current_resolution_choice, model_resolutions= None):global custom_resolutions+ max_pixels_1080p = 1920 * 1088+ def is_above_1080p(resolution_str):+ try:+ width, height = map(int, resolution_str.split("x"))+ except Exception:+ return False+ return width * height > max_pixels_1080p+resolution_file = "resolutions.json"if model_resolutions is not None:resolution_choices = model_resolutions@@ -8609,6 +8619,12 @@ def get_resolution_choices(current_resolution_choice, model_resolutions= None):("512x512 (1:1)", "512x512"),]+ allow_4k_resolutions = server_config.get("enable_4k_resolutions", 0) == 1+ if model_resolutions is None and not allow_4k_resolutions:+ filtered_choices = [choice for choice in resolution_choices if not is_above_1080p(choice[1])]+ if filtered_choices:+ resolution_choices = filtered_choices+if current_resolution_choice is not None:found = Falsefor label, res in resolution_choices:@@ -8617,9 +8633,13 @@ def get_resolution_choices(current_resolution_choice, model_resolutions= None):breakif not found:if model_resolutions is None:- resolution_choices.append( (current_resolution_choice, current_resolution_choice ))+ if allow_4k_resolutions or not is_above_1080p(current_resolution_choice):+ resolution_choices.append( (current_resolution_choice, current_resolution_choice ))+ elif len(resolution_choices) > 0:+ current_resolution_choice = resolution_choices[0][1]else:- current_resolution_choice = resolution_choices[0][1]+ if len(resolution_choices) > 0:+ current_resolution_choice = resolution_choices[0][1]return resolution_choices, current_resolution_choice