Use SageAttention fallback for direct VAE
This commit is contained in:
parent
9c9e0857c2
commit
f85627a9fd
1 changed files with 6 additions and 1 deletions
|
|
@ -101,6 +101,11 @@ class Attention(nn.Module):
|
||||||
from comfy.ldm.modules.attention import optimized_attention
|
from comfy.ldm.modules.attention import optimized_attention
|
||||||
|
|
||||||
output = optimized_attention(query, key, value, self.heads, skip_reshape=True)
|
output = optimized_attention(query, key, value, self.heads, skip_reshape=True)
|
||||||
|
except Exception:
|
||||||
|
try:
|
||||||
|
from sageattention import sageattn
|
||||||
|
|
||||||
|
output = sageattn(query, key, value, is_causal=False, tensor_layout="HND", smooth_k=False).transpose(1, 2)
|
||||||
except Exception:
|
except Exception:
|
||||||
output = F.scaled_dot_product_attention(query, key, value).transpose(1, 2)
|
output = F.scaled_dot_product_attention(query, key, value).transpose(1, 2)
|
||||||
return self.to_out(output.reshape(batch, sequence, -1).nan_to_num_(0.0))
|
return self.to_out(output.reshape(batch, sequence, -1).nan_to_num_(0.0))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue