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

flux controlnet control_guidance_start and control_guidance_end implement #9571

Merged
merged 9 commits into from
Oct 10, 2024

Conversation

ighoshsubho
Copy link
Contributor

@ighoshsubho ighoshsubho commented Oct 2, 2024

What does this PR do?

Fixes #9555

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@yiyixuxu

@ighoshsubho ighoshsubho marked this pull request as ready for review October 2, 2024 18:15
@asomoza asomoza requested a review from yiyixuxu October 3, 2024 14:05
@asomoza
Copy link
Member

asomoza commented Oct 3, 2024

thanks a lot, @simbrams can you give this a test and see if it improves your use case?

@simbrams
Copy link

simbrams commented Oct 4, 2024

Thanks a lot @ighoshsubho !

thanks a lot, @simbrams can you give this a test and see if it improves your use case?

I wil be trying it soon, will let you know about the results ASAP.

@ighoshsubho
Copy link
Contributor Author

@simbrams any update on this fix, does it solve what you were looking for? And @yiyixuxu is there any more changes required, if not can this be merged?

@yiyixuxu
Copy link
Collaborator

yiyixuxu commented Oct 9, 2024

@asomoza can you give this a review?

@HuggingFaceDocBuilderDev

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.

Copy link
Member

@asomoza asomoza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, thanks a lot, left a couple of comments

@asomoza
Copy link
Member

asomoza commented Oct 10, 2024

I took the opportunity to test the jasperai controlnet, here's the example with this applied and a controlnet_conditioning_scale of 1.0:

default control_guidance_end=0.5 control_guidance_end=0.5 + control_guidance_start=0.2
20241010041124_2528677182 20241010042705_2528677182 20241010042950_2528677182

@simbrams
Copy link

simbrams commented Oct 10, 2024

My tests with inpainting are not very conclusive unfortunately, I haven't been able to find parameters that works well with inpainting and "strong" guidance with Depth. If you guys have any tweak ideas that would work to achieve the result bellow, please let me know :)

Flux model used: black-forest-labs/FLUX.1-dev
Depth model used: jasperai/Flux.1-dev-Controlnet-Depth

Inputs:

Image Mask Depth "Desired" Output
image image image image Output using SD 1.5

Current results:

strength: 0.8
steps: 100
controlnet_conditioning_scale: 0.8
controlnet_guidance_start: 0
controlnet_guidance_end: 0.4
image

strength: 0.8
steps: 100
controlnet_conditioning_scale: 0.6 🔻
controlnet_guidance_start: 0
controlnet_guidance_end: 0.4
image

strength: 0.8
steps: 100
controlnet_conditioning_scale: 0.6
controlnet_guidance_start: 0
controlnet_guidance_end: 0.6 ↗️
image

strength: 0.8
steps: 100
controlnet_conditioning_scale: 0.4 🔻
controlnet_guidance_start: 0
controlnet_guidance_end: 0.8 ↗️
image

strength: 0.8
steps: 100
controlnet_conditioning_scale: 0.5 ↗️
controlnet_guidance_start: 0
controlnet_guidance_end: 0.8
image

@burgalon
Copy link
Contributor

any chance to get this merged?

@asomoza
Copy link
Member

asomoza commented Oct 10, 2024

@simbrams this just confirms what I was thinking and saw, Flux right now is not a good solution for inpainting, maybe it will get better with time but the model since it's distilled and very forceful aesthetic might be a problem with realistic photo inpainting.

You have a very little margin to work with it and it takes a long time to be able to experiment with it and even more to train a decent controlnet.

Maybe you can try with the recent "undistilled" models? I think there's five of them right now, they will take more time for inference since they have CFG but probably will yield better results.

@simbrams
Copy link

simbrams commented Oct 10, 2024

@simbrams this just confirms what I was thinking and saw, Flux right now is not a good solution for inpainting, maybe it will get better with time but the model since it's distilled and very forceful aesthetic might be a problem with realistic photo inpainting.

You have a very little margin to work with it and it takes a long time to be able to experiment with it and even more to train a decent controlnet.

Maybe you can try with the recent "undistilled" models? I think there's five of them right now, they will take more time for inference since they have CFG but probably will yield better results.

Indeed you were right ! I will try with undistilled models and see how it goes :) thanks for the tip!

UPDATE:
Just saw undistilled like nyanko7/flux-dev-de-distill is currently not compatible with diffusers unfortunately.

@asomoza
Copy link
Member

asomoza commented Oct 10, 2024

oh I forgot about it, they need the CFG so they probably only work with the community pipeline and currently we don't have a controlnet pipeline for Flux with CFG.

You can open an issue about and we can discuss it there, I'll merge this PR now.

@asomoza
Copy link
Member

asomoza commented Oct 10, 2024

Thanks a lot @ighoshsubho, the failing test is unrelated.

@asomoza asomoza merged commit 38a3e4d into huggingface:main Oct 10, 2024
14 of 15 checks passed
guptaaryan16 pushed a commit to guptaaryan16/mlx-diffusers that referenced this pull request Nov 7, 2024
…ment (huggingface#9571)

* flux controlnet control_guidance_start and control_guidance_end implement

* minor fix - added docstrings, consistent controlnet scale flux and SD3
sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
…ment (#9571)

* flux controlnet control_guidance_start and control_guidance_end implement

* minor fix - added docstrings, consistent controlnet scale flux and SD3
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.

[Flux Controlnet] Add control_guidance_start and control_guidance_end
6 participants