chflame163 / ComfyUI_LayerStyle

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
MIT License
676 stars 33 forks source link

BiRefNetUltra generates an error when outputting a mask from a 4K image. #94

Closed wsry888 closed 1 week ago

wsry888 commented 1 month ago

Error occurred when executing LayerMask: BiRefNetUltra:

[enforce fail at alloc_cpu.cpp:80] data. DefaultCPUAllocator: not enough memory: you tried to allocate 103079215104 bytes.

However, another node is functioning normally,(https://github.com/viperyl/ComfyUI-BiRefNet),

As shown in the figure:

image

btw, 24g vram

chflame163 commented 1 month ago

Please tell me the size(width and height) of the input image. VitMatte method will take up a huge of memory when processing image larger than 2K, you can use other methods to do that.

wsry888 commented 1 month ago

Yep, 4096*4096

chflame163 commented 1 month ago

Yep, 4096*4096

emm, this is a problem. I have tested that processing 3840x2160 image with VitMatte will use more than 128G RAM (system memory)

chflame163 commented 1 week ago

The performance of the vitmate method in large images has been optimized, and if it exceeds 2K, it will shrink to 2K size for operation. 32GB of memory can handle large-sized images.