standin: added warning if image is missing

This commit is contained in:
deepbeepmeep 2025-08-30 11:42:40 +02:00
parent e15afefb3d
commit 9e0354e14f

View File

@ -777,19 +777,22 @@ class WanAny2V:
if standin: if standin:
from preprocessing.face_preprocessor import FaceProcessor from preprocessing.face_preprocessor import FaceProcessor
standin_ref_pos = 1 if "K" in video_prompt_type else 0 standin_ref_pos = 1 if "K" in video_prompt_type else 0
if len(original_input_ref_images) < standin_ref_pos + 1: raise Exception("Missing Standin ref image") if len(original_input_ref_images) < standin_ref_pos + 1:
standin_ref_pos = -1 if "I" in video_prompt_type:
image_ref = original_input_ref_images[standin_ref_pos] print("Warning: Missing Standin ref image, make sure 'Inject only People / Objets' is selected or if there is 'Landscape and then People or Objects' there are at least two ref images.")
image_ref.save("si.png") else:
# face_processor = FaceProcessor(antelopv2_path="ckpts/antelopev2") standin_ref_pos = -1
face_processor = FaceProcessor() image_ref = original_input_ref_images[standin_ref_pos]
standin_ref = face_processor.process(image_ref, remove_bg = model_type in ["vace_standin_14B"]) image_ref.save("si.png")
face_processor = None # face_processor = FaceProcessor(antelopv2_path="ckpts/antelopev2")
gc.collect() face_processor = FaceProcessor()
torch.cuda.empty_cache() standin_ref = face_processor.process(image_ref, remove_bg = model_type in ["vace_standin_14B"])
standin_freqs = get_nd_rotary_pos_embed((-1, int(target_shape[-2]/2), int(target_shape[-1]/2) ), (-1, int(target_shape[-2]/2 + standin_ref.height/16), int(target_shape[-1]/2 + standin_ref.width/16) )) face_processor = None
standin_ref = self.vae.encode([ convert_image_to_tensor(standin_ref).unsqueeze(1) ], VAE_tile_size)[0].unsqueeze(0) gc.collect()
kwargs.update({ "standin_freqs": standin_freqs, "standin_ref": standin_ref, }) torch.cuda.empty_cache()
standin_freqs = get_nd_rotary_pos_embed((-1, int(target_shape[-2]/2), int(target_shape[-1]/2) ), (-1, int(target_shape[-2]/2 + standin_ref.height/16), int(target_shape[-1]/2 + standin_ref.width/16) ))
standin_ref = self.vae.encode([ convert_image_to_tensor(standin_ref).unsqueeze(1) ], VAE_tile_size)[0].unsqueeze(0)
kwargs.update({ "standin_freqs": standin_freqs, "standin_ref": standin_ref, })
# Steps Skipping # Steps Skipping