From 0aa7193d3bb7c924c5e225dee454a277d14e75d3 Mon Sep 17 00:00:00 2001 From: Sergey Borisov Date: Wed, 19 Jul 2023 04:18:43 +0300 Subject: [PATCH] Load text_model.embeddings.position_ids outsude state_dict --- .../backend/model_management/convert_ckpt_to_diffusers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/invokeai/backend/model_management/convert_ckpt_to_diffusers.py b/invokeai/backend/model_management/convert_ckpt_to_diffusers.py index e3e64940de..77bcffac31 100644 --- a/invokeai/backend/model_management/convert_ckpt_to_diffusers.py +++ b/invokeai/backend/model_management/convert_ckpt_to_diffusers.py @@ -841,7 +841,9 @@ def convert_ldm_clip_checkpoint(checkpoint): key ] + position_ids = text_model_dict.pop("text_model.embeddings.position_ids") text_model.load_state_dict(text_model_dict) + text_model.text_model.embeddings.position_ids.copy_(position_ids) return text_model @@ -947,7 +949,9 @@ def convert_open_clip_checkpoint(checkpoint): text_model_dict[new_key] = checkpoint[key] + position_ids = text_model_dict.pop("text_model.embeddings.position_ids") text_model.load_state_dict(text_model_dict) + text_model.text_model.embeddings.position_ids.copy_(position_ids) return text_model