Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix --use-flash-attention ignored when xformers installed. (#14083)

comfyanonymous08d809d128df
diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py
index a68cb8439..55360535a 100644
--- a/comfy/ldm/modules/attention.py
+++ b/comfy/ldm/modules/attention.py
@@ -741,12 +741,12 @@ optimized_attention = attention_basic
if model_management.sage_attention_enabled():
logging.info("Using sage attention")
optimized_attention = attention_sage
-elif model_management.xformers_enabled():
- logging.info("Using xformers attention")
- optimized_attention = attention_xformers
elif model_management.flash_attention_enabled():
logging.info("Using Flash Attention")
optimized_attention = attention_flash
+elif model_management.xformers_enabled():
+ logging.info("Using xformers attention")
+ optimized_attention = attention_xformers
elif model_management.pytorch_attention_enabled():
logging.info("Using pytorch attention")
optimized_attention = attention_pytorch