-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Support InstantStyle #7586
Support InstantStyle #7586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking great!
left one comment. Thanks!
src/diffusers/loaders/unet.py
Outdated
selected = False | ||
for block_name in target_blocks: | ||
if block_name in name: | ||
selected = True | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work?
selected = False | |
for block_name in target_blocks: | |
if block_name in name: | |
selected = True | |
break | |
selected = any( block_name in name for block_name in target_blocks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is much clearer. Updated.
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
@asomoza can you do a final review and test this out? |
Nice, it works as intended and I really like the skip functionality, thank you for your work. But I want to give my opinion here and open a discussion on about how is this implemented. Diffusers is used as a backend for UIs, for advanced users and also not for that advanced that knows all the diffusers naming for the blocks and layers, so I think we need to take this into consideration:
I really like to be able to use the same dict as the LoRAs for example.: {
"down": {"block_1": [0.0, 0.0], "block_2": [0.0, 0.0]},
"mid": 0.0,
"up": {"block_0": 1.0, "block_1": [0.0, 0.0, 0.0]},
}, on the other side, I really like the simplicity of this PR, if we go with the other implementation it will probably make the code a lot more complex. |
I believe we can set different weights for each block just like LoRA dict, in this case, we don't need to reload modules. Will update soon. |
Cool @haofanwang! What would be the mechanism to subtract the CLIP text embedding from the image embedding with diffusers? This is done here in the original implementation. |
we will merge this one soon #7499 |
Will rebase on #7499. |
Is it possible to load multiple ip adapters at the same time? I would appreciate an example that shows how we could load/unload different adapters seperately or together. Thanks! |
This is another problem. We can support it later. |
This can be natively achieved already. We will show how to do it once this PR merged. |
This PR supports for our recent work InstantStyle in native diffusers API. The idea has also been discussed at #7534 .
The modifications are mainly about IP-Adapter loader, allowing users to specify target blocks used for image feature injection. After merged, InstantStyle can be achieved via following way