Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Small flux optimization. (#8611)

comfyanonymousf7fb1937127a
diff --git a/comfy/ldm/flux/layers.py b/comfy/ldm/flux/layers.py
index 76af967e6..113eb2096 100644
--- a/comfy/ldm/flux/layers.py
+++ b/comfy/ldm/flux/layers.py
@@ -118,7 +118,7 @@ class Modulation(nn.Module):
def apply_mod(tensor, m_mult, m_add=None, modulation_dims=None):
if modulation_dims is None:
if m_add is not None:
- return tensor * m_mult + m_add
+ return torch.addcmul(m_add, tensor, m_mult)
else:
return tensor * m_mult
else: