"src/git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "f6efda9e2ff9782bad2aa0294ebef19c244035bc"
Commit 8594c8be authored by comfyanonymous's avatar comfyanonymous
Browse files

Empty the cache when torch cache is more than 25% free mem.

parent 8b65f5de
...@@ -339,7 +339,11 @@ def free_memory(memory_required, device, keep_loaded=[]): ...@@ -339,7 +339,11 @@ def free_memory(memory_required, device, keep_loaded=[]):
if unloaded_model: if unloaded_model:
soft_empty_cache() soft_empty_cache()
else:
if vram_state != VRAMState.HIGH_VRAM:
mem_free_total, mem_free_torch = get_free_memory(device, torch_free_too=True)
if mem_free_torch > mem_free_total * 0.25:
soft_empty_cache()
def load_models_gpu(models, memory_required=0): def load_models_gpu(models, memory_required=0):
global vram_state global vram_state
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment