Skip to content

Commit

Permalink
Fix bug with weights when prompt is long.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jul 6, 2023
1 parent ddc6f12 commit 608fcc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions comfy/sd1_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def encode_token_weights(self, token_weight_pairs):
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)

Expand Down

0 comments on commit 608fcc2

Please sign in to comment.