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

Real multi-inputs ControlNet unit #2539

Merged
merged 4 commits into from
Jan 22, 2024
Merged

Real multi-inputs ControlNet unit #2539

merged 4 commits into from
Jan 22, 2024

Conversation

huchenlei
Copy link
Collaborator

@huchenlei huchenlei commented Jan 22, 2024

Previous multi-inputs support #2525 essentially unfolds the multi-input unit into multiple units, and do processing, which is not very efficient, and require user to calculate a fraction weight based on number of input images.

This PR implements the real multi-inputs ControlNet unit, which allow multiple input images to be passed together to FaceID preprocessor in one pass. You can now use weight = 1.0 instead of calculating a fraction weight.

In API, a new syntax is introduced to support this. The simple list syntax has been taken (first item image, second item mask), so we have to do extra workaround.

{"image": [{"image": img} for img in imgs]}

Result comparison

faceid portrait multiple units
multi_inputs('ip-adapter_face_id', 'ip-adapter-faceid-portrait_sd15  b2609049 ', None)_0

faceid portrait single unit multiple inputs
real_multi_inputs('ip-adapter_face_id', 'ip-adapter-faceid-portrait_sd15  b2609049 ', None)_0

There are some slight differences. This can be attributed to floating point calculation loss. I think the performance is equivalent. Please file an issue if you have observed any abnormal results after we switch to real multi-inputs arch.

@huchenlei huchenlei marked this pull request as ready for review January 22, 2024 07:27
@huchenlei huchenlei merged commit 25e41dc into Mikubill:main Jan 22, 2024
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.

1 participant