TinyTerra / ComfyUI_tinyterraNodes

A selection of nodes for Stable Diffusion ComfyUI
GNU General Public License v3.0
421 stars 45 forks source link

Slow startup time when WAS nodes and REMBG installed #104

Closed fofr closed 6 months ago

fofr commented 6 months ago

With was-node-suite, rembg and tinyterraNodes, this custom node takes ~40-50s to start, because of something to do with rembg.

With rembg:

1.6 seconds: /src/ComfyUI/custom_nodes/ComfyUI_InstantID
1.8 seconds: /src/ComfyUI/custom_nodes/was-node-suite-comfyui
54.0 seconds: /src/ComfyUI/custom_nodes/ComfyUI_tinyterraNodes

Without rembg:

0.0 seconds: /src/ComfyUI/custom_nodes/ComfyUI_tinyterraNodes
1.4 seconds: /src/ComfyUI/custom_nodes/ComfyUI_InstantID
1.5 seconds: /src/ComfyUI/custom_nodes/was-node-suite-comfyui

I'm not sure what the exact cause is here. This is with rembg already installed, and the install option set to False.

fofr commented 6 months ago

Moving from rembg import remove to the point of use, rather than at startup time seems to resolve the immediate issue: https://github.com/TinyTerra/ComfyUI_tinyterraNodes/compare/main...fofr:ComfyUI_tinyterraNodes:main

(Not raising a PR as this is not properly tested)

TinyTerra commented 6 months ago

Thanks for pointing this out, and the example. I modified your change slightly to reraise the error with the extra information, instead of outputting from the node.

fofr commented 6 months ago

I can confirm this works 🙏