Skip to content

flux controlnet control_guidance_start and control_guidance_end implement - #9571

Merged
asomoza merged 9 commits into
huggingface:mainfrom
ighoshsubho:feature/flux_control_guidance
Oct 10, 2024
Merged

asomoza merged 9 commits into
huggingface:mainfrom
ighoshsubho:feature/flux_control_guidance

Conversation

@ighoshsubho

@ighoshsubho ighoshsubho commented Oct 2, 2024 •

Copy link
Copy Markdown
Contributor

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

asomoza commented Oct 3, 2024

Copy link
Copy Markdown
Member

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

@simbrams

simbrams commented Oct 4, 2024

Copy link
Copy Markdown

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
Copy Markdown
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

yiyixuxu commented Oct 9, 2024

Copy link
Copy Markdown
Collaborator

@asomoza can you give this a review?

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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 asomoza left a comment

Copy link
Copy Markdown
Member

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

Comment thread src/diffusers/pipelines/flux/pipeline_flux_controlnet.py
Comment thread src/diffusers/pipelines/flux/pipeline_flux_controlnet.py Outdated
@asomoza

asomoza commented Oct 10, 2024

Copy link
Copy Markdown
Member

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

simbrams commented Oct 10, 2024 •

Copy link
Copy Markdown

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
Copy Markdown
Contributor

any chance to get this merged?

@asomoza

asomoza commented Oct 10, 2024

Copy link
Copy Markdown
Member

@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

simbrams commented Oct 10, 2024 •

Copy link
Copy Markdown

@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

asomoza commented Oct 10, 2024

Copy link
Copy Markdown
Member

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

asomoza commented Oct 10, 2024

Copy link
Copy Markdown
Member

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

@asomoza
asomoza merged commit 38a3e4d into huggingface:main Oct 10, 2024
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