Skip to content

Fix from_ckpt for Stable Diffusion 2.x #3662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2023
Merged

Fix from_ckpt for Stable Diffusion 2.x #3662

merged 1 commit into from
Jun 6, 2023

Conversation

ctrysbita
Copy link
Contributor

@ctrysbita ctrysbita commented Jun 3, 2023

Fix #3661

This is because from_ckpt uses FrozenCLIPEmbedder for StableDiffusionPipeline but it should be FrozenOpenCLIPEmbedder in Stable Diffusion 2.x.

The original download_from_original_stable_diffusion_ckpt uses a layer that only presents in Stable Diffusion 2.x checkpoint to infer the model_type, which is not work with from_ckpt because it overrides the param. I think we can just leave the model_type empty for Stable Diffusion pipelines and then it will be inferred correctly.

By the way, this PR also fixes some invalid assignments for model_type.

@patrickvonplaten
Copy link
Contributor

@williamberman could you check if this might already be fixed with #3657 ?

@williamberman
Copy link
Contributor

unrelated! that PR was controlnet specific

Comment on lines -1429 to +1439
model_type == "FrozenOpenCLIPEmbedder"
model_type = "FrozenOpenCLIPEmbedder"
stable_unclip = "txt2img"
elif pipeline_name == "StableUnCLIPImg2ImgPipeline":
model_type == "FrozenOpenCLIPEmbedder"
model_type = "FrozenOpenCLIPEmbedder"
stable_unclip = "img2img"
elif pipeline_name == "PaintByExamplePipeline":
model_type == "PaintByExample"
model_type = "PaintByExample"
elif pipeline_name == "LDMTextToImagePipeline":
model_type == "LDMTextToImage"
model_type = "LDMTextToImage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this part of the code but this looks good to me, the == seems to be a typo

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 6, 2023

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten patrickvonplaten merged commit 2de9e2d into huggingface:main Jun 6, 2023
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

from_ckpt not work for Stable Diffusion 2.x weights
4 participants