lllyasviel / lllyasviel/stable-diffusion-webui-forge

controlnet "batch" and sorts

Open
#2,904 0 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

this is more of a question, due to my lack of knowledge, really.

i have been using this repo mainly not directly but rather via api.
in my app, i had been using controlnet usually with paths to files, using them as preprocessor inputs etc.
i was hoping to be able to give a path to folder instead of a file, in order to a) use all images in that folder for a batch-render (e.g. 5 images in folder -> batch-render size = 5), or b) iterate through the folder in using them each as cn-preprocessor inputs.

so, working with a path to a folder - without any other changes - failed, of course.
the error messages led to a specific part in the controlnet.py-code.

extensions-builtin/sd_forge_controlnet/scripts/controlnet.py, line 172 says:
elif unit.input_mode == external_code.InputMode.BATCH:

i changed that line to:
elif (unit.input_mode == external_code.InputMode.BATCH) or (unit.input_mode == "batch"):

since then, it seems to work. images in a folder are now collected and batch rendering with the respective images as preprocessors is being rendered. if ip-adapter is used, batch does not work, but at least the "collecting" itself is accepted, thus i can now iterate through a folder and render "one face after another" with an ip-adapter.
multiple controlnet units allow the combination of the above.

so, after that long explanation, my question would be: is that ok to do in the controlnet.py code?
i have not yet seen anything yet, that this might have broken. everything else seems to be working as it had been, before the change to code.
but, as mentioned, i mainly don't use the web-interface itself.

if this does indeed not break anything, my follow-up would be, if it's possible that this little change could be incorporated in the next update
(i still haven't learned, how to do pull requests i'm afraid)?

or - of course - the alternative follow up would be: is there a way that's the proper way to achieve the goal i described above?
if so, i'd rather try that, instead of changing the code of parts of forge. users of my app would have to do the same code change, if they'd want to be able to use the functionality described above. of course, that's not a convenient thing to do.

thx.

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 in extensions-builtin/sd_forge_controlnet/scripts/controlnet.py around line 172 and trace how unit.input_mode and external_code.InputMode.BATCH are defined and handled. Check the existing batch and IP-adapter paths to determine whether folder inputs are intended; done means establishing supported behavior and coverage for folder collection, batch rendering, and multiple ControlNet units.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.