ltdrdata / ComfyUI-Impact-Pack

Custom nodes pack for ComfyUI This custom node helps to conveniently enhance images through Detector, Detailer, Upscaler, Pipe, and more.
GNU General Public License v3.0
1.89k stars 183 forks source link

Detector Node Irregular VRAM Crash on Low VRAM Systems #206

Closed crafter312 closed 1 year ago

crafter312 commented 1 year ago

I am running ComfyUI with Impact Pack on a Windows 11 laptop. My laptop does have a GPU, but it only has 4GB of VRAM. I know this is really pushing the minimum requirements. However, I don't mind if things take a really long time to run.

With this in mind, I've been experiencing irregular low VRAM crashes when using the Simple Detector (SEGS) node. By this, I mean that sometimes it crashes when I try to run my workflow, but sometimes if I restart ComfyUI it runs perfectly fine. Also, in workflows where I have multiple detector/detailer nodes in series, sometimes the first detector works fine, but the second detector node crashes.

During my most recent encounter with this crash, I noticed very specific circumstances leading to the crash. I had two detector/detailer nodes in sequence, with the first one dealing with faces and the second one dealing with eyes. The image I was detailing had one main face, and one small secondary face in the background. If I detected and detailed both faces, then the second detailer would crash. If, on the other hand, I increased the bbox_threashold on the first detector to ignore the background face, the second detector would run perfectly fine.

I have no idea what might be causing this issue, but is it possible that this could be fixed? I have attached the crash log below. detector_lowvram_crash.txt

Please let me know if any other information is needed.

ltdrdata commented 1 year ago

I recommend set "SAMLoader"'s device parameter as "Prefer CPU" mode.