lllyasviel / lllyasviel/stable-diffusion-webui-forge
After the update, ControlNet Integration does not work, error: RuntimeError: Given groups=1, weight of size [320, 4, 3, 3], expected input[1, 16, 128, 128] to have 4 channels, but got 16 channels instead
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
Moving model(s) has taken 6.15 seconds
0%| | 0/16 [00:00<?, ?it/s]
Traceback (most recent call last):
File "G:\webui_forge_cu121_torch231\webui\modules_forge\main_thread.py", line 30, in work
self.result = self.func(*self.args, **self.kwargs)
File "G:\webui_forge_cu121_torch231\webui\modules\img2img.py", line 248, in img2img_function
processed = process_images(p)
File "G:\webui_forge_cu121_torch231\webui\modules\processing.py", line 842, in process_images
res = process_images_inner(p)
File "G:\webui_forge_cu121_torch231\webui\modules\processing.py", line 990, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "G:\webui_forge_cu121_torch231\webui\modules\processing.py", line 1865, in sample
samples = self.sampler.sample_img2img(self, self.init_latent, x, conditioning, unconditional_conditioning, image_conditioning=self.image_conditioning)
File "G:\webui_forge_cu121_torch231\webui\modules\sd_samplers_kdiffusion.py", line 188, in sample_img2img
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "G:\webui_forge_cu121_torch231\webui\modules\sd_samplers_common.py", line 278, in launch_sampling
return func()
File "G:\webui_forge_cu121_torch231\webui\modules\sd_samplers_kdiffusion.py", line 188, in
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\webui\k_diffusion\sampling.py", line 129, in sample_euler
denoised = model(x, sigma_hat * s_in, **extra_args)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self.call_impl(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in call_impl
return forward_call(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\webui\modules\sd_samplers_cfg_denoiser.py", line 199, in forward
denoised, cond_pred, uncond_pred = sampling_function(self, denoiser_params=denoiser_params, cond_scale=cond_scale, cond_composition=cond_composition)
File "G:\webui_forge_cu121_torch231\webui\backend\sampling\sampling_function.py", line 362, in sampling_function
denoised, cond_pred, uncond_pred = sampling_function_inner(model, x, timestep, uncond, cond, cond_scale, model_options, seed, return_full=True)
File "G:\webui_forge_cu121_torch231\webui\backend\sampling\sampling_function.py", line 303, in sampling_function_inner
cond_pred, uncond_pred = calc_cond_uncond_batch(model, cond, uncond, x, timestep, model_options)
File "G:\webui_forge_cu121_torch231\webui\backend\sampling\sampling_function.py", line 267, in calc_cond_uncond_batch
c['control'] = control.get_control(input_x, timestep, control_cond, len(cond_or_uncond))
File "G:\webui_forge_cu121_torch231\webui\backend\patcher\controlnet.py", line 338, in get_control
control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint.to(self.device), timesteps=timestep.float(), context=context.to(dtype), y=y)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\webui\backend\nn\cnets\cldm.py", line 260, in forward
h = module(h, emb, context)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\webui\backend\nn\unet.py", line 89, in forward
x = layer(x)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
return forward_call(*args, **kwargs)
File "G:\webui_forge_cu121_torch231\webui\backend\operations.py", line 170, in forward
return super()._conv_forward(x, weight, bias)
File "G:\webui_forge_cu121_torch231\system\python\lib\site-packages\torch\nn\modules\conv.py", line 456, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [320, 4, 3, 3], expected input[1, 16, 128, 128] to have 4 channels, but got 16 channels instead
Given groups=1, weight of size [320, 4, 3, 3], expected input[1, 16, 128, 128] to have 4 channels, but got 16 channels instead
Before the update everything worked well. Please tell me how to treat or how to roll back
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback entry points in backend/patcher/controlnet.py, backend/nn/cnets/cldm.py, backend/nn/unet.py, and backend/sampling/sampling_function.py. Reproduce the ControlNet img2img failure and compare the pre-update and current model/input channel handling. Done means the reported ControlNet integration no longer raises the 4-versus-16 channel mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100