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 mask issue with attention_xformers.
comfyanonymous07f6eeaa134b
diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.pyindex 3f543abdc..7b4ee2157 100644--- a/comfy/ldm/modules/attention.py+++ b/comfy/ldm/modules/attention.py@@ -372,10 +372,10 @@ def attention_xformers(q, k, v, heads, mask=None, attn_precision=None, skip_resh)if mask is not None:- pad = 8 - q.shape[1] % 8- mask_out = torch.empty([q.shape[0], q.shape[1], q.shape[1] + pad], dtype=q.dtype, device=q.device)- mask_out[:, :, :mask.shape[-1]] = mask- mask = mask_out[:, :, :mask.shape[-1]]+ pad = 8 - mask.shape[-1] % 8+ mask_out = torch.empty([q.shape[0], q.shape[2], q.shape[1], mask.shape[-1] + pad], dtype=q.dtype, device=q.device)+ mask_out[..., :mask.shape[-1]] = mask+ mask = mask_out[..., :mask.shape[-1]]out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=mask)