The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Make maximum_batch_area take into account python2.0 attention function.
comfyanonymous6fc4917634d4
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex b0640d674..39df8d9a7 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -275,8 +275,17 @@ def xformers_enabled_vae():return XFORMERS_ENABLED_VAEdef pytorch_attention_enabled():+ global ENABLE_PYTORCH_ATTENTIONreturn ENABLE_PYTORCH_ATTENTION+def pytorch_attention_flash_attention():+ global ENABLE_PYTORCH_ATTENTION+ if ENABLE_PYTORCH_ATTENTION:+ #TODO: more reliable way of checking for flash attention?+ if torch.version.cuda: #pytorch flash attention only works on Nvidia+ return True+ return False+def get_free_memory(dev=None, torch_free_too=False):global xpu_availableglobal directml_enabled@@ -312,9 +321,9 @@ def maximum_batch_area():return 0memory_free = get_free_memory() / (1024 * 1024)- if xformers_enabled():+ if xformers_enabled() or pytorch_attention_flash_attention():#TODO: this needs to be tweaked- area = 50 * memory_free+ area = 20 * memory_freeelse:#TODO: this formula is because AMD sucks and has memory management issues which might be fixed in the futurearea = ((memory_free - 1024) * 0.9) / (0.6)