From 4a34e5804e13936ee07a14cf9ebf47b2d4e0a7bb Mon Sep 17 00:00:00 2001 From: Kohya S Date: Wed, 5 Jul 2023 21:55:43 +0900 Subject: [PATCH] fix to work with .ckpt from comfyui --- library/sdxl_model_util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/sdxl_model_util.py b/library/sdxl_model_util.py index c7b9f966..b9533af1 100644 --- a/library/sdxl_model_util.py +++ b/library/sdxl_model_util.py @@ -44,6 +44,9 @@ def convert_sdxl_text_encoder_2_checkpoint(checkpoint, max_length): key = key.replace(".token_embedding.weight", ".embeddings.token_embedding.weight") elif ".ln_final" in key: key = key.replace(".ln_final", ".final_layer_norm") + # ckpt from comfy has this key: text_model.encoder.text_model.embeddings.position_ids + elif ".embeddings.position_ids" in key: + key = None # remove this key: make position_ids by ourselves return key keys = list(checkpoint.keys())