Skip to content

Commit 2de9e2d

Browse files
authored
Fix from_ckpt for Stable Diffusion 2.x (#3662)
1 parent 11b3002 commit 2de9e2d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Diff for: src/diffusers/loaders.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1442,23 +1442,25 @@ def from_ckpt(cls, pretrained_model_link_or_path, **kwargs):
14421442

14431443
# TODO: For now we only support stable diffusion
14441444
stable_unclip = None
1445+
model_type = None
14451446
controlnet = False
14461447

14471448
if pipeline_name == "StableDiffusionControlNetPipeline":
1448-
model_type = "FrozenCLIPEmbedder"
1449+
# Model type will be inferred from the checkpoint.
14491450
controlnet = True
14501451
elif "StableDiffusion" in pipeline_name:
1451-
model_type = "FrozenCLIPEmbedder"
1452+
# Model type will be inferred from the checkpoint.
1453+
pass
14521454
elif pipeline_name == "StableUnCLIPPipeline":
1453-
model_type == "FrozenOpenCLIPEmbedder"
1455+
model_type = "FrozenOpenCLIPEmbedder"
14541456
stable_unclip = "txt2img"
14551457
elif pipeline_name == "StableUnCLIPImg2ImgPipeline":
1456-
model_type == "FrozenOpenCLIPEmbedder"
1458+
model_type = "FrozenOpenCLIPEmbedder"
14571459
stable_unclip = "img2img"
14581460
elif pipeline_name == "PaintByExamplePipeline":
1459-
model_type == "PaintByExample"
1461+
model_type = "PaintByExample"
14601462
elif pipeline_name == "LDMTextToImagePipeline":
1461-
model_type == "LDMTextToImage"
1463+
model_type = "LDMTextToImage"
14621464
else:
14631465
raise ValueError(f"Unhandled pipeline class: {pipeline_name}")
14641466

0 commit comments

Comments
 (0)