Skip to content

Commit 88e6370

Browse files
Remove workaround for old pytorch. (Comfy-Org#12480)
1 parent c037004 commit 88e6370

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

  • comfy/ldm/modules/diffusionmodules

comfy/ldm/modules/diffusionmodules/model.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,7 @@ def forward(self, x):
102102
return self.conv(x)
103103

104104
def interpolate_up(x, scale_factor):
105-
try:
106-
return torch.nn.functional.interpolate(x, scale_factor=scale_factor, mode="nearest")
107-
except: #operation not implemented for bf16
108-
orig_shape = list(x.shape)
109-
out_shape = orig_shape[:2]
110-
for i in range(len(orig_shape) - 2):
111-
out_shape.append(round(orig_shape[i + 2] * scale_factor[i]))
112-
out = torch.empty(out_shape, dtype=x.dtype, layout=x.layout, device=x.device)
113-
split = 8
114-
l = out.shape[1] // split
115-
for i in range(0, out.shape[1], l):
116-
out[:,i:i+l] = torch.nn.functional.interpolate(x[:,i:i+l].to(torch.float32), scale_factor=scale_factor, mode="nearest").to(x.dtype)
117-
return out
105+
return torch.nn.functional.interpolate(x, scale_factor=scale_factor, mode="nearest")
118106

119107
class Upsample(nn.Module):
120108
def __init__(self, in_channels, with_conv, conv_op=ops.Conv2d, scale_factor=2.0):

0 commit comments

Comments
 (0)