From 9d48f271345e89af3e0349a7b208712971d46b89 Mon Sep 17 00:00:00 2001 From: John Slegers Date: Mon, 12 Aug 2024 04:53:11 +0200 Subject: [PATCH] Increase threshold for automatic HIGH_VRAM & do not offload unet when RAM < VRAM 12 is too low a threshold for HIGH_VRAM. Offloading unet should only be done when RAM > VRAM. --- comfy/model_management.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 3c8781690..2e18b205d 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -156,7 +156,7 @@ if cpu_state != CPUState.CPU: if total_ram < 6 * (1024 * 1024 * 1024) : set_vram_to = VRAMState.LOW_VRAM lowvram_available = True - if total_ram > 12 * (1024 * 1024 * 1024) : + if total_ram > 48 * (1024 * 1024 * 1024) : vram_state = VRAMState.HIGH_VRAM try: @@ -592,7 +592,7 @@ def dtype_size(dtype): return dtype_size def unet_offload_device(): - if vram_state == VRAMState.HIGH_VRAM: + if vram_state == VRAMState.HIGH_VRAM or total_ram < total_vram: return get_torch_device() else: return torch.device("cpu")