Uh oh!
There was an error while loading. Please reload this page.
add PAG support sd15 controlnet - #8820
Conversation
tuanh123789
commented
Jul 9, 2024
Hi @a-r-r-o-w I open new PR because I cannot undo deleted pipelines. I have edited it according to your comment, please review again, thank you |
a-r-r-o-w
left a comment
There was a problem hiding this comment.
Looking great. Just small changes remaining and this should be good for merge.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HuggingFaceDocBuilderDev
commented
Jul 10, 2024
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. |
a-r-r-o-w
commented
Jul 10, 2024
Thank you for addressing the comments! Could we fix the failing tests? Error logsLet me know if you need any help. We can merge as soon as these are fixed since everything else looks good to me! |
tuanh123789
commented
Jul 10, 2024
Sure can you help me on tests 🤗 |
a-r-r-o-w
commented
Jul 10, 2024
For the first two test failures, you will have to update the expected values to what is the actual value of For the third test, you need to remove |
| # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents | ||
| def decode_latents(self, latents): | ||
| deprecation_message = "The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead" | ||
| deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False) | ||
| latents = 1 / self.vae.config.scaling_factor * latents | ||
| image = self.vae.decode(latents, return_dict=False)[0] | ||
| image = (image / 2 + 0.5).clamp(0, 1) | ||
| # we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16 | ||
| image = image.cpu().permute(0, 2, 3, 1).float().numpy() | ||
| return image |
There was a problem hiding this comment.
| # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents | |
| defdecode_latents(self, latents): | |
| deprecation_message="The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead" | |
| deprecate("decode_latents", "1.0.0", deprecation_message, standard_warn=False) | |
| latents=1/self.vae.config.scaling_factor*latents | |
| image=self.vae.decode(latents, return_dict=False)[0] | |
| image= (image/2+0.5).clamp(0, 1) | |
| # we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16 | |
| image=image.cpu().permute(0, 2, 3, 1).float().numpy() | |
| returnimage |
I don't think it is used
| extra_step_kwargs["generator"] = generator | ||
| return extra_step_kwargs | ||
| def check_inputs( |
There was a problem hiding this comment.
should we add a #Copied from here
There was a problem hiding this comment.
I don't think we have a version of check_inputs with callback_steps removed, and this is the first of its kind
yiyixuxu
commented
Jul 11, 2024
feel free to merge once you're happy with it! @a-r-r-o-w |
tuanh123789
commented
Jul 12, 2024
@a-r-r-o-w Can you help me with last fail of test 🤗 |
@tuanh123789 The failing test is unrelated and nothing needs to be done on your end. I'm happy to merge this once you address YiYi's comment: #8820 (comment) |
tuanh123789
commented
Jul 12, 2024
:v Sure, will be done right away |
There was a problem hiding this comment.
Thanks, looking good! One other thing that I just realised - could you update the pipelines doc page with this SD15 Controlnet? https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/pag.md. Please see #7944 for an example
tuanh123789
commented
Jul 12, 2024
Done |
crapthings
commented
Jul 14, 2024
pip install git+https://github.com/huggingface/diffusers ImportError: cannot import name 'StableDiffusionControlNetPAGPipeline' from 'diffusers' pip list diffusers 0.30.0.dev0 how can i test? |
crapthings
commented
Jul 14, 2024
how do i know if its working fix seed and test? |
Bhavay-2001
commented
Jul 14, 2024
Hi @tuanh123789, could you please share the colab notebook you used to test the images which you have shown in the above output. Thanks |
asomoza
commented
Jul 14, 2024
yes, preferably with a complex generation that you can see pag helps to fix.
It's literally copy & paste the example from this PR, there's nothing else you have to do.
You could just paste everything in one cell block, but here's notebook with the steps to test it. |
* add pag support sd15 controlnet * fix quality import * remove unecessary import * remove if state * fix tests * remove useless function * add sd1.5 controlnet pag docs --------- Co-authored-by: anhnct8 <anhnct8@fpt.com>
* add pag support sd15 controlnet * fix quality import * remove unecessary import * remove if state * fix tests * remove useless function * add sd1.5 controlnet pag docs --------- Co-authored-by: anhnct8 <anhnct8@fpt.com>


What does this PR do?
Adds PAG (Perturbed-Attention Guidance) support for SD 1.5 with controlnet models (StableDiffusionControlNetPAGPipeline)
Continuation of #8710
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@yiyixuxu
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.