The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Slightly lower hunyuan video memory usage.
comfyanonymous6320d0569642
diff --git a/comfy/ldm/flux/math.py b/comfy/ldm/flux/math.pyindex b6549585a..b5960ffd3 100644--- a/comfy/ldm/flux/math.py+++ b/comfy/ldm/flux/math.py@@ -5,8 +5,15 @@ from torch import Tensorfrom comfy.ldm.modules.attention import optimized_attentionimport comfy.model_management+def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor:- q, k = apply_rope(q, k, pe)+ q_shape = q.shape+ k_shape = k.shape++ q = q.float().reshape(*q.shape[:-1], -1, 1, 2)+ k = k.float().reshape(*k.shape[:-1], -1, 1, 2)+ q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v)+ k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v)heads = q.shape[1]x = optimized_attention(q, k, v, heads, skip_reshape=True, mask=mask)