diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e10ecf1..fefdccf64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ Less than 2 weeks since last release, here's a service-pack style update with a - when using **shared-t5** *(default)*, it will load standard or pre-quant depending on model - enhanced LoRA support for **Wan-2.2-14B** - log available attention mechanisms on startup + - support for switching back-and-forth **t2i** and **t2v** for *wan-2.x* models - **Fixes** - startup error with `--profile` enabled if using `--skip` - restore orig init image for each batch sequence @@ -90,6 +91,7 @@ Less than 2 weeks since last release, here's a service-pack style update with a - video use pre-quantized text-encoder if selected model is pre-quantized - handle sparse `controlnet` models - catch `xet` warnings + - avoid unnecessary pipe variant switching - validate pipelines on import ## Update for 2025-10-18 diff --git a/modules/images.py b/modules/images.py index d93170be8..7a65c7df3 100644 --- a/modules/images.py +++ b/modules/images.py @@ -157,6 +157,10 @@ def save_image(image, if image is None: shared.log.warning('Image is none') return None, None, None + if isinstance(image, list): + if len(image) > 1: + shared.log.warning(f'Save: images={image} multiple images provided only the first one will be saved') + image = image[0] if not check_grid_size([image]): return None, None, None if path is None or path == '': # set default path to avoid errors when functions are triggered manually or via api and param is not set diff --git a/modules/images_grid.py b/modules/images_grid.py index 8f7b290ff..5827bdb95 100644 --- a/modules/images_grid.py +++ b/modules/images_grid.py @@ -13,7 +13,11 @@ def check_grid_size(imgs): return False mp = 0 for img in imgs: - mp += img.width * img.height if img is not None else 0 + if isinstance(img, list): + for im in img: + mp += im.width * im.height if im is not None else 0 + else: + mp += img.width * img.height if img is not None else 0 mp = round(mp / 1000000) ok = mp <= shared.opts.img_max_size_mp if not ok: diff --git a/modules/images_namegen.py b/modules/images_namegen.py index 083d3c6b1..7382462b8 100644 --- a/modules/images_namegen.py +++ b/modules/images_namegen.py @@ -84,9 +84,9 @@ class FilenameGenerator: self.prompt = p.prompt if p is not None and getattr(p, 'prompt', '') != '' else '' if isinstance(self.prompt, list): self.prompt = ' '.join(self.prompt) - self.image = image - self.width = width if width is not None else (image.width if image is not None else (p.width if p is not None else 0)) - self.height = height if height is not None else (image.height if image is not None else (p.height if p is not None else 0)) + self.image = image[0] if isinstance(image, list) and len(image) > 0 else image + self.width = width if width is not None else (self.image.width if self.image is not None else (p.width if p is not None else 0)) + self.height = height if height is not None else (self.image.height if self.image is not None else (p.height if p is not None else 0)) if not grid: self.batch_number = NOTHING if self.p is None or getattr(self.p, 'batch_size', 1) == 1 else (self.p.batch_index + 1 if hasattr(self.p, 'batch_index') else NOTHING) self.iter_number = NOTHING if self.p is None or getattr(self.p, 'n_iter', 1) == 1 else (self.p.iteration + 1 if hasattr(self.p, 'iteration') else NOTHING) diff --git a/modules/processing.py b/modules/processing.py index 2e732ca77..df70e10e5 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -285,6 +285,11 @@ def process_samples(p: StableDiffusionProcessing, samples): sample = validate_sample(sample) image = Image.fromarray(sample) + if isinstance(image, list): + if len(image) > 1: + shared.log.warning(f'Processing: images={image} contains multiple images using first one only') + image = image[0] + if not shared.state.interrupted and not shared.state.skipped: if p.restore_faces: diff --git a/modules/processing_class.py b/modules/processing_class.py index 29990e4b4..2ebfae677 100644 --- a/modules/processing_class.py +++ b/modules/processing_class.py @@ -483,9 +483,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): self.width = int(vae_scale_factor * (self.init_images[0].width * self.scale_by // vae_scale_factor)) if self.height is None or self.height == 0: self.height = int(vae_scale_factor * (self.init_images[0].height * self.scale_by // vae_scale_factor)) - if getattr(self, 'image_mask', None) is not None: + if (getattr(self, 'image_mask', None) is not None) and (len(getattr(self, 'image_mask', [])) > 0): shared.sd_model = sd_models.set_diffuser_pipe(self.sd_model, sd_models.DiffusersTaskType.INPAINTING) - elif getattr(self, 'init_images', None) is not None: + elif (getattr(self, 'init_images', None) is not None) and (len(getattr(self, 'init_images', [])) > 0): shared.sd_model = sd_models.set_diffuser_pipe(self.sd_model, sd_models.DiffusersTaskType.IMAGE_2_IMAGE) if all_prompts is not None: diff --git a/modules/sd_models.py b/modules/sd_models.py index 3d1bc0992..22159fcfe 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -1097,6 +1097,8 @@ def set_diffuser_pipe(pipe, new_pipe_type): shared.log.warning(f'Pipeline class change failed: type={new_pipe_type} pipeline={cls}') return pipe except Exception as e: # pylint: disable=unused-variable + fn = f'{sys._getframe(2).f_code.co_name}:{sys._getframe(1).f_code.co_name}' # pylint: disable=protected-access + shared.log.trace(f"Pipeline class change requested: target={new_pipe_type} fn={fn}") # pylint: disable=protected-access shared.log.warning(f'Pipeline class change failed: type={new_pipe_type} pipeline={cls} {e}') has_errors = True if not hasattr(pipe, 'config') or has_errors: