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.

Allow attn_mask in attention_pytorch.

comfyanonymousac7d8cfa875e
diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py
index 3230cfaf5..ac0d9c8c5 100644
--- a/comfy/ldm/modules/attention.py
+++ b/comfy/ldm/modules/attention.py
@@ -284,7 +284,7 @@ def attention_pytorch(q, k, v, heads, mask=None):
(q, k, v),
)
- out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, dropout_p=0.0, is_causal=False)
+ out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False)
if exists(mask):
raise NotImplementedError