Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair ControlNet infotext parsing #1833

Merged
merged 3 commits into from
Aug 24, 2023
Merged

Conversation

catboxanon
Copy link
Contributor

@catboxanon catboxanon commented Jul 26, 2023

Closes #1793

This was broken (and has been for quite some time now) after ControlNet params started being stored altogether as part of a single key and not separate keys per param. The ideal solution would be rework how this is handled altogether so it accounts for more parameters in a cleaner way, but this is just patching the functionality that previously existed for now.

This also allows the Parse ControlNet parameters in infotext setting (previously titled Passing ControlNet parameters with "Send to img2img" which is unclear and technically incorrect since it also applies to txt2img) to be handled at runtime rather than requiring a restart of the webui, as the setting previously was only taken into account during the UI creation process.

Setting as a draft because active_units.js doesn't trigger UI updates when the infotext is parsed currently. Not sure what's going on as it does recognize the changes once the ControlNet tab is switched or the Enabled checkbox is unticked (easier to see this behavior if loading the infotext from an image using multiple ControlNet modules).

@huchenlei huchenlei self-requested a review July 26, 2023 12:11
@huchenlei
Copy link
Collaborator

huchenlei commented Jul 26, 2023

Active units is listening enable checkbox change and tab change events to update tab status. Setting checkbox value directly from scripts cannot be observed by js. A workaround would be add a listener to those send to x buttons. I can take care of the active_units.js code.

@catboxanon
Copy link
Contributor Author

A workaround would be add a listener to those send to x buttons. I can take care of the active_units.js code.

Thanks -- would need to make sure to account for the ↙️ button as well.

@huchenlei huchenlei marked this pull request as ready for review August 3, 2023 03:13
@huchenlei
Copy link
Collaborator

Hey @catboxanon, I finally got some time to fix this issue. Can you confirm that the PR is good after my change?

@catboxanon
Copy link
Contributor Author

Working for me -- thanks!

@huchenlei
Copy link
Collaborator

I think there is a big blocker for values to be pasted from infotext:

When module(preprocessor) value is updated, an update will be triggered to set the values of all sliders to the default value for the selected module. This behaviour will overwrite the pasted value from infotext for those sliders.

🚧 Listen png info buttons

WIP

New infotext format

nits

nits

nits

rebase

refactor active unit counts
@huchenlei huchenlei marked this pull request as ready for review August 24, 2023 01:31
@huchenlei
Copy link
Collaborator

huchenlei commented Aug 24, 2023

The slider issue is very hard to fix. I think gradio has some hard time handling these concurrent updates.

I tried the following approach and it does not work:

  • Make 2 invisible gradio buttons build slider and build slider keep value
  • Use front-end MutationObserver to distinguish user operation on dropdown and Gradio update on the dropdown
  • Dispatch user update to click build slider, and dispatch Gradio update (From A1111 paste) to build slider keep value

However, when A1111 paste the infotext to ControlNetUnit, when build slider keep value call is reached in backend python code, the state of module and pp are not necessarily up to date.

So I decided to leave this for later, and just submit the feature with this minor bug.

@huchenlei huchenlei merged commit cde4619 into Mikubill:main Aug 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: PNG info, not sending controlnet params
2 participants