-
Notifications
You must be signed in to change notification settings - Fork 59
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
How to use inpaint/outpaint models? #133
Comments
have you solved this problem? |
no |
It's not much of a workaround, as having 'black' be the trigger for masked area is already unusual in itself. Normal inpaint controlnets expect -1 for where they should be masked, which is what the controlnet-aux Inpaint Preprocessor returns. The fact that OG controlnets use -1 instead of 0s for the mask is a blessing in that they sorta work even if you don't provide an explicit noise mask, as -1 would not normally be a value encountered by anything. I'm pretty sure the original union code assumes that there is a noise mask applied in addition to the black RGB values in the mask itself, as just having 0,0,0 values is obviously not gonna work compared to the OG -1,-1,-1 values. The pipeline used in the diffusers code also applies the mask to the latents themselves, so you'll likely need to set up noise_mask (inpaint related stuff) to use inpaint/outpaint as intended. As for testing things out on my end right now, 1) I am busy with other things and 2) I personally don't use SDXL at all, so it's not something I am personally passionate about getting on ASAP compared to other things. If someone wants to look at the original code to confirm, please do so and let me know. The preprocessor for turning a mask into black pixels is dead simple, so I can add it this weekend, but the noise mask node already exists for inpainting in vanilla ComfyUI. Not sure if I'd want to make a 'combined' preprocessor that would simplify inpainting/outpainting using this controlnet or if it would have other consequences, but I can look into that at some point this weekend too. My guess for the 0,0,0 values instead of -1,-1,-1 values in union is that since it is trying to be an 'all-in-one' controlnet, it would absolutely mess up all the training if just one of the input types happened to use negative values while everything else was scaled for [0, 1]. Even for other controlnet inputs, if there are negatives present in the cond image, something goes either to inf or Nan and ends up returning a black image, so it's a quirk of the model. TL;DR: in addition to needing a special preprocess node to making mask make the pixels 0,0,0 in the input image, inpaint/outpaint type seems to require that you follow extra inpaint steps like setting a noise mask on the latents in a way that would match up with the black pixel mask applied to the controlnet inputs. I've included screenshots of the vanilla ComfyUI nodes that would create a noise_mask on the latents. @jokero3answer Hopefully this clears things up. Might be redundant to say after typing all this, but the black requirement has nothing to do with my code and is just the way promax 'repaint' mode was trained. |
There is no unwillingness to expand here. I've been supporting Advanced-ControlNet for a year now and I don't intend on stopping anytime soon. From my understanding, the inpaint for union just needs a noise mask applied to the latents, which ComfyUI already supports with native nodes, so it can be tested. If there is more than that needed and there is a side by side comparison in the results to show it, please do let me know and we can work on having it be added in. I tagged this issue with "help needed" for a reason, I haven't had the chance to get into the weeds yet of ProMax-only types (tile and repaint), and I'm not sure if the existing preprocessors in control-aux (control-aux is not my repo btw) do what union/promax expects as input and if more needs to be done other than the noise mask. PRs are welcome too, even if just to share snippets of code to inspire the actual implementation. |
Hello @Kosinkadink can I bump in this issue with inpaint/outpaint in this same thread?
|
You'll need the Promax model (union was the initial model, Promax was basically the v2 model that added additional control types). |
Thank you, you were bang on right. the promax file version was the issue. |
I noticed that you have added support for Controlnet++, thank you very much for your work!
But I would also like to ask, in the new controlnet union, it is claimed that inpaint is supported, but I don't know how to use this feature through your node, can you please take the time to answer my query?
The text was updated successfully, but these errors were encountered: