diff --git a/entry.py b/entry.py index b19008ec..5eff7031 100644 --- a/entry.py +++ b/entry.py @@ -151,6 +151,6 @@ with torch.no_grad(): model.first_stage_model.cpu() import cv2 - samples = einops.rearrange(samples, 'b c h w -> b h w c')[0] * 255.0 + samples = einops.rearrange(samples, 'b c h w -> b h w c')[0, :, :, ::-1] * 255.0 samples = samples.cpu().numpy().clip(0, 255).astype(np.uint8) cv2.imwrite('img.png', samples) diff --git a/img.png b/img.png index bec94389..c176aae7 100644 Binary files a/img.png and b/img.png differ diff --git a/sgm/modules/diffusionmodules/util.py b/sgm/modules/diffusionmodules/util.py index 1acae630..e4e4f14d 100644 --- a/sgm/modules/diffusionmodules/util.py +++ b/sgm/modules/diffusionmodules/util.py @@ -272,7 +272,9 @@ class SiLU(nn.Module): class GroupNorm32(nn.GroupNorm): def forward(self, x): - return super().forward(x) + self.weight.to(torch.float32) + self.bias.to(torch.float32) + return super().forward(x.float()).type(x.dtype) def conv_nd(dims, *args, **kwargs):