From 07f6eeaa134b34ef38ff6d9014061cfeb5d041e5 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 20 Nov 2024 17:07:46 -0500 Subject: [PATCH 1/2] Fix mask issue with attention_xformers. --- comfy/ldm/modules/attention.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 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) From 772e620e32e2bc50b1a1c13e5afa4f990786c059 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 20 Nov 2024 20:42:51 -0500 Subject: [PATCH 2/2] Update readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 714a1d9b5..2ddb925c9 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Put your VAE in: models/vae ### AMD GPUs (Linux only) AMD users can install rocm and pytorch with pip if you don't have it already installed, this is the command to install the stable version: -```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1``` +```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2``` This is the command to install the nightly with ROCm 6.2 which might have some performance improvements: