Acly / comfyui-inpaint-nodes

Nodes for better inpainting with ComfyUI: Fooocus inpaint model for SDXL, LaMa, MAT, and various other tools for pre-filling inpaint & outpaint areas.
GNU General Public License v3.0
463 stars 33 forks source link

Inpaint with Fooocus, request sdxl model every time at KSampler. Cost extra time #64

Open jarheadjoe opened 1 week ago

Acly commented 1 week ago

It doesn't, unless you change the inputs like image/mask.

jarheadjoe commented 1 week ago

It doesn't, unless you change the inputs like image/mask.

Yes, when change input image, it requests to load new model. But in normal i2i or inpaint workflow, changing inputs will not request new model. I think the problem is in applyFoocusInpaint node: when changing input image, the node calculate the image feature and add to the model directly and return the new model, which makes comfyui think it should load a new model. I think the node ought to split to AssembleFoocusModel Node where it adds patch block to base model and ApplyFoocusInpaint Node where it feeds image and mask to the new model.

Acly commented 1 week ago

Feeding the image/mask to the new model also changes the model. Attaching the image/mask to the model is the source of the problem, it would make more sense if they were passed in while sampling. I don't see a way to implement it that way without changes in base ComfyUI though, as it doesn't pass the latent to the patch function.