From db86a1b838cd6e0bf23209823be3169c6de6d3e0 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Wed, 13 Aug 2025 19:26:48 +0300 Subject: [PATCH] Update nodes.py --- nodes.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/nodes.py b/nodes.py index bef7873..bbe302f 100644 --- a/nodes.py +++ b/nodes.py @@ -1700,16 +1700,17 @@ class WanVideoSampler: if control_embeds is not None: if transformer.in_dim not in [52, 48, 36, 32]: raise ValueError("Control signal only works with Fun-Control model") - if transformer.in_dim in [52, 36]: #fun 2.2 control + if transformer.in_dim == 52 or transformer.control_adapter is not None: #fun 2.2 control image_cond_mask = image_embeds.get("mask", None) if image_cond_mask is not None: image_cond = torch.cat([image_cond_mask, image_cond]) control_latents = control_embeds.get("control_images", None) - control_camera_latents = control_embeds.get("control_camera_latents", None) - control_camera_start_percent = control_embeds.get("control_camera_start_percent", 0.0) - control_camera_end_percent = control_embeds.get("control_camera_end_percent", 1.0) - control_start_percent = control_embeds.get("start_percent", 0.0) - control_end_percent = control_embeds.get("end_percent", 1.0) + if transformer.control_adapter is not None: + control_camera_latents = control_embeds.get("control_camera_latents", None) + control_camera_start_percent = control_embeds.get("control_camera_start_percent", 0.0) + control_camera_end_percent = control_embeds.get("control_camera_end_percent", 1.0) + control_start_percent = control_embeds.get("start_percent", 0.0) + control_end_percent = control_embeds.get("end_percent", 1.0) drop_last = image_embeds.get("drop_last", False) has_ref = image_embeds.get("has_ref", False) else: #t2v @@ -1776,11 +1777,12 @@ class WanVideoSampler: control_latents = control_embeds.get("control_images", None) if control_latents is not None: control_latents = control_latents.to(device) - control_camera_latents = control_embeds.get("control_camera_latents", None) - control_camera_start_percent = control_embeds.get("control_camera_start_percent", 0.0) - control_camera_end_percent = control_embeds.get("control_camera_end_percent", 1.0) - if control_camera_latents is not None: - control_camera_latents = control_camera_latents.to(device) + if transformer.control_adapter is not None: + control_camera_latents = control_embeds.get("control_camera_latents", None) + control_camera_start_percent = control_embeds.get("control_camera_start_percent", 0.0) + control_camera_end_percent = control_embeds.get("control_camera_end_percent", 1.0) + if control_camera_latents is not None: + control_camera_latents = control_camera_latents.to(device) if control_lora: image_cond = control_latents.to(device) @@ -1789,10 +1791,10 @@ class WanVideoSampler: patcher = apply_lora(patcher, device, device, low_mem_load=False, control_lora=True) patcher.model.is_patched = True else: - if transformer.in_dim not in [48, 32, 52]: + if transformer.in_dim not in [48, 36, 32, 52]: raise ValueError("Control signal only works with Fun-Control model") image_cond = torch.zeros_like(noise).to(device) #fun control - if transformer.in_dim == 52: #fun 2.2 control + if transformer.in_dim == 52 or transformer.control_adapter is not None: #fun 2.2 control mask_latents = torch.tile( torch.zeros_like(noise[:1]), [4, 1, 1, 1] )