ManglerFTW / ComfyI2I

ComfyI2I is a set of custom nodes for ComfyUI that help with image 2 image functions.
Other
158 stars 16 forks source link

Inpaint Segments node runs out of memory when mask mapping is used #11

Closed nistvan86 closed 1 year ago

nistvan86 commented 1 year ago

I've updated my ComfyUI extensions recently and since then my existing workflow seems to run out of memory.

Error occurred when executing Inpaint Segments:

[enforce fail at ..\c10\core\impl\alloc_cpu.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 52776558133248 bytes.

  File "e:\aistuff\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "e:\aistuff\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "e:\aistuff\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "E:\aistuff\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyI2I\ComfyI2I.py", line 1430, in get_region
    Cut_Image = CutByMask(image, region, force_resize_width, force_resize_height, mask_mapping_optional)
  File "E:\aistuff\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyI2I\ComfyI2I.py", line 623, in CutByMask
    image = image[mask_mapping_optional]

It seems to be related to mask_mapping_optional, if I disconnect that it works, but the inpainted segments are just copy-pasted over the image without cutting them out by the mask first.

Maybe I've misconfigured some default values which came with the new version? I had to fix some of them.

nistvan86 commented 1 year ago

Never mind, I solved it by manually replacing each "Mask Ops" node. The new node looks different. Also originally I was nesting these nodes into one with the "Nested nodes" add-on, which could have again complicate things.