CivArchive
    Flux Lazy Inpainting Workflow - v1.0
    NSFW
    Preview 25866725
    Preview 25866874

    Yes, I called it lazy and i am proud of it! Why?
    Because all you need to do is literally 3 things.

    HOW IT WORKS

    1 add the image you want to inpaint in group 0

    2 jump to group 3 and in prompt input type the image segment you want to mask (in my example I use dress)

    3 write a short prompt regarding your inpaint expectations in group 4, in my example i wanted to write "#bonbonero" on her dress to promote my Twitter format

    Description

    FAQ

    Comments (18)

    J_unsureAug 24, 2024
    CivitAI

    Hey, love the idea and layout for the workflow.

    As someone completely new and learning Comfy for the first time, how do I get the image into the flow that I want to inpaint? In doing so will that remove all the issues with the 'red nodes' or do I need other files and models above the standard model, clip and vae?

    Thank you for your help

    KayKayTrax
    Author
    Aug 24, 2024

    Hi, no. If you see "red nodes", this means you need to install the missing custom nodes via manager.
    Open it and click on install missing custom nodes, then restart and refresh.
    Before diving into an inpaint workflow, I'd suggest you to learn the basics. it will help you understanding the fundamentals, then after you can learn something more complex.
    This is my humble suggestion.

    J_unsureAug 24, 2024· 1 reaction

    @KayKayTrax Thank you very much for your reply, I appreciate the assistance. You are right of course, getting carried away with all the 'shiny' options and potentially skipping useful fundamentals. Will look to build up knowledge from the beginning first ;)

    supernovaSep 5, 2024
    CivitAI

    Thank you! This is an excellent workflow! Works like a charm and love the way you've laid out/organized the nodes 🤌.

    I have a question about expanding upon this...
    I'm trying to integrate a flux depth controlnet into this workflow to help follow the entire body more consistently during inpainting, while only inpainting on the torso. I had this working in an SDXL workflow and was getting 90% accuracy/consistency with inpainting. Haven't had such luck with trying to adapt this methodology to Flux yet. Any ideas on how this could be done?

    KayKayTrax
    Author
    Sep 6, 2024· 1 reaction

    I would try with Instant-X. You can connect it to the positive conditioning. Hope that helps :D

    supernovaSep 14, 2024

    @KayKayTrax I'll give it a go, thank you!

    zerocool22Sep 10, 2024
    CivitAI
    !!! Exception during processing !!! Allocation on device Traceback (most recent call last): File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\execution.py", line 323, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\execution.py", line 198, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(**inputs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 325, in main (images, masks) = sam_segment( ^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\comfyui_segment_anything\node.py", line 243, in sam_segment predictor.set_image(image_np_rgb) File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\segment_anything\predictor.py", line 60, in set_image self.set_torch_image(input_image_torch, image.shape[:2]) File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\comfyui_segment_anything\sam_hq\predictor.py", line 54, in set_torch_image self.features, self.interm_features = self.model.image_encoder(input_image) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\ComfyUI\custom_nodes\comfyui_segment_anything\sam_hq\modeling\image_encoder.py", line 14, in forward x = blk(x) ^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\segment_anything\modeling\image_encoder.py", line 174, in forward x = self.attn(x) ^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\segment_anything\modeling\image_encoder.py", line 234, in forward attn = add_decomposed_rel_pos(attn, q, self.rel_pos_h, self.rel_pos_w, (H, W), (H, W)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ZeroCool22\Desktop\SwarmUI\dlbackend\comfy\python_embeded\Lib\site-packages\segment_anything\modeling\image_encoder.py", line 358, in add_decomposed_rel_pos attn.view(B, q_h, q_w, k_h, k_w) + rel_h[:, :, :, :, None] + rel_w[:, :, :, None, :] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ torch.cuda.OutOfMemoryError: Allocation on device Got an OOM, unloading all loaded models. Prompt executed in 98.56 seconds
    KayKayTrax
    Author
    Sep 10, 2024

    Hi to you too! :P

    the error means you ran out of memory.
    You can try to use a GGUF model (Q8 or Q6 or lower), use them with their loader
    https://github.com/city96/ComfyUI-GGUF

    GGUF models can be found here:
    flux1-dev GGUF
    flux1-schnell GGUF

    zerocool22Sep 10, 2024

    @KayKayTrax Thx, will try!

    KayKayTrax
    Author
    Sep 10, 2024

    @zerocool22 update. I had a similar problem too.
    1 check the ref image is not too big
    2 check if the onnxruntime gives you problems. You might need to uninstall the misatching version and reinstall the previous one

    pip uninstall onnxruntime
    pip uninstall onnxruntime-gpu
    pip install onnxruntime==1.18.0
    pip install onnxruntime-gpu==1.18.0

    TetsuooSep 19, 2024
    CivitAI

    Thanks for sharing. Well, it looked good but... there's always something breaking, right :/
    GroundingDinoSAMSegment doesn't work :
    RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat2 in method wrapper_CUDA_mm)

    So for now I just paint a mask manually, but let's be honest this all doesn't work very well, I get better inpainting results in Forge with less trouble...

    KayKayTrax
    Author
    Sep 21, 2024

    Thanks for sharing your experience! It sounds like the error you're encountering is related to your device setup—when tensors are on different devices (like CPU and GPU), that can cause issues. Since the workflow is functioning for others, it’s likely a configuration issue rather than a problem with the workflow itself. If you’d like, I can help you troubleshoot to ensure everything is running smoothly on your end. Comfy can be a bit tricky, but once things are set up correctly, it should work well!

    TetsuooSep 21, 2024

    @KayKayTrax You don't really need my autorisation to help me, if you can help please do, thank you x) Of course I'd like help that's why I commented in the first place lol thinking you might know the issue. With AI tools I now spend my whole life fighting Python errors it's painful I'm no developer xD

    KayKayTrax
    Author
    Sep 21, 2024

    @Tetsuoo I am not a python dev either but with more context I might help. let me know :D

    TetsuooSep 22, 2024

    @KayKayTrax ok... Forget it man... forget it.

    julayen964Nov 8, 2024
    CivitAI

    hello;

    thks for sharing, its a cool and simple workflow.

    i try to arange the form and the color of a pillow.

    it render it more comfy as i want but the color dosen't change.....did i something wrong?

    KayKayTrax
    Author
    Nov 10, 2024

    try to write in the prompt
    (blue pillow)::8
    or whatever color you need. :)

    julayen964Nov 12, 2024

    ok thx; i will try your synthax

    Workflows
    Flux.1 D

    Details

    Downloads
    962
    Platform
    CivitAI
    Platform Status
    Available
    Created
    8/24/2024
    Updated
    6/12/2026
    Deleted
    -

    Files

    fluxLazyInpainting_v10.zip

    Mirrors

    CivitAI (1 mirrors)