mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-25 19:13:31 +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
|
#don't actually unload dynamic models for the sake of other dynamic models
|
||||||
#as that works on-demand.
|
#as that works on-demand.
|
||||||
memory_required -= current_loaded_models[i].model.loaded_size()
|
memory_required -= current_loaded_models[i].model.loaded_size()
|
||||||
continue
|
memory_to_free = 0
|
||||||
logging.debug(f"Unloading {current_loaded_models[i].model.model.__class__.__name__}")
|
|
||||||
if memory_to_free > 0 and current_loaded_models[i].model_unload(memory_to_free):
|
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)
|
unloaded_model.append(i)
|
||||||
if ram_to_free > 0:
|
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)
|
current_loaded_models[i].model.partially_unload_ram(ram_to_free)
|
||||||
|
|
||||||
for i in sorted(unloaded_model, reverse=True):
|
for i in sorted(unloaded_model, reverse=True):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user