diff --git a/modules/sd_samplers_compvis.py b/modules/sd_samplers_compvis.py index 45ccf4b98..96bf4d129 100644 --- a/modules/sd_samplers_compvis.py +++ b/modules/sd_samplers_compvis.py @@ -104,10 +104,10 @@ class VanillaStableDiffusionSampler: unconditional_conditioning = unconditional_conditioning[:, :cond.shape[1]] if self.mask is not None: - if shared.cmd_opts.use_ipex: - img_orig = self.sampler.model.q_sample(self.init_latent, ts.type(torch.int64)) - else: - img_orig = self.sampler.model.q_sample(self.init_latent, ts) + encode_fn = self.sampler.model.q_sample + if self.is_unipc: + encode_fn = self.sampler.stochastic_encode + img_orig = encode_fn(self.init_latent, ts) x = img_orig * self.mask + self.nmask * x # Wrap the image conditioning back up since the DDIM code can accept the dict directly.