mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-02-28 22:51:45 +00:00
Fix another small bug in attention_bias redux (#6737)
* fix a bug in the attn_masked redux code when using weight=1.0 * oh shit wait there was another bug
This commit is contained in:
parent
079eccc92a
commit
832e3f5ca3
4
nodes.py
4
nodes.py
@ -1065,10 +1065,10 @@ class StyleModelApply:
|
||||
(txt, keys) = t
|
||||
keys = keys.copy()
|
||||
# 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:
|
||||
if "attention_mask" in keys or (strength_type == "attn_bias" and strength != 1.0):
|
||||
# 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]))
|
||||
attn_bias = torch.log(torch.Tensor([strength if strength_type == "attn_bias" else 1.0]))
|
||||
# get the size of the mask image
|
||||
mask_ref_size = keys.get("attention_mask_img_shape", (1, 1))
|
||||
n_ref = mask_ref_size[0] * mask_ref_size[1]
|
||||
|
Loading…
Reference in New Issue
Block a user