lllyasviel / lllyasviel/stable-diffusion-webui-forge

Controlnet not working in img2img.

Open
#2,691 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

It worked but unstable before updating forge ui. I mostly use controlnet Tile and I used the correct preprocessor and model.
2025-02-26 05:47:07,347 - ControlNet - INFO - ControlNet Input Mode: InputMode.SIMPLE
*** Error running process: E:\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
Traceback (most recent call last):
File "E:\Data\Packages\Stable Diffusion WebUI Forge\modules\scripts.py", line 844, in process
script.process(p, *script_args)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 554, in process
self.process_unit_after_click_generate(p, unit, params, *args, **kwargs)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 304, in process_unit_after_click_generate
input_list, resize_mode = self.get_input_data(p, unit, preprocessor, h, w)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 209, in get_input_data
elif (unit_image < 5).all() and (unit_image_fg > 5).any():
TypeError: '<' not supported between instances of 'dict' and 'int'

---
[Unload] Trying to free 14136.00 MB for cuda:0 with 1 models keep loaded ... Current free memory is 10632.12 MB ... Done.
[Unload] Trying to free 3302.87 MB for cuda:0 with 0 models keep loaded ... Current free memory is 10726.62 MB ... Done.
[Memory Management] Target: JointTextEncoder, Free GPU: 10726.62 MB, Model Require: 1752.98 MB, Previously Loaded: 0.00 MB, Inference Require: 1024.00 MB, Remaining: 7949.65 MB, All loaded to GPU.
Moving model(s) has taken 0.22 seconds
[Textual Inversion] Used Embedding [Stable_Yogis_Illustrious_Negatives-neg] in CLIP of [clip_l]
[Textual Inversion] Used Embedding [Stable_Yogis_Illustrious_Negatives-neg] in CLIP of [clip_g]
[Unload] Trying to free 1024.00 MB for cuda:0 with 1 models keep loaded ... Current free memory is 8969.42 MB ... Done.
*** Error running process_before_every_sampling: E:\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
Traceback (most recent call last):
File "E:\Data\Packages\Stable Diffusion WebUI Forge\modules\scripts.py", line 892, in process_before_every_sampling
script.process_before_every_sampling(p, *script_args, **kwargs)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "E:\Data\Packages\Stable Diffusion WebUI Forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 561, in process_before_every_sampling
self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)
KeyError: 0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with extensions-builtin/sd_forge_controlnet/scripts/controlnet.py, especially get_input_data at line 209 and the process paths at lines 304, 554, and 561. Reproduce the img2img ControlNet Tile case described in the report and trace the TypeError and subsequent KeyError. Done means this workflow completes without either reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.