diff --git a/comfy/model_management.py b/comfy/model_management.py index 09dcaa295..e148408b8 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -238,6 +238,8 @@ def unload_model(): current_loaded_model.model_patches_to(current_loaded_model.offload_device) current_loaded_model.unpatch_model() current_loaded_model = None + if vram_state != VRAMState.HIGH_VRAM: + soft_empty_cache() if vram_state != VRAMState.HIGH_VRAM: if len(current_gpu_controlnets) > 0: diff --git a/comfy/sdxl_clip.py b/comfy/sdxl_clip.py index f676d8c81..d9298b205 100644 --- a/comfy/sdxl_clip.py +++ b/comfy/sdxl_clip.py @@ -35,6 +35,8 @@ class SDXLClipG(sd1_clip.SD1ClipModel): def load_sd(self, sd): if "text_projection" in sd: self.text_projection[:] = sd.pop("text_projection") + if "text_projection.weight" in sd: + self.text_projection[:] = sd.pop("text_projection.weight").transpose(0, 1) return super().load_sd(sd) class SDXLClipGTokenizer(sd1_clip.SD1Tokenizer):