Allow scheduling phantom cfg too
This commit is contained in:
@@ -2517,6 +2517,8 @@ class WanVideoSampler:
|
||||
|
||||
phantom_latents = image_embeds.get("phantom_latents", None)
|
||||
phantom_cfg_scale = image_embeds.get("phantom_cfg_scale", None)
|
||||
if not isinstance(phantom_cfg_scale, list):
|
||||
phantom_cfg_scale = [phantom_cfg_scale] * (steps +1)
|
||||
phantom_start_percent = image_embeds.get("phantom_start_percent", 0.0)
|
||||
phantom_end_percent = image_embeds.get("phantom_end_percent", 1.0)
|
||||
if phantom_latents is not None:
|
||||
@@ -2962,7 +2964,7 @@ class WanVideoSampler:
|
||||
)
|
||||
noise_pred_uncond = noise_pred_uncond[0].to(intermediate_device)
|
||||
#phantom
|
||||
if use_phantom:
|
||||
if use_phantom and not math.isclose(phantom_cfg_scale[idx], 1.0):
|
||||
noise_pred_phantom, teacache_state_phantom = transformer(
|
||||
[z_phantom_img], context=negative_embeds, clip_fea=clip_fea_neg if clip_fea_neg is not None else clip_fea,
|
||||
y=[image_cond_input] if image_cond_input is not None else None,
|
||||
@@ -2973,7 +2975,7 @@ class WanVideoSampler:
|
||||
)
|
||||
noise_pred_phantom = noise_pred_phantom[0].to(intermediate_device)
|
||||
|
||||
noise_pred = noise_pred_uncond + phantom_cfg_scale * (noise_pred_phantom - noise_pred_uncond) + cfg_scale * (noise_pred_cond - noise_pred_phantom)
|
||||
noise_pred = noise_pred_uncond + phantom_cfg_scale[idx] * (noise_pred_phantom - noise_pred_uncond) + cfg_scale * (noise_pred_cond - noise_pred_phantom)
|
||||
return noise_pred, [teacache_state_cond, teacache_state_uncond, teacache_state_phantom]
|
||||
#fantasytalking
|
||||
if fantasytalking_embeds is not None:
|
||||
|
||||
Reference in New Issue
Block a user