improve taesd live preview downscaling

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-06-27 18:16:32 -04:00
parent 7447a79b46
commit 533aa04bbd
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -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
+2 -2
View File
@@ -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