import{s as Xe,o as Fe,n as je}from"../chunks/scheduler.8c3d61f6.js";import{S as Ve,i as Qe,g as J,s as o,r as u,A as Ee,h as b,f as s,c,j as ke,u as g,x as Z,k as O,y as Ne,a,v as f,d as U,t as h,w}from"../chunks/index.589a98e8.js";import{T as xe}from"../chunks/Tip.42aa8582.js";import{C as R}from"../chunks/CodeBlock.36627b28.js";import{H as K,E as Se}from"../chunks/EditOnGithub.e5a8d9cb.js";import{H as He,a as Te}from"../chunks/HfOption.9804ab8b.js";function ze(W){let t,m='🤗 Diffusers currently only supports using PAG with selected SDXL pipelines, but feel free to open a <a href="https://github.com/huggingface/diffusers/issues/new/choose" rel="nofollow">feature request</a> if you want to add PAG support to a new pipeline!';return{c(){t=J("p"),t.innerHTML=m},l(n){t=b(n,"P",{"data-svelte-h":!0}),Z(t)!=="svelte-12akt4i"&&(t.innerHTML=m)},m(n,M){a(n,t,M)},p:je,d(n){n&&s(t)}}}function qe(W){let t,m='The <code>pag_applied_layers</code> argument allows you to specify which layers PAG is applied to. Additionally, you can use <code>set_pag_applied_layers</code> method to update these layers after the pipeline has been created. Check out the <a href="#pag_applied_layers">pag_applied_layers</a> section to learn more about applying PAG to other layers.';return{c(){t=J("p"),t.innerHTML=m},l(n){t=b(n,"P",{"data-svelte-h":!0}),Z(t)!=="svelte-h3gpzi"&&(t.innerHTML=m)},m(n,M){a(n,t,M)},p:je,d(n){n&&s(t)}}}function Le(W){let t,m,n,M,r,d="To generate an image, you will also need to pass a <code>pag_scale</code>. When <code>pag_scale</code> increases, images gain more semantically coherent structures and exhibit fewer artifacts. However overly large guidance scale can lead to smoother textures and slight saturation in the images, similarly to CFG. <code>pag_scale=3.0</code> is used in the official demo and works well in most of the use cases, but feel free to experiment and select the appropriate value according to your needs! PAG is disabled when <code>pag_scale=0</code>.",i,y,G,j,I='<div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_0.0_cfg_7.0_mid.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generated image without PAG</figcaption></div> <div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_3.0_cfg_7.0_mid.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generated image with PAG</figcaption></div>',C;return t=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjBlbmFibGVfcGFnJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHBhZ19hcHBsaWVkX2xheWVycyUzRCU1QiUyMm1pZCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    enable_pag=<span class="hljs-literal">True</span>,
    pag_applied_layers=[<span class="hljs-string">&quot;mid&quot;</span>],
    torch_dtype=torch.float16
)
pipeline.enable_model_cpu_offload()`,wrap:!1}}),n=new xe({props:{warning:!1,$$slots:{default:[qe]},$$scope:{ctx:W}}}),y=new R({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYW4lMjBpbnNlY3QlMjByb2JvdCUyMHByZXBhcmluZyUyMGElMjBkZWxpY2lvdXMlMjBtZWFsJTJDJTIwYW5pbWUlMjBzdHlsZSUyMiUwQSUwQWZvciUyMHBhZ19zY2FsZSUyMGluJTIwJTVCMC4wJTJDJTIwMy4wJTVEJTNBJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmNwdSUyMikubWFudWFsX3NlZWQoMCklMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjBwaXBlbGluZSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDcuMCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHBhZ19zY2FsZSUzRHBhZ19zY2FsZSUyQyUwQSUyMCUyMCUyMCUyMCkuaW1hZ2Vz",highlighted:`prompt = <span class="hljs-string">&quot;an insect robot preparing a delicious meal, anime style&quot;</span>

<span class="hljs-keyword">for</span> pag_scale <span class="hljs-keyword">in</span> [<span class="hljs-number">0.0</span>, <span class="hljs-number">3.0</span>]:
    generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
    images = pipeline(
        prompt=prompt,
        num_inference_steps=<span class="hljs-number">25</span>,
        guidance_scale=<span class="hljs-number">7.0</span>,
        generator=generator,
        pag_scale=pag_scale,
    ).images`,wrap:!1}}),{c(){u(t.$$.fragment),m=o(),u(n.$$.fragment),M=o(),r=J("p"),r.innerHTML=d,i=o(),u(y.$$.fragment),G=o(),j=J("div"),j.innerHTML=I,this.h()},l(p){g(t.$$.fragment,p),m=c(p),g(n.$$.fragment,p),M=c(p),r=b(p,"P",{"data-svelte-h":!0}),Z(r)!=="svelte-43v4ib"&&(r.innerHTML=d),i=c(p),g(y.$$.fragment,p),G=c(p),j=b(p,"DIV",{class:!0,"data-svelte-h":!0}),Z(j)!=="svelte-1ebso2i"&&(j.innerHTML=I),this.h()},h(){O(j,"class","flex flex-row gap-4")},m(p,T){f(t,p,T),a(p,m,T),f(n,p,T),a(p,M,T),a(p,r,T),a(p,i,T),f(y,p,T),a(p,G,T),a(p,j,T),C=!0},p(p,T){const _={};T&2&&(_.$$scope={dirty:T,ctx:p}),n.$set(_)},i(p){C||(U(t.$$.fragment,p),U(n.$$.fragment,p),U(y.$$.fragment,p),C=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),h(y.$$.fragment,p),C=!1},d(p){p&&(s(m),s(M),s(r),s(i),s(G),s(j)),w(t,p),w(n,p),w(y,p)}}}function Pe(W){let t,m="Similary, you can use PAG with image-to-image pipelines.",n,M,r;return M=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUwQSUyMCUyMCUyMCUyMGVuYWJsZV9wYWclM0RUcnVlJTJDJTBBJTIwJT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uZXJhdG9yKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForImage2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    enable_pag=<span class="hljs-literal">True</span>,
    pag_applied_layers=[<span class="hljs-string">&quot;mid&quot;</span>],
    torch_dtype=torch.float16
)
pipeline.enable_model_cpu_offload()

pag_scales =  <span class="hljs-number">4.0</span>
guidance_scales = <span class="hljs-number">7.0</span>

url = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png&quot;</span>
init_image = load_image(url)
prompt = <span class="hljs-string">&quot;a dog catching a frisbee in the jungle&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
image = pipeline(
    prompt, 
    image=init_image, 
    strength=<span class="hljs-number">0.8</span>, 
    guidance_scale=guidance_scale, 
    pag_scale=pag_scale,
    generator=generator).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){t=J("p"),t.textContent=m,n=o(),u(M.$$.fragment)},l(d){t=b(d,"P",{"data-svelte-h":!0}),Z(t)!=="svelte-1gp5pv2"&&(t.textContent=m),n=c(d),g(M.$$.fragment,d)},m(d,i){a(d,t,i),a(d,n,i),f(M,d,i),r=!0},p:je,i(d){r||(U(M.$$.fragment,d),r=!0)},o(d){h(M.$$.fragment,d),r=!1},d(d){d&&(s(t),s(n)),w(M,d)}}}function De(W){let t,m;return t=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmclMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9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JlbmNoJTIyJTBBJTBBcGFnX3NjYWxlcyUyMCUzRCUyMCUyMDMuMCUwQWd1aWRhbmNlX3NjYWxlcyUyMCUzRCUyMDcuNSUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjcHUlMjIpLm1hbnVhbF9zZWVkKDEpJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTBBJTIwJTIwJTIwJTIwbWFza19pbWFnZSUzRG1hc2tfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBzdHJlbmd0aCUzRDAuOCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEElMjAlMjAlMjAlMjBwYWdfc2NhbGUlM0RwYWdfc2NhbGUlMkMlMEEpLmltYWdlcyUwQWltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForInpainting.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    enable_pag=<span class="hljs-literal">True</span>,
    torch_dtype=torch.float16
)
pipeline.enable_model_cpu_offload()

img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>
init_image = load_image(img_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
mask_image = load_image(mask_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)

prompt = <span class="hljs-string">&quot;A majestic tiger sitting on a bench&quot;</span>

pag_scales =  <span class="hljs-number">3.0</span>
guidance_scales = <span class="hljs-number">7.5</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">1</span>)
images = pipeline(
    prompt=prompt,
    image=init_image,
    mask_image=mask_image,
    strength=<span class="hljs-number">0.8</span>,
    num_inference_steps=<span class="hljs-number">50</span>,
    guidance_scale=guidance_scale,
    generator=generator,
    pag_scale=pag_scale,
).images
images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,M){f(t,n,M),m=!0},p:je,i(n){m||(U(t.$$.fragment,n),m=!0)},o(n){h(t.$$.fragment,n),m=!1},d(n){w(t,n)}}}function Ke(W){let t,m,n,M,r,d;return t=new Te({props:{id:"tasks",option:"Text-to-image",$$slots:{default:[Le]},$$scope:{ctx:W}}}),n=new Te({props:{id:"tasks",option:"Image-to-image",$$slots:{default:[Pe]},$$scope:{ctx:W}}}),r=new Te({props:{id:"tasks",option:"Inpainting",$$slots:{default:[De]},$$scope:{ctx:W}}}),{c(){u(t.$$.fragment),m=o(),u(n.$$.fragment),M=o(),u(r.$$.fragment)},l(i){g(t.$$.fragment,i),m=c(i),g(n.$$.fragment,i),M=c(i),g(r.$$.fragment,i)},m(i,y){f(t,i,y),a(i,m,y),f(n,i,y),a(i,M,y),f(r,i,y),d=!0},p(i,y){const G={};y&2&&(G.$$scope={dirty:y,ctx:i}),t.$set(G);const j={};y&2&&(j.$$scope={dirty:y,ctx:i}),n.$set(j);const I={};y&2&&(I.$$scope={dirty:y,ctx:i}),r.$set(I)},i(i){d||(U(t.$$.fragment,i),U(n.$$.fragment,i),U(r.$$.fragment,i),d=!0)},o(i){h(t.$$.fragment,i),h(n.$$.fragment,i),h(r.$$.fragment,i),d=!1},d(i){i&&(s(m),s(M)),w(t,i),w(n,i),w(r,i)}}}function Oe(W){let t,m,n,M,r,d,i,y='<a href="https://ku-cvlab.github.io/Perturbed-Attention-Guidance/" rel="nofollow">Perturbed-Attention Guidance (PAG)</a> is a new diffusion sampling guidance that improves sample quality across both unconditional and conditional settings, achieving this without requiring further training or the integration of external modules. PAG is designed to progressively enhance the structure of synthesized samples throughout the denoising process by considering the self-attention mechanisms’ ability to capture structural information. It involves generating intermediate samples with degraded structure by substituting selected self-attention maps in diffusion U-Net with an identity matrix, and guiding the denoising process away from these degraded samples.',G,j,I="This guide will show you how to use PAG for various tasks and use cases.",C,p,T,_,Ze='You can apply PAG to the <a href="/docs/diffusers/pr_7944/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline">StableDiffusionXLPipeline</a> for tasks such as text-to-image, image-to-image, and inpainting. To enable PAG for a specific task, load the pipeline using the <a href="../api/pipelines/auto_pipeline">AutoPipeline</a> API with the <code>enable_pag=True</code> flag and the <code>pag_applied_layers</code> argument.',le,B,te,$,se,k,ae,x,We="To use PAG with ControlNet, first create a <code>controlnet</code>. Then, pass the <code>controlnet</code> and other PAG arguments to the <code>from_pretrained</code> method of the AutoPipeline for the specified task.",ne,X,ie,F,Ge="You can use the pipeline in the same way you normally use ControlNet pipelines, with the added option to specify a <code>pag_scale</code> parameter. Note that PAG works well for unconditional generation. In this example, we will generate an image without a prompt.",pe,V,oe,A,_e='<div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_0.0_controlnet.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generated image without PAG</figcaption></div> <div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_3.0_controlnet.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generated image with PAG</figcaption></div>',ce,Q,re,E,Ce='<a href="https://hf.co/papers/2308.06721" rel="nofollow">IP-Adapter</a> is a popular model that can be plugged into diffusion models to enable image prompting without any changes to the underlying model. You can enable PAG on a pipeline with IP-Adapter loaded.',me,N,Me,S,Ie="PAG reduces artifacts and improves the overall compposition.",de,v,Be='<div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_0.0_ipa_0.8.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generated image without PAG</figcaption></div> <div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_5.0_ipa_0.8.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">generated image with PAG</figcaption></div>',ye,H,ue,z,ge,q,$e="The <code>pag_applied_layers</code> argument allows you to specify which layers PAG is applied to. By default, it applies only to the mid blocks. Changing this setting will significantly impact the output. You can use the <code>set_pag_applied_layers</code> method to adjust the PAG layers after the pipeline is created, helping you find the optimal layers for your model.",fe,L,Ae="As an example, here is the images generated with <code>pag_layers = [&quot;down.block_2&quot;]</code> and <code>pag_layers = [&quot;down.block_2&quot;, &quot;up.block_1.attentions_0&quot;]</code>",Ue,P,he,Y,ve='<div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_3.0_cfg_7.0_down2_up1a0.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">down.block_2 + up.block1.attentions_0</figcaption></div> <div class="flex-1"><img class="rounded-xl" src="https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_3.0_cfg_7.0_down2.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">down.block_2</figcaption></div>',we,D,Je,ee,be;return r=new K({props:{title:"Perturbed-Attention Guidance",local:"perturbed-attention-guidance",headingTag:"h1"}}),p=new K({props:{title:"General tasks",local:"general-tasks",headingTag:"h2"}}),B=new xe({props:{warning:!1,$$slots:{default:[ze]},$$scope:{ctx:W}}}),$=new He({props:{id:"tasks",options:["Text-to-image","Image-to-image","Inpainting"],$$slots:{default:[Ke]},$$scope:{ctx:W}}}),k=new K({props:{title:"PAG with ControlNet",local:"pag-with-controlnet",headingTag:"h2"}}),X=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMkMlMjBDb250cm9sTmV0TW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWNvbnRyb2xuZXQlMjAlM0QlMjBDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmRpZmZ1c2VycyUyRmNvbnRyb2xuZXQtY2Fubnktc2R4bC0xLjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMEElMjAlMjAlMjAlMjBjb250cm9sbmV0JTNEY29udHJvbG5ldCUyQyUwQSUyMCUyMCUyMCUyMGVuYWJsZV9wYWclM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcGFnX2FwcGxpZWRfbGF5ZXJzJTNEJTIybWlkJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGVsaW5lLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image, ControlNetModel
<span class="hljs-keyword">import</span> torch

controlnet = ControlNetModel.from_pretrained(
    <span class="hljs-string">&quot;diffusers/controlnet-canny-sdxl-1.0&quot;</span>, torch_dtype=torch.float16
)

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    controlnet=controlnet,
    enable_pag=<span class="hljs-literal">True</span>,
    pag_applied_layers=<span class="hljs-string">&quot;mid&quot;</span>,
    torch_dtype=torch.float16
)
pipeline.enable_model_cpu_offload()`,wrap:!1}}),V=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFjYW5ueV9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGWWlZaVh1JTJGdGVzdGluZy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnBhZ19jb250cm9sX2lucHV0LnBuZyUyMiUwQSklMEElMEFmb3IlMjBwYWdfc2NhbGUlMjBpbiUyMCU1QjAuMCUyQyUyMDMuMCU1RCUzQSUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjcHUlMjIpLm1hbnVhbF9zZWVkKDEpJTBBJTIwJTIwJTIwJTIwaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwY29udHJvbG5ldF9jb25kaXRpb25pbmdfc2NhbGUlM0Rjb250cm9sbmV0X2NvbmRpdGlvbmluZ19zY2FsZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGltYWdlJTNEY2FubnlfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDAlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwYWdfc2NhbGUlM0RwYWdfc2NhbGUlMkMlMEElMjAlMjAlMjAlMjApLmltYWdlcyUwQSUyMCUyMCUyMCUyMGltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
canny_image = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/YiYiXu/testing-images/resolve/main/pag_control_input.png&quot;</span>
)

<span class="hljs-keyword">for</span> pag_scale <span class="hljs-keyword">in</span> [<span class="hljs-number">0.0</span>, <span class="hljs-number">3.0</span>]:
    generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">1</span>)
    images = pipeline(
        prompt=<span class="hljs-string">&quot;&quot;</span>,
        controlnet_conditioning_scale=controlnet_conditioning_scale,
        image=canny_image,
        num_inference_steps=<span class="hljs-number">50</span>,
        guidance_scale=<span class="hljs-number">0</span>,
        generator=generator,
        pag_scale=pag_scale,
    ).images
    images[<span class="hljs-number">0</span>]`,wrap:!1}}),Q=new K({props:{title:"PAG with IP-Adapter",local:"pag-with-ip-adapter",headingTag:"h2"}}),N=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBDTElQVmlzaW9uTW9kZWxXaXRoUHJvamVjdGlv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kZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZkaWZmdXNlcnMlMkZpcF9hZGFwdGVyX2RpbmVyLnBuZyUyMiklMEElMEFwaXBlbGluZS5zZXRfaXBfYWRhcHRlcl9zY2FsZShpcF9hZGFwdGVyX3NjYWxlKSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjcHUlMjIpLm1hbnVhbF9zZWVkKDApJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyYSUyMHBvbGFyJTIwYmVhciUyMHNpdHRpbmclMjBpbiUyMGElMjBjaGFpciUyMGRyaW5raW5nJTIwYSUyMG1pbGtzaGFrZSUyMiUyQyUwQSUyMCUyMCUyMCUyMGlwX2FkYXB0ZXJfaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRCUyMmRlZm9ybWVkJTJDJTIwdWdseSUyQyUyMHdyb25nJTIwcHJvcG9ydGlvbiUyQyUyMGxvdyUyMHJlcyUyQyUyMGJhZCUyMGFuYXRvbXklMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI1JTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0QzLjAlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEElMjAlMjAlMjAlMjBwYWdfc2NhbGUlM0RwYWdfc2NhbGUlMkMlMEEpLmltYWdlcyUwQWltYWdlcyU1QjAlNUQlMEE=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModelWithProjection
<span class="hljs-keyword">import</span> torch

image_encoder = CLIPVisionModelWithProjection.from_pretrained(
    <span class="hljs-string">&quot;h94/IP-Adapter&quot;</span>,
    subfolder=<span class="hljs-string">&quot;models/image_encoder&quot;</span>,
    torch_dtype=torch.float16
)

pipeline = AutoPipelineForText2Image.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    image_encoder=image_encoder,
    enable_pag=<span class="hljs-literal">True</span>,
    torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline.load_ip_adapter(<span class="hljs-string">&quot;h94/IP-Adapter&quot;</span>, subfolder=<span class="hljs-string">&quot;sdxl_models&quot;</span>, weight_name=<span class="hljs-string">&quot;ip-adapter-plus_sdxl_vit-h.bin&quot;</span>)

pag_scales = <span class="hljs-number">5.0</span>
ip_adapter_scales = <span class="hljs-number">0.8</span>

image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/ip_adapter_diner.png&quot;</span>)

pipeline.set_ip_adapter_scale(ip_adapter_scale)
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
images = pipeline(
    prompt=<span class="hljs-string">&quot;a polar bear sitting in a chair drinking a milkshake&quot;</span>,
    ip_adapter_image=image,
    negative_prompt=<span class="hljs-string">&quot;deformed, ugly, wrong proportion, low res, bad anatomy, worst quality, low quality&quot;</span>,
    num_inference_steps=<span class="hljs-number">25</span>,
    guidance_scale=<span class="hljs-number">3.0</span>,
    generator=generator,
    pag_scale=pag_scale,
).images
images[<span class="hljs-number">0</span>]
`,wrap:!1}}),H=new K({props:{title:"Configure parameters",local:"configure-parameters",headingTag:"h2"}}),z=new K({props:{title:"pag_applied_layers",local:"pagappliedlayers",headingTag:"h3"}}),P=new R({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYW4lMjBpbnNlY3QlMjByb2JvdCUyMHByZXBhcmluZyUyMGElMjBkZWxpY2lvdXMlMjBtZWFsJTJDJTIwYW5pbWUlMjBzdHlsZSUyMiUwQXBpcGVsaW5lLnNldF9wYWdfYXBwbGllZF9sYXllcnMocGFnX2xheWVycyklMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5HZW5lcmF0b3IoZGV2aWNlJTNEJTIyY3B1JTIyKS5tYW51YWxfc2VlZCgwKSUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyNSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMEElMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEElMjAlMjAlMjAlMjBwYWdfc2NhbGUlM0RwYWdfc2NhbGUlMkMlMEEpLmltYWdlcyUwQWltYWdlcyU1QjAlNUQ=",highlighted:`prompt = <span class="hljs-string">&quot;an insect robot preparing a delicious meal, anime style&quot;</span>
pipeline.set_pag_applied_layers(pag_layers)
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
images = pipeline(
    prompt=prompt,
    num_inference_steps=<span class="hljs-number">25</span>,
    guidance_scale=guidance_scale,
    generator=generator,
    pag_scale=pag_scale,
).images
images[<span class="hljs-number">0</span>]`,wrap:!1}}),D=new Se({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/pag.md"}}),{c(){t=J("meta"),m=o(),n=J("p"),M=o(),u(r.$$.fragment),d=o(),i=J("p"),i.innerHTML=y,G=o(),j=J("p"),j.textContent=I,C=o(),u(p.$$.fragment),T=o(),_=J("p"),_.innerHTML=Ze,le=o(),u(B.$$.fragment),te=o(),u($.$$.fragment),se=o(),u(k.$$.fragment),ae=o(),x=J("p"),x.innerHTML=We,ne=o(),u(X.$$.fragment),ie=o(),F=J("p"),F.innerHTML=Ge,pe=o(),u(V.$$.fragment),oe=o(),A=J("div"),A.innerHTML=_e,ce=o(),u(Q.$$.fragment),re=o(),E=J("p"),E.innerHTML=Ce,me=o(),u(N.$$.fragment),Me=o(),S=J("p"),S.textContent=Ie,de=o(),v=J("div"),v.innerHTML=Be,ye=o(),u(H.$$.fragment),ue=o(),u(z.$$.fragment),ge=o(),q=J("p"),q.innerHTML=$e,fe=o(),L=J("p"),L.innerHTML=Ae,Ue=o(),u(P.$$.fragment),he=o(),Y=J("div"),Y.innerHTML=ve,we=o(),u(D.$$.fragment),Je=o(),ee=J("p"),this.h()},l(e){const l=Ee("svelte-u9bgzb",document.head);t=b(l,"META",{name:!0,content:!0}),l.forEach(s),m=c(e),n=b(e,"P",{}),ke(n).forEach(s),M=c(e),g(r.$$.fragment,e),d=c(e),i=b(e,"P",{"data-svelte-h":!0}),Z(i)!=="svelte-1w1c4u2"&&(i.innerHTML=y),G=c(e),j=b(e,"P",{"data-svelte-h":!0}),Z(j)!=="svelte-11cdpcr"&&(j.textContent=I),C=c(e),g(p.$$.fragment,e),T=c(e),_=b(e,"P",{"data-svelte-h":!0}),Z(_)!=="svelte-17q9lrd"&&(_.innerHTML=Ze),le=c(e),g(B.$$.fragment,e),te=c(e),g($.$$.fragment,e),se=c(e),g(k.$$.fragment,e),ae=c(e),x=b(e,"P",{"data-svelte-h":!0}),Z(x)!=="svelte-4m1dma"&&(x.innerHTML=We),ne=c(e),g(X.$$.fragment,e),ie=c(e),F=b(e,"P",{"data-svelte-h":!0}),Z(F)!=="svelte-112ukzn"&&(F.innerHTML=Ge),pe=c(e),g(V.$$.fragment,e),oe=c(e),A=b(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(A)!=="svelte-e2cxkg"&&(A.innerHTML=_e),ce=c(e),g(Q.$$.fragment,e),re=c(e),E=b(e,"P",{"data-svelte-h":!0}),Z(E)!=="svelte-rjcwxp"&&(E.innerHTML=Ce),me=c(e),g(N.$$.fragment,e),Me=c(e),S=b(e,"P",{"data-svelte-h":!0}),Z(S)!=="svelte-1n1gw76"&&(S.textContent=Ie),de=c(e),v=b(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(v)!=="svelte-j0lguw"&&(v.innerHTML=Be),ye=c(e),g(H.$$.fragment,e),ue=c(e),g(z.$$.fragment,e),ge=c(e),q=b(e,"P",{"data-svelte-h":!0}),Z(q)!=="svelte-1th38n0"&&(q.innerHTML=$e),fe=c(e),L=b(e,"P",{"data-svelte-h":!0}),Z(L)!=="svelte-1d06cik"&&(L.innerHTML=Ae),Ue=c(e),g(P.$$.fragment,e),he=c(e),Y=b(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(Y)!=="svelte-1srsjub"&&(Y.innerHTML=ve),we=c(e),g(D.$$.fragment,e),Je=c(e),ee=b(e,"P",{}),ke(ee).forEach(s),this.h()},h(){O(t,"name","hf:doc:metadata"),O(t,"content",el),O(A,"class","flex flex-row gap-4"),O(v,"class","flex flex-row gap-4"),O(Y,"class","flex flex-row gap-4")},m(e,l){Ne(document.head,t),a(e,m,l),a(e,n,l),a(e,M,l),f(r,e,l),a(e,d,l),a(e,i,l),a(e,G,l),a(e,j,l),a(e,C,l),f(p,e,l),a(e,T,l),a(e,_,l),a(e,le,l),f(B,e,l),a(e,te,l),f($,e,l),a(e,se,l),f(k,e,l),a(e,ae,l),a(e,x,l),a(e,ne,l),f(X,e,l),a(e,ie,l),a(e,F,l),a(e,pe,l),f(V,e,l),a(e,oe,l),a(e,A,l),a(e,ce,l),f(Q,e,l),a(e,re,l),a(e,E,l),a(e,me,l),f(N,e,l),a(e,Me,l),a(e,S,l),a(e,de,l),a(e,v,l),a(e,ye,l),f(H,e,l),a(e,ue,l),f(z,e,l),a(e,ge,l),a(e,q,l),a(e,fe,l),a(e,L,l),a(e,Ue,l),f(P,e,l),a(e,he,l),a(e,Y,l),a(e,we,l),f(D,e,l),a(e,Je,l),a(e,ee,l),be=!0},p(e,[l]){const Ye={};l&2&&(Ye.$$scope={dirty:l,ctx:e}),B.$set(Ye);const Re={};l&2&&(Re.$$scope={dirty:l,ctx:e}),$.$set(Re)},i(e){be||(U(r.$$.fragment,e),U(p.$$.fragment,e),U(B.$$.fragment,e),U($.$$.fragment,e),U(k.$$.fragment,e),U(X.$$.fragment,e),U(V.$$.fragment,e),U(Q.$$.fragment,e),U(N.$$.fragment,e),U(H.$$.fragment,e),U(z.$$.fragment,e),U(P.$$.fragment,e),U(D.$$.fragment,e),be=!0)},o(e){h(r.$$.fragment,e),h(p.$$.fragment,e),h(B.$$.fragment,e),h($.$$.fragment,e),h(k.$$.fragment,e),h(X.$$.fragment,e),h(V.$$.fragment,e),h(Q.$$.fragment,e),h(N.$$.fragment,e),h(H.$$.fragment,e),h(z.$$.fragment,e),h(P.$$.fragment,e),h(D.$$.fragment,e),be=!1},d(e){e&&(s(m),s(n),s(M),s(d),s(i),s(G),s(j),s(C),s(T),s(_),s(le),s(te),s(se),s(ae),s(x),s(ne),s(ie),s(F),s(pe),s(oe),s(A),s(ce),s(re),s(E),s(me),s(Me),s(S),s(de),s(v),s(ye),s(ue),s(ge),s(q),s(fe),s(L),s(Ue),s(he),s(Y),s(we),s(Je),s(ee)),s(t),w(r,e),w(p,e),w(B,e),w($,e),w(k,e),w(X,e),w(V,e),w(Q,e),w(N,e),w(H,e),w(z,e),w(P,e),w(D,e)}}}const el='{"title":"Perturbed-Attention Guidance","local":"perturbed-attention-guidance","sections":[{"title":"General tasks","local":"general-tasks","sections":[],"depth":2},{"title":"PAG with ControlNet","local":"pag-with-controlnet","sections":[],"depth":2},{"title":"PAG with IP-Adapter","local":"pag-with-ip-adapter","sections":[],"depth":2},{"title":"Configure parameters","local":"configure-parameters","sections":[{"title":"pag_applied_layers","local":"pagappliedlayers","sections":[],"depth":3}],"depth":2}],"depth":1}';function ll(W){return Fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ol extends Ve{constructor(t){super(),Qe(this,t,ll,Oe,Xe,{})}}export{ol as component};
