Skip to content
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

fix: support for loading playground v2.5 single file checkpoint. #7230

Merged
merged 15 commits into from
Mar 7, 2024

Conversation

sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Mar 6, 2024

What does this PR do?

Fixes: #7221.

Code to test:

from diffusers import StableDiffusionXLPipeline, EDMDPMSolverMultistepScheduler
import torch

url = "https://huggingface.co/playgroundai/playground-v2.5-1024px-aesthetic/blob/main/playground-v2.5-1024px-aesthetic.safetensors"
pipeline = StableDiffusionXLPipeline.from_single_file(url)

pipeline.to(device="cuda", dtype=torch.float16)

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image  = pipeline(prompt=prompt, guidance_scale=3.0).images[0]
image.save("playground_test_image.png")

We need to be careful when loading the FP16 checkpoint. See internal thread: https://huggingface.slack.com/archives/C03HBN1C8CW/p1709703331962229. Currently, we parse it correctly from the single file checkpoint. However, when using the diffusers format, if someone specifies variant="fp16" it is going to incorrectly fetch the mean and std corresponding to the FP32 variant. During inference, it doesn't cause a huge problem, but it does when fine-tuning with the FP16 variant.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sayakpaul
Copy link
Member Author

@DN6 I have addressed your comments. The code snippet posted in the OP generates:

playground_test_image

@sayakpaul sayakpaul requested a review from DN6 March 6, 2024 09:26
@sayakpaul
Copy link
Member Author

@DN6 done.

@nicksonredfield
Copy link

@DN6 done.

is it possible to push this fix to A1111? really need it, tks!

@sayakpaul
Copy link
Member Author

@DN6 up for another review :-)

@sayakpaul sayakpaul requested a review from DN6 March 6, 2024 12:41
@nicksonredfield
Copy link

@DN6 up for another review :-)

Recently I've been using the PG2 model for character and scene design for my novel, creating some great images, and I've found that the DPMA sampler and high amount of cue words are only available in the A1111 webui to realize the full potential of the PG model, and I was very eager to continue my creations with PG2.5 when it was released. But I found that comfyUI couldn't release its potential and the A1111 was buggy running the model.

I'm not a developer, so I can't understand the details of what you guys are discussing, and I don't know if you guys will push this fix to the A1111 branch, so if this model is able to run in A1111, I hope to let me know here or on HG's model release page.

My creations stem from your support and it is much appreciated.
00257-3013793337
00086-263538876
00310-229345664

@sayakpaul
Copy link
Member Author

I'm not a developer, so I can't understand the details of what you guys are discussing, and I don't know if you guys will push this fix to the A1111 branch, so if this model is able to run in A1111, I hope to let me know here or on HG's model release page.

We won't be able to push the fix for now.

@nicksonredfield
Copy link

I'm not a developer, so I can't understand the details of what you guys are discussing, and I don't know if you guys will push this fix to the A1111 branch, so if this model is able to run in A1111, I hope to let me know here or on HG's model release page.

We won't be able to push the fix for now.

tks for reply, I would be very thankful if it could be done later, looking forward that.

@sayakpaul
Copy link
Member Author

Gonna merge this after the CI is complete. @DN6 do you want me to add a slow test?

@sayakpaul sayakpaul merged commit 1968356 into main Mar 7, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The picture is full of noise use playground-v2.5-1024px-aesthetic.fp16.safetensors
4 participants