Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Don't init the CLIP model when the checkpoint has no CLIP weights.

comfyanonymous38b7ac6e269e
diff --git a/comfy/sd.py b/comfy/sd.py
index c15d73fed..5b22d1178 100644
--- a/comfy/sd.py
+++ b/comfy/sd.py
@@ -470,10 +470,13 @@ def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, o
w = WeightsLoader()
clip_target = model_config.clip_target()
if clip_target is not None:
- clip = CLIP(clip_target, embedding_directory=embedding_directory)
- w.cond_stage_model = clip.cond_stage_model
sd = model_config.process_clip_state_dict(sd)
- load_model_weights(w, sd)
+ if any(k.startswith('cond_stage_model.') for k in sd):
+ clip = CLIP(clip_target, embedding_directory=embedding_directory)
+ w.cond_stage_model = clip.cond_stage_model
+ load_model_weights(w, sd)
+ else:
+ print("no CLIP/text encoder weights in checkpoint, the text encoder model will not be loaded.")
left_over = sd.keys()
if len(left_over) > 0: