Comfy-Org / Comfy-Org/ComfyUI

VAE Encode for Inpaint Error

Open
#4,157 2 comments 0 reactions 0 assignees View on GitHub
Stale User Support
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Your question

I'm getting this issue when trying to regenerate a background for an image.

My workflow is currently Image gen > Latent from Batch > Inspyrenet Rembg > Invert Mask > VAE Encode for Inpainting. It fails at the inpainting node

PonyXL using t-ponynai3

Error occurred when executing VAEEncodeForInpaint:

Given groups=1, weight of size [128, 3, 3, 3], expected input[1, 4, 1216, 832] to have 3 channels, but got 4 channels instead

File "/home/ComfyUI/execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/home/ComfyUI/execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/home/ComfyUI/execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/home/ComfyUI/nodes.py", line 349, in encode
t = vae.encode(pixels)
File "/home/ComfyUI/comfy/sd.py", line 340, in encode
samples[x:x+batch_number] = self.first_stage_model.encode(pixels_in).to(self.output_device).float()
File "/home/ComfyUI/comfy/ldm/models/autoencoder.py", line 179, in encode
z = self.encoder(x)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ComfyUI/comfy/ldm/modules/diffusionmodules/model.py", line 520, in forward
h = self.conv_in(x)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ComfyUI/comfy/ops.py", line 80, in forward
return super().forward(*args, **kwargs)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 460, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 456, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,

### Logs

```powershell
Error occurred when executing VAEEncodeForInpaint:

Given groups=1, weight of size [128, 3, 3, 3], expected input[1, 4, 1216, 832] to have 3 channels, but got 4 channels instead

File "/home/ComfyUI/execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/home/ComfyUI/execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/home/ComfyUI/execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/home/ComfyUI/nodes.py", line 349, in encode
t = vae.encode(pixels)
File "/home/ComfyUI/comfy/sd.py", line 340, in encode
samples[x:x+batch_number] = self.first_stage_model.encode(pixels_in).to(self.output_device).float()
File "/home/ComfyUI/comfy/ldm/models/autoencoder.py", line 179, in encode
z = self.encoder(x)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ComfyUI/comfy/ldm/modules/diffusionmodules/model.py", line 520, in forward
h = self.conv_in(x)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/home/ComfyUI/comfy/ops.py", line 80, in forward
return super().forward(*args, **kwargs)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 460, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/.local/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 456, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.