diff --git a/modules/models/diffusion/uni_pc/uni_pc.py b/modules/models/diffusion/uni_pc/uni_pc.py index d257a728..4a365151 100644 --- a/modules/models/diffusion/uni_pc/uni_pc.py +++ b/modules/models/diffusion/uni_pc/uni_pc.py @@ -445,7 +445,7 @@ class UniPC: s = torch.quantile(torch.abs(x0).reshape((x0.shape[0], -1)), p, dim=1) s = expand_dims(torch.maximum(s, self.max_val * torch.ones_like(s).to(s.device)), dims) x0 = torch.clamp(x0, -s, s) / s - return x0 + return x0.to(x) def model_fn(self, x, t): """ diff --git a/modules/sd_samplers_cfg_denoiser.py b/modules/sd_samplers_cfg_denoiser.py index b1dca624..e2d3826b 100644 --- a/modules/sd_samplers_cfg_denoiser.py +++ b/modules/sd_samplers_cfg_denoiser.py @@ -162,7 +162,7 @@ class CFGDenoiser(torch.nn.Module): fake_sigmas = ((1 - acd) / acd) ** 0.5 real_sigma = fake_sigmas[sigma.round().long().clip(0, int(fake_sigmas.shape[0]))] real_sigma_data = 1.0 - x = x * (real_sigma ** 2.0 + real_sigma_data ** 2.0) ** 0.5 + x = x * (((real_sigma ** 2.0 + real_sigma_data ** 2.0) ** 0.5)[:, None, None, None]) sigma = real_sigma if sd_samplers_common.apply_refiner(self, x): @@ -195,7 +195,7 @@ class CFGDenoiser(torch.nn.Module): self.step += 1 if self.classic_ddim_eps_estimation: - eps = (x - denoised) / sigma + eps = (x - denoised) / sigma[:, None, None, None] return eps return denoised.to(device=original_x_device, dtype=original_x_dtype)