Skip to content

Commit

Permalink
Fix regression in VAE code on old pytorch versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Dec 18, 2024
1 parent 79badea commit 4c5c4dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions comfy/ldm/modules/diffusionmodules/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, in_channels, with_conv, conv_op=ops.Conv2d, scale_factor=2.0)

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:
Expand All @@ -109,7 +109,7 @@ def forward(self, x):
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
Expand Down

0 comments on commit 4c5c4dd

Please sign in to comment.