Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix VAEEncodeForInpaint modifying source image.

comfyanonymousbf1dc1d9bcb5
diff --git a/nodes.py b/nodes.py
index 766be75dc..9a878b441 100644
--- a/nodes.py
+++ b/nodes.py
@@ -189,6 +189,7 @@ class VAEEncodeForInpaint:
y = (pixels.shape[2] // 64) * 64
mask = torch.nn.functional.interpolate(mask[None,None,], size=(pixels.shape[1], pixels.shape[2]), mode="bilinear")[0][0]
+ pixels = pixels.clone()
if pixels.shape[1] != x or pixels.shape[2] != y:
pixels = pixels[:,:x,:y,:]
mask = mask[:x,:y]