From b6951768c41fa69a870c022a3adbc349fc4f2ac1 Mon Sep 17 00:00:00 2001 From: Raphael Walker Date: Thu, 6 Feb 2025 22:51:16 +0100 Subject: [PATCH] fix a bug in the attn_masked redux code when using weight=1.0 (#6721) --- nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index ba9c4e4b..9779d5fd 100644 --- a/nodes.py +++ b/nodes.py @@ -1064,7 +1064,8 @@ class StyleModelApply: for t in conditioning: (txt, keys) = t keys = keys.copy() - if strength_type == "attn_bias" and strength != 1.0: + # even if the strength is 1.0 (i.e, no change), if there's already a mask, we have to add to it + if strength_type == "attn_bias" and strength != 1.0 and "attention_mask" not in keys: # math.log raises an error if the argument is zero # torch.log returns -inf, which is what we want attn_bias = torch.log(torch.Tensor([strength]))