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

[Feature request] Flux regional conditioning support #153

Open
tristan22mc opened this issue Aug 14, 2024 · 14 comments · Fixed by #169
Open

[Feature request] Flux regional conditioning support #153

tristan22mc opened this issue Aug 14, 2024 · 14 comments · Fixed by #169
Labels
enhancement New feature or request

Comments

@tristan22mc
Copy link

The new controlnets for flux are not the best quality however I would love to be able to use the controlnets regionally so that we can apply the controlnet only to the subject we are trying to control for, as the current controlnet implementations crush the backgrounds quite badly. I used to do this with SDXL before we got good controlnets. It helps to let the model still generate the backgrounds freely without influence from the controlnet. Essentially Im asking if we can implement Flux with regional conditioning support

@mikebilly
Copy link

Yes, please implement it, I cannot use controlnet without attention mask

@Kosinkadink
Copy link
Owner

Since flux controlnet is supported via vanilla comfyui as of a day ago, I should be able to make it work with all the Advanced-ControlNet features relatively easy.

I haven't messed with Flux at all yet as I have a lot on my plate, but in the next few days I should have it ready. I'll update this issue when it's pushed out.

@Kosinkadink Kosinkadink added the enhancement New feature or request label Aug 14, 2024
@tristan22mc
Copy link
Author

Amazing! Best news today!

@mikebilly
Copy link

Is this implemented yet? @Kosinkadink

@Kosinkadink
Copy link
Owner

Not yet, been working on AnimateDiff-Evolved stuff this week. I should be able to get to it sometime this coming week.

@tristan22mc
Copy link
Author

Just checking in! Waiting patiently hah

@Kosinkadink
Copy link
Owner

In develop branch, last night I pushed up support for most ACN features for flux (scheduling, soft scaled weights, etc).

Masking will still need work, as unlike SD, Flux's tensors while sampling don't have simple x,y dimensions - the dims get combined at some point, so I'd need to dig through the code to figure out exactly how it gets combined so I can do the same to my own mask tensor.

General cond masking that ComfyUI supports does work currently, but I will try to make the ACN attn masking work before I do any merging into main.

@tristan22mc
Copy link
Author

Ahh super interesting. So flux is down sampling or combining spatial dimensions between layers? Jealous of your knowledge, been trying to gain a deeper understanding of how things work lately. Looking forward to seeing how you tackle that!

@tristan22mc
Copy link
Author

By the way when you mentioned that Comfyui supports cond masking atm did you mean with controlnets too? Went and tried to test and couldnt get it working

@alex-mitov
Copy link

alex-mitov commented Aug 26, 2024

I've tried the develop branch and it works with the InstantX controlnet Union model, but only with the alpha version of that model. The final release produces poor quality results with the tile controlnet. Is this a problem with the controlnet or is it because Flux support is still in WIP stage? Thanks for the great work so far! :)

@mikebilly
Copy link

@Kosinkadink any updates?

@Kosinkadink
Copy link
Owner

@mikebilly
In develop branch, all ACN features besides masking work for the xlabs flux models and the instantx depth model. flux is very odd with how it deals with encoding width and height into images, thought I figured it out but the results are not as expected. I'll give it another go today, but either way I will probably merge things into main branch regardless of if I can get masking working prior to initial release.

@tristan22mc yes, cond masking works for controlnets too, assuming everything's plugged in correctly. the attention-level masking is not currently supported in dev branch for flux controlnets through the Apply Advanced ControlNet nodes. I also added an Apply Advanced ControlNet(1) node that only receives one cond to simplify connecting for certain workflows.

As for the flux union model, comfy added the initial support for it in ComfyUI, so I can piggy back off of that and make it possible to modify the type soon.

@Kosinkadink Kosinkadink linked a pull request Aug 30, 2024 that will close this issue
@Kosinkadink
Copy link
Owner

I pushed what I have so far into main branch, i'll keep the thread posted with progress on masking.

@tristan22mc
Copy link
Author

Awesome thanks for the update! Also Im currently working with Xinsir to help him find compute for Flux controlnets. Wanted to see if you knew of any possible resources or people in your network that would be interested in getting involved in the project. Also happy to connect you guys if it would be of any value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants