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 bug with weights when prompt is long.

comfyanonymous608fcc25917d
diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py
index 27b2f18e5..11f26bb8f 100644
--- a/comfy/sd1_clip.py
+++ b/comfy/sd1_clip.py
@@ -23,11 +23,11 @@ class ClipTokenWeightEncoder:
first_pooled = pooled[0:1]
output = []
- for i in range(1, out.shape[0]):
- z = out[i:i+1]
+ for k in range(1, out.shape[0]):
+ z = out[k:k+1]
for i in range(len(z)):
for j in range(len(z[i])):
- weight = token_weight_pairs[i - 1][j][1]
+ weight = token_weight_pairs[k - 1][j][1]
z[i][j] = (z[i][j] - z_empty[0][j]) * weight + z_empty[0][j]
output.append(z)