From 4c5c4ddedaba071872cc25ceaf3aaec25795562d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 18 Dec 2024 03:08:28 -0500 Subject: [PATCH] Fix regression in VAE code on old pytorch versions. --- comfy/ldm/modules/diffusionmodules/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.py index 74322c27..ed1e8821 100644 --- a/comfy/ldm/modules/diffusionmodules/model.py +++ b/comfy/ldm/modules/diffusionmodules/model.py @@ -91,7 +91,7 @@ class Upsample(nn.Module): def forward(self, x): scale_factor = self.scale_factor - if not isinstance(scale_factor, tuple): + if isinstance(scale_factor, (int, float)): scale_factor = (scale_factor,) * (x.ndim - 2) if x.ndim == 5 and scale_factor[0] > 1.0: @@ -109,7 +109,7 @@ class Upsample(nn.Module): else: x = a else: - x = interpolate_up(x, self.scale_factor) + x = interpolate_up(x, scale_factor) if self.with_conv: x = self.conv(x) return x