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.

Fix issue with batch_size > 1 on some models. (#12892)

comfyanonymousf6274c06b4e7
diff --git a/comfy/ldm/flux/layers.py b/comfy/ldm/flux/layers.py
index e20d498f8..e28d704b4 100644
--- a/comfy/ldm/flux/layers.py
+++ b/comfy/ldm/flux/layers.py
@@ -144,9 +144,9 @@ def apply_mod(tensor, m_mult, m_add=None, modulation_dims=None):
return tensor * m_mult
else:
for d in modulation_dims:
- tensor[:, d[0]:d[1]] *= m_mult[:, d[2]]
+ tensor[:, d[0]:d[1]] *= m_mult[:, d[2]:d[2] + 1]
if m_add is not None:
- tensor[:, d[0]:d[1]] += m_add[:, d[2]]
+ tensor[:, d[0]:d[1]] += m_add[:, d[2]:d[2] + 1]
return tensor