From 404049114913f1a134656769a538779d7c927249 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 6 Jul 2024 00:53:33 -0400 Subject: [PATCH] Better T5xxl detection. --- comfy/sd.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index e343e1fa..b39230bd 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -432,9 +432,11 @@ def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DI clip_target.clip = sd2_clip.SD2ClipModel clip_target.tokenizer = sd2_clip.SD2Tokenizer elif "encoder.block.23.layer.1.DenseReluDense.wi_1.weight" in clip_data[0]: - dtype_t5 = clip_data[0]["encoder.block.23.layer.1.DenseReluDense.wi_1.weight"].dtype - clip_target.clip = sd3_clip.sd3_clip(clip_l=False, clip_g=False, t5=True, dtype_t5=dtype_t5) - clip_target.tokenizer = sd3_clip.SD3Tokenizer + weight = clip_data[0]["encoder.block.23.layer.1.DenseReluDense.wi_1.weight"] + dtype_t5 = weight.dtype + if weight.shape[-1] == 4096: + clip_target.clip = sd3_clip.sd3_clip(clip_l=False, clip_g=False, t5=True, dtype_t5=dtype_t5) + clip_target.tokenizer = sd3_clip.SD3Tokenizer elif "encoder.block.0.layer.0.SelfAttention.k.weight" in clip_data[0]: clip_target.clip = sa_t5.SAT5Model clip_target.tokenizer = sa_t5.SAT5Tokenizer