From 5606519085b40c81cca771ecbdde9af92ca56f8d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 18 Sep 2025 11:40:01 -0400 Subject: [PATCH] wan init image fix Signed-off-by: Vladimir Mandic --- modules/processing_args.py | 4 ++-- modules/video_models/video_overrides.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/processing_args.py b/modules/processing_args.py index 267d779f1..98a295ca1 100644 --- a/modules/processing_args.py +++ b/modules/processing_args.py @@ -126,9 +126,9 @@ def task_specific_kwargs(p, model): 'target_subject_category': getattr(p, 'prompt', '').split()[-1], 'output_type': 'pil', } - if model.__class__.__name__ == 'WanImageToVideoPipeline' and hasattr(p, 'init_images') and len(p.init_images) > 0: + if (model.__class__.__name__ == 'WanImageToVideoPipeline') and (getattr(p, 'init_images', None) is not None) and (len(p.init_images) > 0): task_args['image'] = p.init_images[0] - if model.__class__.__name__ == 'WanVACEPipeline' and hasattr(p, 'init_images') and len(p.init_images) > 0: + if (model.__class__.__name__ == 'WanVACEPipeline') and (getattr(p, 'init_images', None) is not None) and (len(p.init_images) > 0): task_args['reference_images'] = p.init_images if debug_enabled: diff --git a/modules/video_models/video_overrides.py b/modules/video_models/video_overrides.py index 53c2915ee..057ae3f8a 100644 --- a/modules/video_models/video_overrides.py +++ b/modules/video_models/video_overrides.py @@ -50,4 +50,5 @@ def set_overrides(p: processing.StableDiffusionProcessingVideo, selected: Model) p.frames = 4 * (max(p.frames // 4, 1)) + 1 # WAN VACE if 'WanVACEPipeline' in cls: - p.task_args['reference_images'] = 1 + if (getattr(p, 'init_images', None) is not None) and (len(p.init_images) > 0): + p.task_args['reference_images'] = p.init_images