The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Disable xformers in VAE when xformers == 0.0.18
comfyanonymouse46b1c3034a2
diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.pyindex 94f5510b9..788a6fc4f 100644--- a/comfy/ldm/modules/diffusionmodules/model.py+++ b/comfy/ldm/modules/diffusionmodules/model.py@@ -9,7 +9,7 @@ from typing import Optional, Anyfrom ldm.modules.attention import MemoryEfficientCrossAttentionimport model_management-if model_management.xformers_enabled():+if model_management.xformers_enabled_vae():import xformersimport xformers.ops@@ -364,7 +364,7 @@ class MemoryEfficientCrossAttentionWrapper(MemoryEfficientCrossAttention):def make_attn(in_channels, attn_type="vanilla", attn_kwargs=None):assert attn_type in ["vanilla", "vanilla-xformers", "memory-efficient-cross-attn", "linear", "none"], f'attn_type {attn_type} unknown'- if model_management.xformers_enabled() and attn_type == "vanilla":+ if model_management.xformers_enabled_vae() and attn_type == "vanilla":attn_type = "vanilla-xformers"if model_management.pytorch_attention_enabled() and attn_type == "vanilla":attn_type = "vanilla-pytorch"diff --git a/comfy/model_management.py b/comfy/model_management.pyindex 4aa47ff16..052dfb775 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -199,11 +199,25 @@ def get_autocast_device(dev):return dev.typereturn "cuda"+def xformers_enabled():if vram_state == CPU:return Falsereturn XFORMERS_IS_AVAILBLE++def xformers_enabled_vae():+ enabled = xformers_enabled()+ if not enabled:+ return False+ try:+ #0.0.18 has a bug where Nan is returned when inputs are too big (1152x1920 res images and above)+ if xformers.version.__version__ == "0.0.18":+ return False+ except:+ pass+ return enabled+def pytorch_attention_enabled():return ENABLE_PYTORCH_ATTENTION