Disable xformers when tracing model.

This commit is contained in:
comfyanonymous 2024-05-21 13:55:49 -04:00
parent 1900e5119f
commit 83d969e397

View File

@ -313,8 +313,18 @@ except:
def attention_xformers(q, k, v, heads, mask=None, attn_precision=None):
b, _, dim_head = q.shape
dim_head //= heads
disabled_xformers = False
if BROKEN_XFORMERS:
if b * heads > 65535:
disabled_xformers = True
if not disabled_xformers:
if torch.jit.is_tracing() or torch.jit.is_scripting():
disabled_xformers = True
if disabled_xformers:
return attention_pytorch(q, k, v, heads, mask)
q, k, v = map(