From 4ba7fa0244badcf901f2b8ddbfb8539c6398672f Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 28 Jul 2024 01:19:20 -0400 Subject: [PATCH] Refactor: Move sd2_clip.py to text_encoders folder. --- comfy/sd.py | 6 +++--- comfy/supported_models.py | 4 ++-- comfy/{ => text_encoders}/sd2_clip.py | 0 comfy/{ => text_encoders}/sd2_clip_config.json | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename comfy/{ => text_encoders}/sd2_clip.py (100%) rename comfy/{ => text_encoders}/sd2_clip_config.json (100%) diff --git a/comfy/sd.py b/comfy/sd.py index b1d38c4b..8bf8d108 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -17,8 +17,8 @@ from . import diffusers_convert from . import model_detection from . import sd1_clip -from . import sd2_clip from . import sdxl_clip +import comfy.text_encoders.sd2_clip import comfy.text_encoders.sd3_clip import comfy.text_encoders.sa_t5 import comfy.text_encoders.aura_t5 @@ -414,8 +414,8 @@ def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DI clip_target.clip = sdxl_clip.SDXLRefinerClipModel clip_target.tokenizer = sdxl_clip.SDXLTokenizer elif "text_model.encoder.layers.22.mlp.fc1.weight" in clip_data[0]: - clip_target.clip = sd2_clip.SD2ClipModel - clip_target.tokenizer = sd2_clip.SD2Tokenizer + clip_target.clip = comfy.text_encoders.sd2_clip.SD2ClipModel + clip_target.tokenizer = comfy.text_encoders.sd2_clip.SD2Tokenizer elif "encoder.block.23.layer.1.DenseReluDense.wi_1.weight" in clip_data[0]: weight = clip_data[0]["encoder.block.23.layer.1.DenseReluDense.wi_1.weight"] dtype_t5 = weight.dtype diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 40417eb4..ddd0c173 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -3,8 +3,8 @@ from . import model_base from . import utils from . import sd1_clip -from . import sd2_clip from . import sdxl_clip +import comfy.text_encoders.sd2_clip import comfy.text_encoders.sd3_clip import comfy.text_encoders.sa_t5 import comfy.text_encoders.aura_t5 @@ -101,7 +101,7 @@ class SD20(supported_models_base.BASE): return state_dict def clip_target(self, state_dict={}): - return supported_models_base.ClipTarget(sd2_clip.SD2Tokenizer, sd2_clip.SD2ClipModel) + return supported_models_base.ClipTarget(comfy.text_encoders.sd2_clip.SD2Tokenizer, comfy.text_encoders.sd2_clip.SD2ClipModel) class SD21UnclipL(SD20): unet_config = { diff --git a/comfy/sd2_clip.py b/comfy/text_encoders/sd2_clip.py similarity index 100% rename from comfy/sd2_clip.py rename to comfy/text_encoders/sd2_clip.py diff --git a/comfy/sd2_clip_config.json b/comfy/text_encoders/sd2_clip_config.json similarity index 100% rename from comfy/sd2_clip_config.json rename to comfy/text_encoders/sd2_clip_config.json