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

Fixed a bug in ControlNet via API #163

Closed

Conversation

sunadarake
Copy link

Description

This PR is intended to fix the bug described in issue #110 .

Problem

File "D:\stable-diffusion-webui-forge\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 97, 
in get_enabled_units enabled_units = [x for x in units if x.enabled]

While accessing through the frontend, the args for ControlNet are a list of ControlNetUnit instances. However, when accessed through the API, it was a list of dict, causing an error.

Solution

For API access, convert args into ControlNetUnit instances. Additionally, handle cases where some keys in args are represented as tuples.

Moreover, since ControlNet uses images specified as base64-encoded data or image paths through the API, I added processing to convert the data to a format usable by ControlNet using lib_controlnet.utils.image_dict_from_any.

Screenshots/videos:

Checklist:

@huchenlei
Copy link
Contributor

Duplicated. See #162.

@huchenlei huchenlei closed this Feb 10, 2024
@sunadarake sunadarake deleted the fix/controlnet-api-bug branch February 10, 2024 06:42
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.

2 participants