The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
mm: Remove Aimdo exemption for empty_cache (#12260)
rattus855849c65881
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex 72348258b..b6291f340 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -1724,11 +1724,9 @@ def soft_empty_cache(force=False):elif is_mlu():torch.mlu.empty_cache()elif torch.cuda.is_available():- if comfy.memory_management.aimdo_allocator is None:- #Pytorch 2.7 and earlier crashes if you try and empty_cache when mempools exist- torch.cuda.synchronize()- torch.cuda.empty_cache()- torch.cuda.ipc_collect()+ torch.cuda.synchronize()+ torch.cuda.empty_cache()+ torch.cuda.ipc_collect()def unload_all_models():free_memory(1e30, get_torch_device())diff --git a/main.py b/main.pyindex b8c951375..92d705b4d 100644--- a/main.py+++ b/main.py@@ -192,7 +192,10 @@ import comfy_aimdo.controlimport comfy_aimdo.torchif enables_dynamic_vram():- if comfy_aimdo.control.init_device(comfy.model_management.get_torch_device().index):+ if comfy.model_management.torch_version_numeric < (2, 8):+ logging.warning("Unsupported Pytorch detected. DynamicVRAM support requires Pytorch version 2.8 or later. Falling back to legacy ModelPatcher. VRAM estimates may be unreliable especially on Windows")+ comfy.memory_management.aimdo_allocator = None+ elif comfy_aimdo.control.init_device(comfy.model_management.get_torch_device().index):if args.verbose == 'DEBUG':comfy_aimdo.control.set_log_debug()elif args.verbose == 'CRITICAL':@@ -208,7 +211,7 @@ if enables_dynamic_vram():comfy.memory_management.aimdo_allocator = comfy_aimdo.torch.get_torch_allocator()logging.info("DynamicVRAM support detected and enabled")else:- logging.info("No working comfy-aimdo install detected. DynamicVRAM support disabled. Falling back to legacy ModelPatcher. VRAM estimates may be unreliable especially on Windows")+ logging.warning("No working comfy-aimdo install detected. DynamicVRAM support disabled. Falling back to legacy ModelPatcher. VRAM estimates may be unreliable especially on Windows")comfy.memory_management.aimdo_allocator = None