Support lucy edit

This commit is contained in:
kijai
2025-09-22 15:34:48 +03:00
parent 95cd0ef690
commit 1c7e32d8af
2 changed files with 34 additions and 0 deletions
+21
View File
@@ -1230,6 +1230,25 @@ class WanVideoAddExtraLatent:
updated = dict(embeds)
updated["extra_latents"] = extra_latents_list
return (updated,)
class WanVideoAddLucyEditLatents:
@classmethod
def INPUT_TYPES(s):
return {"required": {
"embeds": ("WANVIDIMAGE_EMBEDS",),
"extra_latents": ("LATENT",),
}
}
RETURN_TYPES = ("WANVIDIMAGE_EMBEDS",)
RETURN_NAMES = ("image_embeds",)
FUNCTION = "add"
CATEGORY = "WanVideoWrapper"
def add(self, embeds, extra_latents):
updated = dict(embeds)
updated["extra_channel_latents"] = extra_latents["samples"]
return (updated,)
class WanVideoMiniMaxRemoverEmbeds:
@classmethod
@@ -2126,6 +2145,7 @@ NODE_CLASS_MAPPINGS = {
"WanVideoRoPEFunction": WanVideoRoPEFunction,
"WanVideoAddPusaNoise": WanVideoAddPusaNoise,
"WanVideoAnimateEmbeds": WanVideoAnimateEmbeds,
"WanVideoAddLucyEditLatents": WanVideoAddLucyEditLatents,
}
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -2163,4 +2183,5 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"WanVideoRoPEFunction": "WanVideo RoPE Function",
"WanVideoAddPusaNoise": "WanVideo Add Pusa Noise",
"WanVideoAnimateEmbeds": "WanVideo Animate Embeds",
"WanVideoAddLucyEditLatents": "WanVideo Add LucyEdit Latents",
}
+13
View File
@@ -791,6 +791,11 @@ class WanVideoSampler:
noise_multipliers[idx] = noise_multiplier_list[i]
log.info(f"Using Pusa noise multipliers: {noise_multipliers}")
# lucy edit
extra_channel_latents = image_embeds.get("extra_channel_latents", None)
if extra_channel_latents is not None:
extra_channel_latents = extra_channel_latents[0].to(noise)
latent = noise.to(device)
#controlnet
@@ -1171,6 +1176,14 @@ class WanVideoSampler:
humo_audio_input_neg = None
else:
humo_audio_input = humo_audio_input_neg = None
if extra_channel_latents is not None:
if context_window is not None:
extra_channel_latents_input = extra_channel_latents[:, context_window].to(z)
else:
extra_channel_latents_input = extra_channel_latents.to(z)
z = torch.cat([z, extra_channel_latents_input])
base_params = {
'x': [z], # latent
'y': [image_cond_input] if image_cond_input is not None else None, # image cond