The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Relax minimum ratio of weights loaded in memory on nvidia.
comfyanonymous57f330caf91a
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex 2cbdc7392..b480aaaa4 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -188,6 +188,11 @@ def is_nvidia():return Truereturn False++MIN_WEIGHT_MEMORY_RATIO = 0.4+if is_nvidia():+ MIN_WEIGHT_MEMORY_RATIO = 0.2+ENABLE_PYTORCH_ATTENTION = Falseif args.use_pytorch_cross_attention:ENABLE_PYTORCH_ATTENTION = True@@ -509,7 +514,8 @@ def load_models_gpu(models, memory_required=0, force_patch_weights=False, minimumodel_size = loaded_model.model_memory_required(torch_dev)loaded_memory = loaded_model.model_loaded_memory()current_free_mem = get_free_memory(torch_dev) + loaded_memory- lowvram_model_memory = max(64 * 1024 * 1024, (current_free_mem - minimum_memory_required), min(current_free_mem * 0.4, current_free_mem - minimum_inference_memory()))++ lowvram_model_memory = max(64 * 1024 * 1024, (current_free_mem - minimum_memory_required), min(current_free_mem * MIN_WEIGHT_MEMORY_RATIO, current_free_mem - minimum_inference_memory()))lowvram_model_memory = max(0.1, lowvram_model_memory - loaded_memory)if model_size <= lowvram_model_memory: #only switch to lowvram if really necessarylowvram_model_memory = 0