mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-16 06:37:41 +08:00
Fix ram freeing logic
This commit is contained in:
parent
8067cb4f93
commit
bc80f784d8
@ -630,11 +630,12 @@ def free_memory(memory_required, device, keep_loaded=[], for_dynamic=False, ram_
|
||||
#don't actually unload dynamic models for the sake of other dynamic models
|
||||
#as that works on-demand.
|
||||
memory_required -= current_loaded_models[i].model.loaded_size()
|
||||
continue
|
||||
logging.debug(f"Unloading {current_loaded_models[i].model.model.__class__.__name__}")
|
||||
memory_to_free = 0
|
||||
if memory_to_free > 0 and current_loaded_models[i].model_unload(memory_to_free):
|
||||
logging.debug(f"Unloading {current_loaded_models[i].model.model.__class__.__name__}")
|
||||
unloaded_model.append(i)
|
||||
if ram_to_free > 0:
|
||||
logging.debug(f"RAM Unloading {current_loaded_models[i].model.model.__class__.__name__}")
|
||||
current_loaded_models[i].model.partially_unload_ram(ram_to_free)
|
||||
|
||||
for i in sorted(unloaded_model, reverse=True):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user