Nodes/comfyui-arkennemasis/arkennemasis Purge VRAM (between stages)
ComfyUI Node

arkennemasis Purge VRAM (between stages)

Unload every model and empty the CUDA cache, then pass the input straight through. Put it between two stages that use different big models so the second one starts with the memory free.

By Hishamahmer·Created about a month ago·Updated 9 days ago· 5
arkennemasis Purge VRAM (between stages)
  • images
  • anything
  • images
  • anything
  • report
unload_modelstrue
empty_cachetrue
collect_garbagetrue
Categoryarkennemasis/Utility

Inputs (5)

NameTypeDefaultDescription
unload_modelsBOOLEANtrueEvict every loaded model from VRAM. This is the one that actually frees the gigabytes.
empty_cacheBOOLEANtrueReturn PyTorch's cached blocks to the driver. Without this the memory stays reserved and the next model still cannot see it.
collect_garbageBOOLEANtrueRun Python's collector first, so tensors waiting on a reference cycle are actually released.
imagesoptIMAGEWire the image generator in here and take `images` back out into the next stage. That link is what makes ComfyUI run the purge at this point in the graph.
anythingopt*Same idea for anything that is not an image — any type in, the same value out.

Outputs (3)

NameTypeDescription
imagesIMAGE
anything*
reportSTRING