The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Initial load device should be cpu when using dynamic vram. (#12766)
comfyanonymousac4a943ff364
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex 0f5966371..809600815 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -830,11 +830,14 @@ def unet_offload_device():return torch.device("cpu")def unet_inital_load_device(parameters, dtype):+ cpu_dev = torch.device("cpu")+ if comfy.memory_management.aimdo_enabled:+ return cpu_dev+torch_dev = get_torch_device()if vram_state == VRAMState.HIGH_VRAM or vram_state == VRAMState.SHARED:return torch_dev- cpu_dev = torch.device("cpu")if DISABLE_SMART_MEMORY or vram_state == VRAMState.NO_VRAM:return cpu_dev@@ -842,7 +845,7 @@ def unet_inital_load_device(parameters, dtype):mem_dev = get_free_memory(torch_dev)mem_cpu = get_free_memory(cpu_dev)- if mem_dev > mem_cpu and model_size < mem_dev and comfy.memory_management.aimdo_enabled:+ if mem_dev > mem_cpu and model_size < mem_dev:return torch_develse:return cpu_dev@@ -945,6 +948,9 @@ def text_encoder_device():return torch.device("cpu")def text_encoder_initial_device(load_device, offload_device, model_size=0):+ if comfy.memory_management.aimdo_enabled:+ return offload_device+if load_device == offload_device or model_size <= 1024 * 1024 * 1024:return offload_device