Python
added i2v svipro2
deepbeepmeep5c2b11c118ea
diff --git a/README.md b/README.mdindex a080056..ec665f6 100644--- a/README.md+++ b/README.md@@ -36,6 +36,32 @@ WanGP supports the Wan (and derived models), Hunyuan Video and LTV Video models-----## 🔥 Latest Updates :+### January 1st 2026: WanGP v10, Happy New Year !++- **Wan 2.2 i2v Stable Vision Infinity Pro 2**: SVI Pro 2 offers potentially unlimited Videos to Continue for i2v models. It will use either the Start frame as a Reference Image or you may provide an Anchor image to be used across all the windows or multiple Anchor Images one per Window.++- **Wan 2.1 Alpha 2**: This new version of Alpha generates transparent videos with fine-grained alpha detail (hair, glow, smoke).++- **Qwen Image 2512**: This December release offers Enhanced Human Realism, Finer Natural Details & Improved Text Rendering.++- **Wan NVP4**: *Light2xv nvfp4 support for Wan 2.1 i2v*& t2v 1.3B*, you can now load nvfp4 (4 bits quantized file) in WanGP. These will make really a difference with RTX 50xx as they support natively scaled FP4 calculation. Other GPUs will get the pytorch fallback witch slower. This model can be useful for machines with low RAM. Don't expect significant VRAM reduction of much faster speed for non RTX 50xx owners. You will need to install the Light2xv kernels.++- **Nunckaku int4 & fp4 support for Qwen 2509 & Z Image**: int4 versions will work with most GPUs, fp4 will accelerate only RTX50xx. You will need to install the nunchaku kernels. See light2xv nvfp4 above, as the other comments apply here too.++- **Z Image Control Net 2.1**: Control Net upgraded should work better. I have enabled as well inpainting for the control net.++- **Now Qwen Loras Accelerators Added**++*Quantization Kernels Wheels for Windows / Python 3.10 / Pytorch 2.70:*+- *Light2xv (WAN-FP4)*+ ```+ pip install https://github.com/deepbeepmeep/kernels/releases/download/WAN_NVP4/lightx2v_kernel-0.0.1-cp39-abi3-win_amd64.whl+ ```++- *Nunchaku*+ ```+ pip install https://github.com/deepbeepmeep/kernels/releases/download/Nunchaku/nunchaku-1.1.0+torch2.7-cp310-cp310-win_amd64.whl+ ```### December 23 2025: WanGP v9.92, Early Christmas- **SCAIL Preview**: enjoy this *Wan Animate*, *Steady Dancer* contender that can support multiple people. Thanks to its 3D positioning, it can take into account which parts of the body are hidden and which are not.diff --git a/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.json b/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.jsonnew file mode 100644index 0000000..3f2742c--- /dev/null+++ b/defaults/i2v_2_2_Enhanced_Lightning_v2_svi2pro.json@@ -0,0 +1,27 @@+{+ "model":+ {+ "name": "Wan2.2 Image2video SVI 2 Pro Enhanced Lightning v2 14B",+ "architecture" : "i2v_2_2_svi2pro",+ "description": "This finetune of WAN 2.2 I2V accelerated with Lightning has been updated to deliver better prompt comprehension and improved handling of camera angles and cinematic movements. It provides more accurate scene interpretation, smoother transitions, and enhanced control over dynamic. The SVI Pro 2 offers potentially unlimited Videos to Continue. It will use either the Start frame or an Anchor image as a Ref. Image to be used across all the windows (or one Anchor Image per Window).",++ "URLs": [+ "https://huggingface.co/DeepBeepMeep/Wan2.2/resolve/main/wan22EnhancedLightning_v2I2VFP8HIGH.safetensors"+ ],+ "URLs2": [+ "https://huggingface.co/DeepBeepMeep/Wan2.2/resolve/main/wan22EnhancedLightning_v2I2VFP8LOW.safetensors"+ ],+ "author": "https://civitai.com/models/2053259",+ "loras": "i2v_2_2_svi2pro",+ "loras_multipliers": "i2v_2_2_svi2pro",+ "profile_dirs": [""]+ },+ "guidance_phases": 2,+ "switch_threshold" : 900,+ "guidance_scale" : 1,+ "guidance2_scale" : 1,+ "flow_shift" : 5,+ "num_inference_steps": 8,+ "multi_prompts_gen_type": 2,+ "prompt": "(at 0 seconds: wide frontal shot of a man standing in front of an open fridge, cinematic lighting, subtle ambient kitchen reflections, the fridge contents visible, camera static).\n(at 1 second: medium shot from the front as he opens the fridge fully, reaches for a can, slight zoom-in to emphasize the action, cinematic framing).\n(at 2 seconds: camera shifts to a side medium shot, tracking him as he lifts the can to his mouth, fluid movement, maintaining lighting and reflections).\n(at 3 seconds: camera starts a smooth 360-degree orbit around the man, following him as he drinks from the can, motion fluid, background slightly blurred for cinematic effect).\n(at 4 seconds: close-up on his face and upper body while drinking, orbit continues subtly, fridge reflections accentuating realism, cinematic polish).\n(at 5 seconds: final wide shot as he lowers the can, camera completes orbit to original angle, showcasing the kitchen space, lighting, and dynamic movement)."+}\ No newline at end of filediff --git a/defaults/i2v_2_2_svi2pro.json b/defaults/i2v_2_2_svi2pro.jsonnew file mode 100644index 0000000..c9ffc71--- /dev/null+++ b/defaults/i2v_2_2_svi2pro.json@@ -0,0 +1,19 @@+{+ "model":+ {+ "name": "Wan2.2 Image2video SVI 2 Pro 14B",+ "architecture" : "i2v_2_2_svi2pro",+ "description": "Wan 2.2 Image 2 Video Stable Video Infinity Pro 2 offers potentially unlimited Videos to Continue. It will use either the Start frame as a Reference Image or you may provide an Anchor image to be used across all the windows or multiple Anchor Images one per Window.",+ "URLs": "i2v_2_2",+ "URLs2": "i2v_2_2",+ "group": "wan2_2",+ "loras": ["https://huggingface.co/DeepBeepMeep/Wan2.2/resolve/main/SVI_Wan2.2-I2V-A14B_high_noise_lora_v2.0_pro.safetensors",+ "https://huggingface.co/DeepBeepMeep/Wan2.2/resolve/main/SVI_Wan2.2-I2V-A14B_low_noise_lora_v2.0_pro.safetensors"],+ "loras_multipliers": ["1;0", "0;1"]+ },+ "guidance_phases": 2,+ "switch_threshold" : 900,+ "guidance_scale" : 3.5,+ "guidance2_scale" : 3.5,+ "flow_shift" : 5+}\ No newline at end of filediff --git a/defaults/longcat_avatar.json b/defaults/longcat_avatar.jsonindex e2b3444..ec4dbb8 100644--- a/defaults/longcat_avatar.json+++ b/defaults/longcat_avatar.json@@ -10,6 +10,7 @@],"reference_image_enabled": true,"ref_img_index": 10,+ "visible": false,"mask_frame_range": 3},"num_inference_steps": 50diff --git a/defaults/longcat_avatar_multi.json b/defaults/longcat_avatar_multi.jsonindex b0e98c8..56617ea 100644--- a/defaults/longcat_avatar_multi.json+++ b/defaults/longcat_avatar_multi.json@@ -10,6 +10,7 @@],"reference_image_enabled": true,"ref_img_index": 10,+ "visible": false,"mask_frame_range": 3},"num_inference_steps": 50diff --git a/defaults/longcat_video.json b/defaults/longcat_video.jsonindex b16f495..619b78f 100644--- a/defaults/longcat_video.json+++ b/defaults/longcat_video.json@@ -3,6 +3,7 @@"name": "LongCat Video 13.6B","architecture": "longcat_video","description": "LongCat Video supports text-to-video, image-to-video, and video continuation with a unified transformer.",+ "visible": false,"URLs": ["https://huggingface.co/DeepBeepMeep/LongCat/resolve/main/longcat_video_bf16.safetensors","https://huggingface.co/DeepBeepMeep/LongCat/resolve/main/longcat_video_quanto_bf16_int8.safetensors"diff --git a/defaults/qwen_image_2512_20B.json b/defaults/qwen_image_2512_20B.jsonnew file mode 100644index 0000000..5047c5f--- /dev/null+++ b/defaults/qwen_image_2512_20B.json@@ -0,0 +1,18 @@+{+ "model": {+ "name": "Qwen Image 2512 Release 20B",+ "architecture": "qwen_image_20B",+ "description": "Qwen Image 2512 is a 20B image generator that excels at high quality visuals and long text rendering. This December release offers Enhanced Human Realism, Finer Natural Details & Improved Text Rendering.",+ "URLs": [+ "https://huggingface.co/DeepBeepMeep/Qwen_image/resolve/main/qwen_image_2512_20B_bf16.safetensors",+ "https://huggingface.co/DeepBeepMeep/Qwen_image/resolve/main/qwen_image_2512_20B_quanto_bf16_int8.safetensors"+ ],+ "attention": {+ "<89": "sdpa"+ },+ "image_outputs": true+ },+ "prompt": "draw a hat",+ "resolution": "1280x720",+ "batch_size": 1+}\ No newline at end of filediff --git a/defaults/qwen_image_edit_plus_20B_nunchaku_r128_fp4.json b/defaults/qwen_image_edit_plus_20B_nunchaku_r128_fp4.jsonindex 6ec0bb7..39bfdf1 100644--- a/defaults/qwen_image_edit_plus_20B_nunchaku_r128_fp4.json+++ b/defaults/qwen_image_edit_plus_20B_nunchaku_r128_fp4.json@@ -2,10 +2,11 @@"model": {"name": "Qwen Image Edit Plus (2509) Nunchaku FP4 r128 20B","architecture": "qwen_image_edit_plus_20B",- "description": "Nunchaku SVDQ INT4 weights for Qwen Image Edit 2509 20B. For full speed, a sm120+ GPU is needed (RTX 50xx) and the nunchaku kernels must be installed.",+ "description": "Nunchaku SVDQ INT4 weights for Qwen Image Edit 2509 20B. Qwen distilled with lightning 4 steps 251115. For full speed, a sm120+ GPU is needed (RTX 50xx) and the nunchaku kernels must be installed.","URLs": [- "https://huggingface.co/DeepBeepMeep/Qwen_image/resolve/main/svdq-int4_r128-qwen-image-edit-2509-lightning-4steps-251115.safetensors"+ "https://huggingface.co/DeepBeepMeep/Qwen_image/resolve/main/svdq-fp4_r128-qwen-image-edit-2509-lightning-4steps-251115.safetensors"],+ "profiles_dir": [""],"preload_URLs": "qwen_image_edit_20B","attention": {"<89": "sdpa"diff --git a/defaults/qwen_image_edit_plus_20B_nunchaku_r128_int4.json b/defaults/qwen_image_edit_plus_20B_nunchaku_r128_int4.jsonindex 9ec8251..3c5a6b9 100644--- a/defaults/qwen_image_edit_plus_20B_nunchaku_r128_int4.json+++ b/defaults/qwen_image_edit_plus_20B_nunchaku_r128_int4.json@@ -2,10 +2,11 @@"model": {"name": "Qwen Image Edit Plus (2509) Nunchaku INT4 r128 20B","architecture": "qwen_image_edit_plus_20B",- "description": "Nunchaku SVDQ INT4 weights for Qwen Image Edit 2509 20B. For full speed, the nunchaku kernels must be installed.",+ "description": "Nunchaku SVDQ INT4 weights for Qwen Image Edit 2509 20B. Qwen distilled with lightning 4 steps 251115. For full speed, the nunchaku kernels must be installed.","URLs": ["https://huggingface.co/DeepBeepMeep/Qwen_image/resolve/main/svdq-int4_r128-qwen-image-edit-2509-lightning-4steps-251115.safetensors"],+ "profiles_dir": [""],"preload_URLs": "qwen_image_edit_20B","attention": {"<89": "sdpa"diff --git a/models/wan/any2video.py b/models/wan/any2video.pyindex cb4947b..9ee4c5e 100644--- a/models/wan/any2video.py+++ b/models/wan/any2video.py@@ -92,7 +92,6 @@ class WanAny2V:self.model2 = Noneself.transformer_switch = model_def.get("URLs2", None) is not Noneself.is_mocha = model_def.get("mocha_mode", False)- self.alpha2 = base_model_type == "alpha2"self.text_encoder = T5EncoderModel(text_len=config.text_len,dtype=config.t5_dtype,@@ -100,8 +99,7 @@ class WanAny2V:checkpoint_path=text_encoder_filename,tokenizer_path=fl.locate_folder("umt5-xxl"),shard_fn= None)- # base_model_type = "i2v2_2"- if hasattr(config, "clip_checkpoint") and not base_model_type in ["i2v_2_2", "i2v_2_2_multitalk"] or base_model_type in ["animate"]:+ if hasattr(config, "clip_checkpoint") and not model_def.get("i2v_2_2", False) or base_model_type in ["animate"]:self.clip = CLIPModel(dtype=config.clip_dtype,device=self.device,@@ -122,7 +120,7 @@ class WanAny2V:vae_upsampler_factor = 2vae_checkpoint ="Wan2.1_VAE_upscale2x_imageonly_real_v1.safetensors"elif model_def.get("alpha_class", False):- if self.alpha2:+ if base_model_type == "alpha2":vae_checkpoint = "wan_alpha_2.1_vae_rgb_channel_v2.safetensors"vae_checkpoint2 = "wan_alpha_2.1_vae_alpha_channel_v2.safetensors"else:@@ -418,6 +416,7 @@ class WanAny2V:overlapped_latents = None,return_latent_slice = None,overlap_noise = 0,+ overlap_size = 0,conditioning_latents_size = 0,keep_frames_parsed = [],model_type = None,@@ -435,6 +434,7 @@ class WanAny2V:window_no = 0,set_header_text = None,pre_video_frame = None,+ prefix_video = None,video_prompt_type= "",original_input_ref_images = [],face_arc_embeds = None,@@ -488,8 +488,6 @@ class WanAny2V:timesteps = sample_scheduler.timestepselse:raise NotImplementedError(f"Unsupported Scheduler {sample_solver}")- if sample_solver == "distill":- sampling_steps = len(timesteps)original_timesteps = timestepsseed_g = torch.Generator(device=self.device)@@ -526,6 +524,7 @@ class WanAny2V:# if NAG_scale > 1: context = torch.cat([context, context_NAG], dim=0)if self._interrupt: return Nonevace = model_def.get("vace_class", False)+ svi_dance = model_def.get("svi_dance", False)phantom = model_type in ["phantom_1.3B", "phantom_14B"]fantasy = model_type in ["fantasy"]multitalk = model_def.get("multitalk_class", False)@@ -535,7 +534,7 @@ class WanAny2V:recam = model_type in ["recam_1.3B"]ti2v = model_def.get("wan_5B_class", False)alpha_class = model_def.get("alpha_class", False)- alpha2 = self.alpha2+ alpha2 = model_type in ["alpha2"]lucy_edit= model_type in ["lucy_edit"]animate= model_type in ["animate"]chrono_edit = model_type in ["chrono_edit"]@@ -543,9 +542,13 @@ class WanAny2V:steadydancer = model_type in ["steadydancer"]wanmove = model_type in ["wanmove"]scail = model_type in ["scail"]+ svi_pro = model_def.get("svi2pro", False)+ svi_mode = 2 if svi_pro else 0+ svi_ref_pad_num = 0start_step_no = 0ref_images_count = inner_latent_frames = 0trim_frames = 0+ post_decode_pre_trim = 0last_latent_preview = Falseextended_overlapped_latents = clip_image_start = clip_image_end = image_mask_latents = latent_slice = freqs = post_freqs = None# SCAIL uses a fixed ref latent frame that should not be noised.@@ -612,14 +615,44 @@ class WanAny2V:img_end_frame,], dim=1).to(self.device)else:- enc= torch.concat([- control_video,- torch.zeros( (3, frame_num-control_pre_frames_count, height, width), device=self.device, dtype= self.VAE_dtype)- ], dim=1).to(self.device)+ remaining_frames = frame_num - control_pre_frames_count+ if svi_pro or svi_mode and svi_ref_pad_num != 0:+ if input_ref_images is None or len(input_ref_images)==0:+ if pre_video_frame is None: raise Exception("Missing Reference Image")+ image_ref = pre_video_frame+ else:+ image_ref = input_ref_images[ min(window_no, len(input_ref_images))-1 ]+ image_ref = convert_image_to_tensor(image_ref).unsqueeze(1).to(device=self.device, dtype=self.VAE_dtype)+ if svi_pro:+ if overlapped_latents is not None:+ post_decode_pre_trim = 1+ elif prefix_video is not None and prefix_video.shape[1] >= (5 + overlap_size):+ overlapped_latents = self.vae.encode([torch.cat( [prefix_video[:, -(5 + overlap_size):]], dim=1)], VAE_tile_size)[0][:, -overlap_size//4: ].unsqueeze(0)+ post_decode_pre_trim = 1++ image_ref_latents = self.vae.encode([image_ref], VAE_tile_size)[0]+ pad_len = lat_frames + ref_images_count - image_ref_latents.shape[1] - (overlapped_latents.shape[2] if overlapped_latents is not None else 0)+ pad_latents = torch.zeros(image_ref_latents.shape[0], pad_len, lat_h, lat_w, device=image_ref_latents.device, dtype=image_ref_latents.dtype)+ if overlapped_latents is None:+ lat_y = torch.concat([image_ref_latents, pad_latents], dim=1).to(self.device)+ else:+ lat_y = torch.concat([image_ref_latents, overlapped_latents.squeeze(0), pad_latents], dim=1).to(self.device)+ image_ref_latents = None+ else:+ svi_ref_pad_num = remaining_frames if svi_ref_pad_num == -1 else min(svi_ref_pad_num, remaining_frames)+ padded_frames = image_ref.expand(-1, svi_ref_pad_num, -1, -1)+ if remaining_frames > svi_ref_pad_num:+ padded_frames = torch.cat([padded_frames, torch.zeros((3, remaining_frames - svi_ref_pad_num, height, width), device=self.device, dtype=self.VAE_dtype)], dim=1)+ enc = torch.concat([control_video, padded_frames], dim=1).to(self.device)+ else:+ enc= torch.concat([ control_video, torch.zeros( (3, remaining_frames, height, width), device=self.device, dtype= self.VAE_dtype) ], dim=1).to(self.device)+ padded_frames = None- image_start = image_end = img_end_frame = image_ref = control_video = None+ if not svi_pro:+ lat_y = self.vae.encode([enc], VAE_tile_size, any_end_frame= any_end_frame and add_frames_for_end_image)[0]- msk = torch.ones(1, frame_num, lat_h, lat_w, device=self.device)++ msk = torch.ones(1, frame_num + ref_images_count * 4, lat_h, lat_w, device=self.device)if any_end_frame:msk[:, control_pre_frames_count: -1] = 0if add_frames_for_end_image:@@ -627,12 +660,12 @@ class WanAny2V:else:msk = torch.concat([ torch.repeat_interleave(msk[:, 0:1], repeats=4, dim=1), msk[:, 1:] ], dim=1)else:- msk[:, control_pre_frames_count:] = 0+ msk[:, 1 if svi_mode else control_pre_frames_count:] = 0msk = torch.concat([ torch.repeat_interleave(msk[:, 0:1], repeats=4, dim=1), msk[:, 1:] ], dim=1)msk = msk.view(1, msk.shape[1] // 4, 4, lat_h, lat_w)msk = msk.transpose(1, 2)[0]- lat_y = self.vae.encode([enc], VAE_tile_size, any_end_frame= any_end_frame and add_frames_for_end_image)[0]+ image_start = image_end = img_end_frame = image_ref = control_video = Noneif motion_amplitude > 1:base_latent = lat_y[:, :1]@@ -757,7 +790,6 @@ class WanAny2V:y = torch.concat([msk_ref, msk_control], dim=1)# Downsample pose video by 0.5x before VAE encoding (matches `smpl_downsample` in upstream configs)pose_pixels_ds = pose_pixels.permute(1, 0, 2, 3)- toto = [pose_pixels]pose_pixels_ds = F.interpolate( pose_pixels_ds, size=(max(1, pose_pixels.shape[-2] // 2), max(1, pose_pixels.shape[-1] // 2)), mode="bilinear", align_corners=False, ).permute(1, 0, 2, 3)pose_latents = self.vae.encode([pose_pixels_ds], VAE_tile_size)[0].unsqueeze(0)@@ -1271,14 +1303,7 @@ class WanAny2V:noise_pred = noise_pred_uncond + guide_scale * (noise_pred_text - noise_pred_uncond)ret_values = noise_pred_uncond = noise_pred_cond = noise_pred_text = neg = None- if sample_solver == "distill":- flow_pred = noise_pred[:, :, :target_shape[1]].to(torch.float32)- sigma = distill_sigmas[i].item()- latents = latents.to(torch.float32) - sigma * flow_pred- if i < len(distill_sigmas) - 1:- sigma_next = distill_sigmas[i + 1].item()- latents = latents + sigma_next * flow_pred- elif sample_solver == "euler":+ if sample_solver == "euler":dt = timesteps[i] if i == len(timesteps)-1 else (timesteps[i] - timesteps[i + 1])dt = dt.item() / self.num_timestepslatents = latents - noise_pred * dt@@ -1355,6 +1380,9 @@ class WanAny2V:videos = match_and_blend_colors(videos.unsqueeze(0), color_reference_frame.unsqueeze(0), color_correction_strength).squeeze(0)ret = { "x" : videos, "latent_slice" : latent_slice}+ if post_decode_pre_trim > 0:+ ret["post_decode_pre_trim"] = post_decode_pre_trim+if alpha_class:BGRA_frames = Nonefrom .alpha.utils import render_video, from_BRGA_numpy_to_RGBA_torchdiff --git a/models/wan/configs/i2v_2_2_svi2pro.json b/models/wan/configs/i2v_2_2_svi2pro.jsonnew file mode 100644index 0000000..a64a868--- /dev/null+++ b/models/wan/configs/i2v_2_2_svi2pro.json@@ -0,0 +1,14 @@+{+ "_class_name": "WanModel",+ "_diffusers_version": "0.33.0",+ "dim": 5120,+ "eps": 1e-06,+ "ffn_dim": 13824,+ "freq_dim": 256,+ "in_dim": 36,+ "model_type": "i2v2_2",+ "num_heads": 40,+ "num_layers": 40,+ "out_dim": 16,+ "text_len": 512+}\ No newline at end of filediff --git a/models/wan/wan_handler.py b/models/wan/wan_handler.pyindex 730f9e7..3251380 100644--- a/models/wan/wan_handler.py+++ b/models/wan/wan_handler.py@@ -12,13 +12,13 @@ def 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", "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", "chrono_edit", "steadydancer", "wanmove", "scail" ]+ 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", "chrono_edit", "steadydancer", "wanmove", "scail", "i2v_2_2_svi2pro" ]def test_class_t2v(base_model_type):return base_model_type in ["t2v", "t2v_2_2", "alpha", "alpha2", "lynx"]def test_oneframe_overlap(base_model_type):- return test_class_i2v(base_model_type) and not (test_multitalk(base_model_type) or base_model_type in ["animate", "scail"]) or test_wan_5B(base_model_type)+ return test_class_i2v(base_model_type) and not (test_multitalk(base_model_type) or base_model_type in ["animate", "scail"] or test_svi2pro(base_model_type)) or test_wan_5B(base_model_type)def test_class_1_3B(base_model_type):return base_model_type in [ "vace_1.3B", "t2v_1.3B", "recam_1.3B","phantom_1.3B","fun_inp_1.3B"]@@ -38,13 +38,20 @@ def test_alpha(base_model_type):def test_wan_5B(base_model_type):return base_model_type in ["ti2v_2_2", "lucy_edit"]+def test_i2v_2_2(base_model_type):+ return base_model_type in ["i2v_2_2", "i2v_2_2_multitalk", "i2v_2_2_svi2pro"]+++def test_svi2pro(base_model_type):+ return base_model_type in ["i2v_2_2_svi2pro"]+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", "vace_ditto_14B", "phantom_1.3B", "phantom_14B","recam_1.3B", "animate", "alpha", "alpha2", "alpha_lynx", "chrono_edit",- "i2v", "i2v_2_2", "i2v_2_2_multitalk", "ti2v_2_2", "lucy_edit", "flf2v_720p", "fun_inp_1.3B", "fun_inp", "mocha", "steadydancer", "wanmove", "scail"]+ "i2v", "i2v_2_2", "i2v_2_2_multitalk", "ti2v_2_2", "lucy_edit", "flf2v_720p", "fun_inp_1.3B", "fun_inp", "mocha", "steadydancer", "wanmove", "scail", "i2v_2_2_svi2pro"]@staticmethod@@ -52,10 +59,11 @@ class family_handler():models_eqv_map = {"flf2v_720p" : "i2v",+ "i2v_2_2_svi2pro": "i2v_2_2","t2v_1.3B" : "t2v","t2v_2_2" : "t2v","alpha" : "t2v",- "alpha2" : "t2v",+ "alpha2" : "t2v","lynx" : "t2v","standin" : "t2v","vace_standin_14B" : "vace_14B",@@ -67,7 +75,7 @@ class family_handler():"vace_14B" : [ "vace_multitalk_14B", "vace_standin_14B", "vace_lynx_lite_14B", "vace_lynx_14B", "vace_14B_2_2"],"t2v" : [ "vace_14B", "vace_1.3B" "vace_multitalk_14B", "vace_standin_14B", "vace_lynx_lite_14B", "vace_lynx_14B", "vace_14B_2_2", "t2v_1.3B", "phantom_1.3B","phantom_14B", "standin", "lynx_lite", "lynx", "alpha", "alpha2"],"i2v" : [ "fantasy", "multitalk", "flf2v_720p" ],- "i2v_2_2" : ["i2v_2_2_multitalk"],+ "i2v_2_2" : ["i2v_2_2_multitalk", "i2v_2_2_svi2pro"],"fantasy": ["multitalk"],}return models_eqv_map, models_comp_map@@ -115,7 +123,7 @@ class family_handler():@staticmethoddef get_lora_dir(base_model_type, args):- i2v = test_class_i2v(base_model_type) and base_model_type not in ["i2v_2_2", "i2v_2_2_multitalk"]+ i2v = test_class_i2v(base_model_type) and not test_i2v_2_2(base_model_type)wan_dir = getattr(args, "lora_dir_wan", None) or getattr(args, "lora_dir", None) or os.path.join("loras", "wan")wan_i2v_dir = getattr(args, "lora_dir_wan_i2v", None) or getattr(args, "lora_dir_i2v", None) or os.path.join("loras", "wan_i2v")wan_1_3b_dir = getattr(args, "lora_dir_wan_1_3b", None) or os.path.join("loras", "wan_1.3B")@@ -195,7 +203,10 @@ class family_handler():extra_model_def["wan_5B_class"] = wan_5B = test_wan_5B(base_model_type)extra_model_def["vace_class"] = vace_class = test_vace(base_model_type)extra_model_def["color_correction"] = True+ extra_model_def["svi2pro"] = svi2pro = test_svi2pro(base_model_type)+ extra_model_def["i2v_2_2"] = i2v_2_2 = test_i2v_2_2(base_model_type)+if multitalk or base_model_type in ["fantasy"]:if multitalk:extra_model_def["audio_prompt_choices"] = True@@ -205,7 +216,7 @@ class family_handler():extra_model_def["parent_model_type"] = "vace_14B"group = "wan"- if base_model_type in ["t2v_2_2", "i2v_2_2", "vace_14B_2_2"]:+ if base_model_type in ["t2v_2_2", "vace_14B_2_2"] or test_i2v_2_2(base_model_type):profiles_dir = "wan_2_2"group = "wan2_2"elif i2v:@@ -217,12 +228,12 @@ class family_handler():group = "wan2_2"elif test_class_1_3B(base_model_type):profiles_dir = "wan_1.3B"- elif base_model_type in ["alpha", "alpha2"]:+ elif test_alpha(base_model_type):profiles_dir = "wan_alpha"else:profiles_dir = "wan"- if (test_class_t2v(base_model_type) or vace_class or base_model_type in ["chrono_edit"]) and not base_model_type in ["alpha", "alpha2"]:+ if (test_class_t2v(base_model_type) or vace_class or base_model_type in ["chrono_edit"]) and not test_alpha(base_model_type):extra_model_def["vae_upsampler"] = [1,2]extra_model_def["profiles_dir"] = [profiles_dir]@@ -286,7 +297,19 @@ class family_handler():"selection":[ "", "A"],"visible": False}- if base_model_type in ["i2v_2_2", "i2v", "flf2v_720p"]:+ if svi2pro:+ extra_model_def["image_ref_choices"] = {+ "choices": [("No Anchor Image", ""),+ ("Anchor Images For Each Window", "KI"),+ ],+ "letters_filter": "KI",+ "show_label" : False,+ }+ extra_model_def["all_image_refs_are_background_ref"] = True+ extra_model_def["parent_model_type"] = "i2v_2_2"+++ if base_model_type in ["i2v", "flf2v_720p"] or test_i2v_2_2(base_model_type):extra_model_def["black_frame"] = True@@ -602,7 +625,7 @@ class family_handler():image_prompt_types_allowed = "TSVL"elif base_model_type in ["lucy_edit"]:image_prompt_types_allowed = "TVL"- elif multitalk or base_model_type in ["fantasy", "steadydancer", "scail"]:+ elif multitalk or base_model_type in ["fantasy", "steadydancer", "scail"] or svi2pro:image_prompt_types_allowed = "SVL"elif i2v:image_prompt_types_allowed = "SEVL"@@ -628,6 +651,8 @@ class family_handler():if test_oneframe_overlap(base_model_type):extra_model_def["sliding_window_defaults"] = { "overlap_min" : 1, "overlap_max" : 1, "overlap_step": 0, "overlap_default": 1}+ elif svi2pro:+ extra_model_def["sliding_window_defaults"] = { "overlap_min" : 4, "overlap_max" : 4, "overlap_step": 0, "overlap_default": 4}# if base_model_type in ["phantom_1.3B", "phantom_14B"]:# extra_model_def["one_image_ref_needed"] = Truediff --git a/profiles/wan_2_2/Lightning t2v v1.0 3 Phases - 8 Steps.json b/profiles/wan_2_2/Lightning t2v v1.0 3 Phases - 8 Steps.jsonindex a308344..3f2692b 100644--- a/profiles/wan_2_2/Lightning t2v v1.0 3 Phases - 8 Steps.json+++ b/profiles/wan_2_2/Lightning t2v v1.0 3 Phases - 8 Steps.json@@ -14,5 +14,5 @@"https://huggingface.co/DeepBeepMeep/Wan2.2/resolve/main/loras_accelerators/Wan2.2-Lightning_T2V-v1.1-A14B-4steps-lora_LOW_fp16.safetensors"],"loras_multipliers": "0;1;0 0;0;1",- "help": "This finetune uses the Lightning 4 steps Loras Accelerator for Wan 2.2 but extend them to 8 steps in order to insert a CFG phase before the 2 accelerated phases with no Guidance. The ultimate goal is reduce the slow motion effect of these Loras Accelerators."+ "help": "This profile uses the Lightning 4 steps Loras Accelerator for Wan 2.2 but extend them to 8 steps in order to insert a CFG phase before the 2 accelerated phases with no Guidance. The ultimate goal is reduce the slow motion effect of these Loras Accelerators."}\ No newline at end of filediff --git a/profiles/wan_2_2/Lightning t2v v2025-09-28 3 Phases - 8 Steps.json b/profiles/wan_2_2/Lightning t2v v2025-09-28 3 Phases - 8 Steps.jsonindex 839e056..2c084fc 100644--- a/profiles/wan_2_2/Lightning t2v v2025-09-28 3 Phases - 8 Steps.json+++ b/profiles/wan_2_2/Lightning t2v v2025-09-28 3 Phases - 8 Steps.json@@ -14,5 +14,5 @@"https://huggingface.co/DeepBeepMeep/Wan2.2/resolve/main/loras_accelerators/Wan22_A14B_T2V_LOW_Lightning_4steps_lora_250928_rank64_fp16.safetensors"],"loras_multipliers": "0;1;0 0;0;1",- "help": "This finetune uses the Lightning 250928 4 steps Loras Accelerator for Wan 2.2 but extend them to 8 steps in order to insert a CFG phase before the 2 accelerated phases with no Guidance. The ultimate goal is reduce the slow motion effect of these Loras Accelerators."+ "help": "This profile uses the Lightning 250928 4 steps Loras Accelerator for Wan 2.2 but extend them to 8 steps in order to insert a CFG phase before the 2 accelerated phases with no Guidance. The ultimate goal is reduce the slow motion effect of these Loras Accelerators."}\ No newline at end of filediff --git a/requirements.txt b/requirements.txtindex a609e1a..3310f89 100644--- a/requirements.txt+++ b/requirements.txt@@ -57,7 +57,7 @@ pydantic==2.10.6# Math & modelingtorchdiffeq>=0.2.5tensordict>=0.6.1-mmgp==3.6.9+mmgp==3.6.10peft==0.15.0matplotlibdiff --git a/shared/qtypes/nunchaku_fp4.py b/shared/qtypes/nunchaku_fp4.pyindex c651cf5..d705563 100644--- a/shared/qtypes/nunchaku_fp4.py+++ b/shared/qtypes/nunchaku_fp4.py@@ -156,6 +156,19 @@ def _is_float8_dtype(dtype):return "float8" in str(dtype).lower() or "f8" in str(dtype).lower()+def _to_device(tensor, device):+ if tensor.device == device:+ return tensor+ return tensor.to(device)+++def _maybe_cast_fp16(tensor, dtype):+ if dtype in (torch.float16, torch.bfloat16):+ if tensor.dtype in (torch.float16, torch.bfloat16) and tensor.dtype != dtype:+ return tensor.to(dtype)+ return tensor++_FP4_LUT_BASE = torch.tensor([0.0, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 0.0, -0.5, -1.0, -1.5, -2.0, -3.0, -4.0, -6.0],dtype=torch.float32,@@ -488,37 +501,20 @@ class NunchakuSVDQWeightTensor(NunchakuBaseWeightTensor):requires_grad=False,):device = qweight.device if device is None else device- if qweight.device != device:- qweight = qweight.to(device)+ qweight = _to_device(qweight, device)+ wscales = _maybe_cast_fp16(_to_device(wscales, device), dtype)+ smooth_factor = _maybe_cast_fp16(_to_device(smooth_factor, device), dtype)+ proj_down = _maybe_cast_fp16(_to_device(proj_down, device), dtype)+ proj_up = _maybe_cast_fp16(_to_device(proj_up, device), dtype)+if not torch.is_tensor(wtscale):wtscale = torch.tensor([1.0 if wtscale is None else float(wtscale)], device=device, dtype=dtype)+ else:+ wtscale = _maybe_cast_fp16(_to_device(wtscale, device), dtype)if not torch.is_tensor(wcscales):wcscales = torch.ones(qweight.size(0), device=device, dtype=dtype)- if wscales.device != device:- wscales = wscales.to(device)- if smooth_factor.device != device:- smooth_factor = smooth_factor.to(device)- if proj_down.device != device:- proj_down = proj_down.to(device)- if proj_up.device != device:- proj_up = proj_up.to(device)- if torch.is_tensor(wtscale) and wtscale.device != device:- wtscale = wtscale.to(device)- if torch.is_tensor(wcscales) and wcscales.device != device:- wcscales = wcscales.to(device)- if dtype in (torch.float16, torch.bfloat16):- if wscales.dtype in (torch.float16, torch.bfloat16) and wscales.dtype != dtype:- wscales = wscales.to(dtype)- if smooth_factor.dtype in (torch.float16, torch.bfloat16) and smooth_factor.dtype != dtype:- smooth_factor = smooth_factor.to(dtype)- if proj_down.dtype in (torch.float16, torch.bfloat16) and proj_down.dtype != dtype:- proj_down = proj_down.to(dtype)- if proj_up.dtype in (torch.float16, torch.bfloat16) and proj_up.dtype != dtype:- proj_up = proj_up.to(dtype)- if torch.is_tensor(wtscale) and wtscale.dtype in (torch.float16, torch.bfloat16) and wtscale.dtype != dtype:- wtscale = wtscale.to(dtype)- if torch.is_tensor(wcscales) and wcscales.dtype in (torch.float16, torch.bfloat16) and wcscales.dtype != dtype:- wcscales = wcscales.to(dtype)+ else:+ wcscales = _maybe_cast_fp16(_to_device(wcscales, device), dtype)return NunchakuSVDQWeightTensor(qtype=_NUNCHAKU_FP4_QTYPE,axis=0,@@ -851,17 +847,9 @@ class NunchakuAWQWeightTensor(NunchakuBaseWeightTensor):requires_grad=False,):device = qweight.device if device is None else device- if qweight.device != device:- qweight = qweight.to(device)- if wscales.device != device:- wscales = wscales.to(device)- if wzeros.device != device:- wzeros = wzeros.to(device)- if dtype in (torch.float16, torch.bfloat16):- if wscales.dtype in (torch.float16, torch.bfloat16) and wscales.dtype != dtype:- wscales = wscales.to(dtype)- if wzeros.dtype in (torch.float16, torch.bfloat16) and wzeros.dtype != dtype:- wzeros = wzeros.to(dtype)+ qweight = _to_device(qweight, device)+ wscales = _maybe_cast_fp16(_to_device(wscales, device), dtype)+ wzeros = _maybe_cast_fp16(_to_device(wzeros, device), dtype)return NunchakuAWQWeightTensor(qtype=_NUNCHAKU_FP4_QTYPE,axis=0,@@ -1140,45 +1128,36 @@ class QLinearNunchakuFp4(QModuleMixin, torch.nn.Linear):)_load_nunchaku_ops()-- qweight_key = prefix + "qweight"- wscales_key = prefix + "wscales"- smooth_key = prefix + "smooth_factor"- smooth_orig_key = prefix + "smooth_factor_orig"- proj_down_key = prefix + "proj_down"- proj_up_key = prefix + "proj_up"- wtscale_key = prefix + "wtscale"- wcscales_key = prefix + "wcscales"- bias_key = prefix + "bias"- input_scale_key = prefix + "input_scale"- output_scale_key = prefix + "output_scale"-- qweight = state_dict.pop(qweight_key, None)- wscales = state_dict.pop(wscales_key, None)- smooth_factor = state_dict.pop(smooth_key, None)- state_dict.pop(smooth_orig_key, None)- proj_down = state_dict.pop(proj_down_key, None)- proj_up = state_dict.pop(proj_up_key, None)- wtscale = state_dict.pop(wtscale_key, None)- wcscales = state_dict.pop(wcscales_key, None)- bias = state_dict.pop(bias_key, None)- input_scale = state_dict.pop(input_scale_key, None)- output_scale = state_dict.pop(output_scale_key, None)-- if qweight is None:- missing_keys.append(qweight_key)- if wscales is None:- missing_keys.append(wscales_key)++ def _pop(name):+ return state_dict.pop(prefix + name, None)++ def _require(name, tensor):+ if tensor is None:+ missing_keys.append(prefix + name)++ qweight = _pop("qweight")+ wscales = _pop("wscales")+ wzeros = _pop("wzeros")+ smooth_factor = _pop("smooth_factor")+ state_dict.pop(prefix + "smooth_factor_orig", None)+ proj_down = _pop("proj_down")+ proj_up = _pop("proj_up")+ wtscale = _pop("wtscale")+ wcscales = _pop("wcscales")+ bias = _pop("bias")+ input_scale = _pop("input_scale")+ output_scale = _pop("output_scale")++ _require("qweight", qweight)+ _require("wscales", wscales)target_dtype = self._nunchaku_default_dtype or self.weight.dtypeif qweight is not None and wscales is not None:if qweight.dtype == torch.int8:- if smooth_factor is None:- missing_keys.append(smooth_key)- if proj_down is None:- missing_keys.append(proj_down_key)- if proj_up is None:- missing_keys.append(proj_up_key)+ _require("smooth_factor", smooth_factor)+ _require("proj_down", proj_down)+ _require("proj_up", proj_up)if smooth_factor is not None and proj_down is not None and proj_up is not None:scale_device = qweight.devicescale_dtype = target_dtype or self.weight.dtype@@ -1201,6 +1180,23 @@ class QLinearNunchakuFp4(QModuleMixin, torch.nn.Linear):requires_grad=False,)self.weight = torch.nn.Parameter(nunchaku_weight, requires_grad=False)+ elif qweight.dtype == torch.int32:+ _require("wzeros", wzeros)+ if wzeros is not None:+ nunchaku_weight = NunchakuAWQWeightTensor.create(+ qweight=qweight,+ wscales=wscales,+ wzeros=wzeros,+ size=self.weight.size(),+ stride=self.weight.stride(),+ dtype=target_dtype,+ device=qweight.device,+ requires_grad=False,+ )+ self.weight = torch.nn.Parameter(nunchaku_weight, requires_grad=False)+ if prefix.endswith("img_mod.1.") or prefix.endswith("txt_mod.1."):+ self._nunchaku_mod_reorder = True+ self._nunchaku_mod_scale_shift = Trueif bias is not None:if target_dtype is not None and bias.dtype != target_dtype:@@ -1234,6 +1230,14 @@ class QLinearNunchakuFp4(QModuleMixin, torch.nn.Linear):def _collect_nunchaku_specs(state_dict):+ has_fp4 = False+ for key, tensor in state_dict.items():+ if key.endswith(".wscales") and _is_float8_dtype(tensor.dtype):+ has_fp4 = True+ break+ if not has_fp4:+ return []+specs = []for key, tensor in state_dict.items():if not key.endswith(".qweight"):@@ -1242,15 +1246,16 @@ def _collect_nunchaku_specs(state_dict):wscales = state_dict.get(base + ".wscales", None)if wscales is None:continue- if not _is_float8_dtype(wscales.dtype):- continue- if tensor.dtype == torch.int8:+ if tensor.dtype == torch.int8 and _is_float8_dtype(wscales.dtype):if (base + ".smooth_factor" in state_dictand base + ".proj_down" in state_dictand base + ".proj_up" in state_dict):specs.append({"name": base, "kind": "svdq"})+ elif tensor.dtype == torch.int32:+ if base + ".wzeros" in state_dict:+ specs.append({"name": base, "kind": "awq"})return specsdiff --git a/shared/qtypes/nunchaku_int4.py b/shared/qtypes/nunchaku_int4.pyindex 60eb082..b19fa68 100644--- a/shared/qtypes/nunchaku_int4.py+++ b/shared/qtypes/nunchaku_int4.py@@ -1099,6 +1099,9 @@ class QLinearNunchakuInt4(QModuleMixin, torch.nn.Linear):def _collect_nunchaku_specs(state_dict):+ for key, tensor in state_dict.items():+ if key.endswith(".wscales") and _is_float8_dtype(tensor.dtype):+ return []specs = []for key, tensor in state_dict.items():if not key.endswith(".qweight"):diff --git a/shared/utils/loras_mutipliers.py b/shared/utils/loras_mutipliers.pyindex dda8056..42a6cf9 100644--- a/shared/utils/loras_mutipliers.py+++ b/shared/utils/loras_mutipliers.py@@ -35,7 +35,7 @@ def expand_slist(slists_dict, mult_no, num_inference_steps, model_switch_step, mif isinstance(phase1, float) and isinstance(phase2, float) and isinstance(phase3, float) and phase1 == phase2 and phase2 == phase3: return phase1return expand_one(phase1, model_switch_step) + expand_one(phase2, model_switch_step2 - model_switch_step) + expand_one(phase3, num_inference_steps - model_switch_step2)-def parse_loras_multipliers(loras_multipliers, nb_loras, num_inference_steps, merge_slist = None, nb_phases = 2, model_switch_step = None, model_switch_step2 = None):+def parse_loras_multipliers(loras_multipliers, nb_loras, num_inference_steps, merge_slist = None, nb_phases = 2, model_switch_step = None, model_switch_step2 = None, model_switch_phase = 1):if "|" in loras_multipliers:pos = loras_multipliers.find("|")if "|" in loras_multipliers[pos+1:]: return "", "", "There can be only one '|' character in Loras Multipliers Sequence"@@ -69,7 +69,9 @@ def parse_loras_multipliers(loras_multipliers, nb_loras, num_inference_steps, mephase_mult = mult.split(";")shared_phases = len(phase_mult) <=1if not shared_phases and len(phase_mult) != nb_phases :- return "", "", f"if the ';' syntax is used for one Lora multiplier, the multipliers for its {nb_phases} denoising phases should be specified for this multiplier"+ if len(phase_mult) > nb_phases:+ return "", "", f"if the ';' syntax is used for one Lora multiplier, there should be at most {nb_phases} phases for this multiplier"+ phase_mult = (phase_mult[:1] + phase_mult) if model_switch_phase == 2 else (phase_mult + phase_mult[-1:])for phase_no, mult in enumerate(phase_mult):if phase_no == 1:current_phase = phase2diff --git a/wgp.py b/wgp.pyindex 2fc6904..d8e1b1f 100644--- a/wgp.py+++ b/wgp.py@@ -85,8 +85,8 @@ AUTOSAVE_PATH = AUTOSAVE_FILENAMEAUTOSAVE_TEMPLATE_PATH = AUTOSAVE_FILENAMECONFIG_FILENAME = "wgp_config.json"PROMPT_VARS_MAX = 10-target_mmgp_version = "3.6.9"-WanGP_version = "9.91"+target_mmgp_version = "3.6.10"+WanGP_version = "10.0"settings_version = 2.41max_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@@ -4938,7 +4938,7 @@ def truncate_audio(generated_audio, trim_video_frames_beginning, trim_video_framend = len(generated_audio) - int(trim_video_frames_end * samples_per_frame)return generated_audio[start:end if end > 0 else None]-def custom_preprocess_video_with_mask(model_handler, base_model_type, pre_video_guide, video_guide, video_mask, height, width, max_frames, start_frame, fit_canvas, fit_crop, target_fps, block_size, expand_scale, video_prompt_type):+def custom_preprocess_video_with_mask(model_handler, base_model_type, model_def, pre_video_guide, video_guide, video_mask, height, width, max_frames, start_frame, fit_canvas, fit_crop, target_fps, block_size, expand_scale, video_prompt_type):pad_frames = 0if start_frame < 0:pad_frames= -start_frame@@ -4980,7 +4980,7 @@ def custom_preprocess_video_with_mask(model_handler, base_model_type, pre_video_if video_guide.shape[1] == 0 or any_mask and video_mask.shape[1] == 0:return None, None, None, None- video_guide_processed, video_guide_processed2, video_mask_processed, video_mask_processed2 = model_handler.custom_preprocess(base_model_type = base_model_type, pre_video_guide = pre_video_guide, video_guide = video_guide, video_mask = video_mask, height = height, width = width, fit_canvas = fit_canvas , fit_crop = fit_crop, target_fps = target_fps, block_size = block_size, max_workers = max_workers, expand_scale = expand_scale, video_prompt_type=video_prompt_type)+ video_guide_processed, video_guide_processed2, video_mask_processed, video_mask_processed2 = model_handler.custom_preprocess(base_model_type = base_model_type, model_def = model_def, pre_video_guide = pre_video_guide, video_guide = video_guide, video_mask = video_mask, height = height, width = width, fit_canvas = fit_canvas , fit_crop = fit_crop, target_fps = target_fps, block_size = block_size, max_workers = max_workers, expand_scale = expand_scale, video_prompt_type=video_prompt_type)# if pad_frames > 0:# masked_frames = masked_frames[0] * pad_frames + masked_frames@@ -5194,18 +5194,18 @@ def generate_video(transformer_loras_filenames, transformer_loras_multipliers = get_transformer_loras(model_type)if guidance_phases < 1: guidance_phases = 1if transformer_loras_filenames != None:- loras_list_mult_choices_nums, loras_slists, errors = parse_loras_multipliers(transformer_loras_multipliers, len(transformer_loras_filenames), num_inference_steps, nb_phases = guidance_phases )+ loras_list_mult_choices_nums, loras_slists, errors = parse_loras_multipliers(transformer_loras_multipliers, len(transformer_loras_filenames), num_inference_steps, nb_phases = guidance_phases, model_switch_phase= model_switch_phase )if len(errors) > 0: raise Exception(f"Error parsing Transformer Loras: {errors}")loras_selected = transformer_loras_filenamesif hasattr(wan_model, "get_loras_transformer"):extra_loras_transformers, extra_loras_multipliers = wan_model.get_loras_transformer(get_model_recursive_prop, **locals())- loras_list_mult_choices_nums, loras_slists, errors = parse_loras_multipliers(extra_loras_multipliers, len(extra_loras_transformers), num_inference_steps, nb_phases = guidance_phases, merge_slist= loras_slists )+ loras_list_mult_choices_nums, loras_slists, errors = parse_loras_multipliers(extra_loras_multipliers, len(extra_loras_transformers), num_inference_steps, nb_phases = guidance_phases, merge_slist= loras_slists, model_switch_phase= model_switch_phase )if len(errors) > 0: raise Exception(f"Error parsing Extra Transformer Loras: {errors}")loras_selected += extra_loras_transformersif len(activated_loras) > 0:- loras_list_mult_choices_nums, loras_slists, errors = parse_loras_multipliers(loras_multipliers, len(activated_loras), num_inference_steps, nb_phases = guidance_phases, merge_slist= loras_slists )+ loras_list_mult_choices_nums, loras_slists, errors = parse_loras_multipliers(loras_multipliers, len(activated_loras), num_inference_steps, nb_phases = guidance_phases, merge_slist= loras_slists, model_switch_phase= model_switch_phase )if len(errors) > 0: raise Exception(f"Error parsing Loras: {errors}")lora_dir = get_lora_dir(model_type)errors = check_loras_exist(model_type, activated_loras, True, send_cmd)@@ -5237,7 +5237,9 @@ def generate_video(if sliding_window_size !=0:sliding_window_size = (sliding_window_size -1) // latent_size * latent_size + 1if sliding_window_overlap !=0:- sliding_window_overlap = (sliding_window_overlap -1) // latent_size * latent_size + 1+ sliding_window_defaults = model_def.get("sliding_window_defaults", {})+ if sliding_window_defaults.get("overlap_default", 0) != sliding_window_overlap:+ sliding_window_overlap = (sliding_window_overlap -1) // latent_size * latent_size + 1if sliding_window_discard_last_frames !=0:sliding_window_discard_last_frames = sliding_window_discard_last_frames // latent_size * latent_size@@ -5486,7 +5488,7 @@ def generate_video(gen["window_no"] = window_noreturn_latent_slice = Noneif reuse_frames > 0:- return_latent_slice = slice(-(reuse_frames - 1 + discard_last_frames ) // latent_size - 1, None if discard_last_frames == 0 else -(discard_last_frames // latent_size) )+ return_latent_slice = slice(- min(1, (reuse_frames + discard_last_frames ) // latent_size) , None if discard_last_frames == 0 else -(discard_last_frames // latent_size) )refresh_preview = {"image_guide" : image_guide, "image_mask" : image_mask} if image_mode >= 1 else {}image_start_tensor = image_end_tensor = None@@ -5853,6 +5855,7 @@ def generate_video(offloadobj = offloadobj,set_header_text= set_header_text,pre_video_frame = pre_video_frame,+ prefix_video = prefix_video,original_input_ref_images = original_image_refs[nb_frames_positions:] if original_image_refs is not None else [],image_refs_relative_size = image_refs_relative_size,outpainting_dims = outpainting_dims,@@ -5908,6 +5911,7 @@ def generate_video(print(f"Skipped Steps:{skip_steps_cache.skipped_steps}/{skip_steps_cache.num_steps}" )generated_audio = NoneBGRA_frames = None+ post_decode_pre_trim = 0output_audio_sampling_rate= audio_sampling_rateif samples != None:if isinstance(samples, dict):@@ -5915,7 +5919,9 @@ def generate_video(BGRA_frames = samples.get("BGRA_frames", None)generated_audio = samples.get("audio", generated_audio)output_audio_sampling_rate = samples.get("audio_sampling_rate", audio_sampling_rate)+ post_decode_pre_trim = samples.get("post_decode_pre_trim", 0)samples = samples.get("x", None)+if samples is not None:samples = samples.to("cpu")clear_gen_cache()@@ -5939,6 +5945,8 @@ def generate_video(# torch.save(sample, "output.pt")# else:# sample =torch.load("output.pt")+ if post_decode_pre_trim > 0 :+ sample = sample[:, post_decode_pre_trim:]if gen.get("extra_windows",0) > 0:sliding_window = Trueif sliding_window :@@ -5956,9 +5964,13 @@ def generate_video(pre_video_guide = sample[:, -reuse_frames:].clone()- if prefix_video != None and window_no == 1:- # remove source video overlapped frames at the beginning of the generation- sample = torch.cat([ prefix_video[:, :-source_video_overlap_frames_count], sample], dim = 1)+ if prefix_video != None and window_no == 1 :+ if prefix_video.shape[1] > 1:+ # remove sliding window overlapped frames at the beginning of the generation+ sample = torch.cat([ prefix_video, sample[: , source_video_overlap_frames_count:]], dim = 1)+ else:+ # remove source video overlapped frames at the beginning of the generation if there is only a start frame+ sample = torch.cat([ prefix_video[:, :-source_video_overlap_frames_count], sample], dim = 1)guide_start_frame -= source_video_overlap_frames_countif generated_audio is not None:generated_audio = truncate_audio(generated_audio, source_video_overlap_frames_count, 0, fps, audio_sampling_rate)@@ -8820,7 +8832,7 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Nonchoices= image_ref_choices["choices"],value=filter_letters(video_prompt_type_value, image_ref_choices["letters_filter"]),visible = (dropdown_selectable or image_ref_inpaint) and image_ref_choices.get("visible", True),- label=image_ref_choices.get("label", "Inject Reference Images"), show_label= True, scale = 1+ label=image_ref_choices.get("label", "Inject Reference Images"), show_label= image_ref_choices.get("show_label", True), scale = 1)image_guide = gr.Image(label= "Control Image", height = 800, type ="pil", visible= image_mode_value==1 and "V" in video_prompt_type_value and ("U" in video_prompt_type_value or "A" not in video_prompt_type_value ) , value= ui_defaults.get("image_guide", None))@@ -9066,9 +9078,9 @@ def generate_video_tab(update_form = False, state_dict = None, ui_defaults = Nonswitch_threshold = gr.Slider(0, 1000, value=ui_get("switch_threshold"), step=1, label = label, visible= guidance_max_phases >= 2 and guidance_phases_value >= 2, show_reset_button= False)switch_threshold2 = gr.Slider(0, 1000, value=ui_get("switch_threshold2"), step=1, label="Phase 2-3", visible= guidance_max_phases >= 3 and guidance_phases_value >= 3, show_reset_button= False)with gr.Row(visible = guidance_max_phases >=1 ) as guidance_row:- guidance_scale = gr.Slider(1.0, 20.0, value=ui_get("guidance_scale"), step=0.5, label="Guidance (CFG)", visible=guidance_max_phases >=1, show_reset_button= False )- guidance2_scale = gr.Slider(1.0, 20.0, value=ui_get("guidance2_scale"), step=0.5, label="Guidance2 (CFG)", visible= guidance_max_phases >=2 and guidance_phases_value >= 2, show_reset_button= False)- guidance3_scale = gr.Slider(1.0, 20.0, value=ui_get("guidance3_scale"), step=0.5, label="Guidance3 (CFG)", visible= guidance_max_phases >=3 and guidance_phases_value >= 3, show_reset_button= False)+ guidance_scale = gr.Slider(1.0, 20.0, value=ui_get("guidance_scale"), step=0.1, label="Guidance (CFG)", visible=guidance_max_phases >=1, show_reset_button= False )+ guidance2_scale = gr.Slider(1.0, 20.0, value=ui_get("guidance2_scale"), step=0.1, label="Guidance2 (CFG)", visible= guidance_max_phases >=2 and guidance_phases_value >= 2, show_reset_button= False)+ guidance3_scale = gr.Slider(1.0, 20.0, value=ui_get("guidance3_scale"), step=0.1, label="Guidance3 (CFG)", visible= guidance_max_phases >=3 and guidance_phases_value >= 3, show_reset_button= False)any_audio_guidance = model_def.get("audio_guidance", False)any_embedded_guidance = model_def.get("embedded_guidance", False)