Automatically UNLOAD Models from Vram

As we all know, Vram is very limited for most of us.
Its basically impossible to Run an LLM & say Flux Dev in the Vram at the same time (even on a RTX 4090)

If you have your LLM and ComfUI running on the same server, its critical to be able to quickly and automatically free up Vram

Example of how things should work to efficiently manage Vram

  1. Ask LLM to generate image prompt via Open-webui
  2. Once prompt is generated, Open-webui automatically UNLOADS LLM from Vram via Keep Alive setting 0 minutes
  3. Use freshly generated image prompt to send to ComfyUI via the Open-webui interface
  4. ComfyUI generate amazing image
  5. ComfyUI should then AUTOMATICALLY UNLOAD models from Vram, freeing up server ready for new LLM request.

Is this already possible?
If so, HOW?
If not, i really think it would make all our workflows far more efficient if this were possible.
Thanks

1 Like

Ok i have found a way to do this.
I found this git page SeanScripts / ComfyUI-Unload-Model that add a NODE that can unload ALL MODELS.

I placed it just before the image generation

and sure enough after generating the image, the Vram unloads and empties.

Would be great tho, if ComfyUI integrated this setting natively.

This topic was automatically closed 5 hours after the last reply. New replies are no longer allowed.