The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Prioritize freeing partially offloaded models first.
comfyanonymousc7427375ee27
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex 11683a905..77c05510e 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -426,7 +426,7 @@ def free_memory(memory_required, device, keep_loaded=[]):shift_model = current_loaded_models[i]if shift_model.device == device:if shift_model not in keep_loaded:- can_unload.append((sys.getrefcount(shift_model.model), shift_model.model_memory(), i))+ can_unload.append((-shift_model.model_offloaded_memory(), sys.getrefcount(shift_model.model), shift_model.model_memory(), i))shift_model.currently_used = Falsefor x in sorted(can_unload):