Skip to content

Commit

Permalink
Prevent the clip_g position_ids key from being saved in the checkpoint.
Browse files Browse the repository at this point in the history
This is to make it match the official checkpoint.
  • Loading branch information
comfyanonymous committed Jul 13, 2023
1 parent 46dc050 commit b2f0316
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions comfy/supported_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def process_clip_state_dict(self, state_dict):
def process_clip_state_dict_for_saving(self, state_dict):
replace_prefix = {}
state_dict_g = diffusers_convert.convert_text_enc_state_dict_v20(state_dict, "clip_g")
state_dict_g.pop("clip_g.transformer.text_model.embeddings.position_ids")
replace_prefix["clip_g"] = "conditioner.embedders.0.model"
state_dict_g = supported_models_base.state_dict_prefix_replace(state_dict_g, replace_prefix)
return state_dict_g
Expand Down Expand Up @@ -164,6 +165,7 @@ def process_clip_state_dict_for_saving(self, state_dict):
replace_prefix = {}
keys_to_replace = {}
state_dict_g = diffusers_convert.convert_text_enc_state_dict_v20(state_dict, "clip_g")
state_dict_g.pop("clip_g.transformer.text_model.embeddings.position_ids")
for k in state_dict:
if k.startswith("clip_l"):
state_dict_g[k] = state_dict[k]
Expand Down

0 comments on commit b2f0316

Please sign in to comment.