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

Validate ControlNetUnit using pydantic #2847

Merged
merged 11 commits into from
May 6, 2024
Merged

Conversation

huchenlei
Copy link
Collaborator

@huchenlei huchenlei commented May 5, 2024

Previously the logic of handling various inputs scattered everywhere. This PR creates Pydantic version of ControlNetUnit to gather all input processing to a single location.

Other Improvements

  • Enum handling is greatly improved.
  • Mask handling is simplified.

Breaking Changes:

  • Preset is removed. Due to gradio limitation on callback invocation, there is no really good way to ensure that values can be very well populated. It turns out just really buggy. Also the preset add extra event listener on basically every IO element in the unit, which slows down overall UI.
  • hr_option is dropped from infotext, as it is not very meaningful in non-hr runs. We will consider conditionally put it back later, i.e. only put it in infotext when its value differs from default value. Infotext that contains hr_option as field can still be correctly populated.
  • numbers are no longer accepted to ControlNetUnit's enum fields.

Minor side effects:

  • When not specified or using -1 as slider values, no warning/info message will be reported.
  • When creating ControlNetUnit object, the field for enabled defaults to False instead of True.

@huchenlei huchenlei changed the title Add pydantic ControlNetUnit Validate ControlNetUnit using pydantic May 5, 2024
Add test config

Add images field

Adjust image field handling

fix various ui

Fix most UI issues

accept greyscale image/mask

Fix infotext

Fix preset

Fix infotext

nit

Move infotext parsing test

Remove preset

Remove unused js code

Adjust test payload

By default disable unit

refresh enum usage

Align resize mode

change test func name

remove unused import

nit

Change default handling

Skip bound check when not enabled

Fix batch

Various batch fix

Disable batch hijack test

adjust test

fix test expectations

Fix unit copy

nit

Fix test failures
@huchenlei huchenlei merged commit e33c046 into Mikubill:main May 6, 2024
2 checks passed
huchenlei added a commit that referenced this pull request May 6, 2024
* Replace mask upload with effective region mask (#2830)

* 📝 Update to version v1.1.446 (#2832)

* 📝 Update to version v1.1.446

* update readme

* Fix blur_gaussian slider param (#2834)

* Support PuLID (#2838)

* Add preprocessors

* Fix resolution param

* Fix various issues

* Add PuLID attn

* remove unused import

* Resize img before passing to facexlib

* safe unload

* 📝 Update to version v1.1.447 (#2842)

* 📝 Update to version v1.1.447

* update readme

* Allow pulid accept multiple inputs (#2843)

* Quick fix enum issue (#2844)

* Move enum (#2845)

* Move enums to enums.py

* Add missing import

* Remove unused import

* Remove legacy test (#2846)

* Quickfix Enum Issue 2 (#2849)

* Drop external_code. prefix (#2850)

* Drop external_code. prefix

* Remove unused imports

* fix test (#2851)

* Adjust test template's threshold a/b value (#2852)

* Validate ControlNetUnit using pydantic (#2847)

* Add Pydantic ControlNetUnit

Add test config

Add images field

Adjust image field handling

fix various ui

Fix most UI issues

accept greyscale image/mask

Fix infotext

Fix preset

Fix infotext

nit

Move infotext parsing test

Remove preset

Remove unused js code

Adjust test payload

By default disable unit

refresh enum usage

Align resize mode

change test func name

remove unused import

nit

Change default handling

Skip bound check when not enabled

Fix batch

Various batch fix

Disable batch hijack test

adjust test

fix test expectations

Fix unit copy

nit

Fix test failures

* Change script args back to ControlNetUnit for compatibility

* import enum for compatibility

* Fix unit test

* simplify unfold

* Add test coverage

* handle directly set np image

* re-enable batch test

* Add back canvas scribble support

* nit

* Fix batch hijack test

* 📝 Update to version v1.1.448 (#2853)

* Update UI image (#2855)

* Fix duplicated version logging (#2856)
@huchenlei huchenlei deleted the re1 branch May 6, 2024 21:16
@huchenlei huchenlei mentioned this pull request May 6, 2024
1 task
DrCyanide added a commit to DrCyanide/cyanic-sd-krita that referenced this pull request May 20, 2024
A merge of ControlNet broke compatibility with using number instead of the full enum. Mikubill/sd-webui-controlnet#2847
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.

1 participant