diff --git a/.gitignore b/.gitignore index d311a2a09..e1eaa55f3 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ temp/ custom_nodes/ !custom_nodes/example_node.py.example extra_model_paths.yaml +.idea/ \ No newline at end of file diff --git a/comfy/samplers.py b/comfy/samplers.py index bf4f1796b..5516c060d 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -221,7 +221,9 @@ class KSamplerX0Inpaint(torch.nn.Module): def forward(self, x, sigma, uncond, cond, cond_scale, denoise_mask, cond_concat=None): if denoise_mask is not None: latent_mask = 1. - denoise_mask - x = x * denoise_mask + (self.latent_image + self.noise * sigma) * latent_mask + if not torch.all(torch.eq(sigma, sigma[0])): + raise ValueError('sigma must be the same for all timesteps when using denoise_mask') + x = x * denoise_mask + (self.latent_image + self.noise * sigma[0]) * latent_mask out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, cond_concat=cond_concat) if denoise_mask is not None: out *= denoise_mask