Skip to content

Commit

Permalink
Remove duplicate text_projection key from some saved models.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Feb 28, 2024
1 parent 8daedc5 commit 37a86e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions comfy/diffusers_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def convert_text_enc_state_dict_v20(text_enc_dict, prefix=""):
text_proj = "transformer.text_projection.weight"
if k.endswith(text_proj):
new_state_dict[k.replace(text_proj, "text_projection")] = v.transpose(0, 1).contiguous()

relabelled_key = textenc_pattern.sub(lambda m: protected[re.escape(m.group(0))], k)
new_state_dict[relabelled_key] = v
else:
relabelled_key = textenc_pattern.sub(lambda m: protected[re.escape(m.group(0))], k)
new_state_dict[relabelled_key] = v

for k_pre, tensors in capture_qkv_weight.items():
if None in tensors:
Expand Down

0 comments on commit 37a86e4

Please sign in to comment.