Chaoses-Ib / ComfyScript

A Python frontend and library for ComfyUI
https://discord.gg/arqJbtEg7w
MIT License
422 stars 24 forks source link

Running a workflow multiple times leads into OOM #74

Closed lschaupp closed 1 month ago

lschaupp commented 1 month ago

File "/src/movie_trailer/run_movie_trailer_gen.py", line 987, in run_workflow image2 = AIOPreprocessor(image, 'Zoe-DepthMapPreprocessor', 1024) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/src/ComfyUI/custom_nodes/ComfyScript/src/comfy_script/runtime/real/nodes.py", line 153, in new outputs = getattr(obj, obj.FUNCTION)(*args, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/src/ComfyUI/custom_nodes/comfyui_controlnet_aux/init.py", line 120, in execute return getattr(aux_class(), aux_class.FUNCTION)(params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/src/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/zoe.py", line 18, in execute out = common_annotator_call(model, image, resolution=resolution) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/src/ComfyUI/custom_nodes/comfyui_controlnet_aux/utils.py", line 85, in common_annotator_call np_result = model(np_image, output_type="np", detect_resolution=detect_resolution, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/src/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/zoe/init.py", line 45, in call depth = self.model.infer(image_depth)

The issue seems to be with comfyui_controlnet_aux. Anything I can do about it?
Chaoses-Ib commented 1 month ago

If you are using real mode, you may need to unload the models yourself:

...

import comfy.model_management

comfy.model_management.unload_all_models()
comfy.model_management.soft_empty_cache()

See #21 for details.

lschaupp commented 1 month ago

Thanks. Resolved it by using: gc.collect()