Open Karsten385 opened 1 year ago
same happens here. intel mac
A workaround is to use f32 for specific operations:
repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py
--- a/ldm/modules/diffusionmodules/openaimodel.py
+++ b/ldm/modules/diffusionmodules/openaimodel.py
@@ -112,7 +112,7 @@ class Upsample(nn.Module):
x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
)
else:
- x = F.interpolate(x, scale_factor=2, mode="nearest")
+ x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
if self.use_conv:
x = self.conv(x)
return x
after this I got another error: RuntimeError: "compute_indices_weights_nearest" not implemented for 'Half'
and fixed it in a similar way
modules/sd_vae_approx.py
--- a/modules/sd_vae_approx.py
+++ b/modules/sd_vae_approx.py
@@ -21,7 +21,7 @@ class VAEApprox(nn.Module):
def forward(self, x):
extra = 11
- x = nn.functional.interpolate(x, (x.shape[2] * 2, x.shape[3] * 2))
+ x = nn.functional.interpolate(x.to(torch.float32), (x.shape[2] * 2, x.shape[3] * 2)).to(x.dtype)
x = nn.functional.pad(x, (extra, extra, extra, extra))
for layer in [self.conv1, self.conv2, self.conv3, self.conv4, self.conv5, self.conv6, self.conv7, self.conv8, ]:
Some people at #8555 suggested using --no-half but it switches the entire codebase to float32, consuming twice as much RAM.
Is there an existing issue for this?
What happened?
Cannot generate images. Not sure what changed since a few days ago when it was running fine, but here is the error I generated.
RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
Image tries to generate for like 2 seconds before pulling this error.
Steps to reproduce the problem
What should have happened?
...Image should generate.
Version or Commit where the problem happens
v1.5.2, commit hash c9c8485bc1e8720aba70f029d25cba1c4abf2b5c
What Python version are you running on ?
Python 3.10.x
What platforms do you use to access the UI ?
MacOS
What device are you running WebUI on?
CPU
Cross attention optimization
Automatic
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
List of extensions
a1111-sd-webui-lycoris
stable-diffusion-webui-images-browser
Console logs
Additional information
No response