From 533aa04bbd3be2c83b98e5b87b89c3c841b779eb Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 27 Jun 2025 18:16:32 -0400 Subject: [PATCH] improve taesd live preview downscaling Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 1 + modules/sd_samplers_common.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec1c40e63..f34d5d22f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ - Fix process batch double image save - Fix unapply texture tiling - Suppress torch empty logging + - Improve TAESD live preview downscale handling ## Update for 2025-06-16 diff --git a/modules/sd_samplers_common.py b/modules/sd_samplers_common.py index 8935b4626..2d6c2858c 100644 --- a/modules/sd_samplers_common.py +++ b/modules/sd_samplers_common.py @@ -52,9 +52,9 @@ def single_sample_to_image(sample, approximation=None): if len(sample.shape) == 4 and sample.shape[0]: # likely animatediff latent sample = sample.permute(1, 0, 2, 3)[0] if approximation == 2: # TAESD - if (len(sample.shape) == 3 or len(sample.shape) == 4) and shared.opts.live_preview_downscale and (sample.shape[-1] > 128 or sample.shape[-2] > 128): + if (len(sample.shape) == 3 or len(sample.shape) == 4) and shared.opts.live_preview_downscale and (sample.shape[-1]*sample.shape[-2] > 128*128): try: - scale = 128 / max(sample.shape[-1], sample.shape[-2]) + scale = (128 * 128) / (sample.shape[-1] * sample.shape[-2]) sample = torch.nn.functional.interpolate(sample.unsqueeze(0), scale_factor=[scale, scale], mode='bilinear', align_corners=False)[0] except Exception: pass