import{s as Qs,o as Fs,n as es}from"../chunks/scheduler.8c3d61f6.js";import{S as Es,i as qs,g as J,s as c,r as m,A as Hs,h as $,f as p,c as o,j as vs,u as M,x as U,k as Ns,y as zs,a as i,v as h,d as j,t as y,w as g}from"../chunks/index.da70eac4.js";import{T as Ys}from"../chunks/Tip.1d9b8c37.js";import{C as w}from"../chunks/CodeBlock.a9c4becf.js";import{H as ss,E as Ls}from"../chunks/getInferenceSnippets.28ca3596.js";import{H as As,a as Us}from"../chunks/HfOption.6c3b4e77.js";function Ss(Z){let e,d="Changing guiders will return text letting you know you’re changing the guider type.",t,u,n;return u=new w({props:{code:"TW9kdWxhclBpcGVsaW5lLnVwZGF0ZV9jb21wb25lbnRzJTNBJTIwYWRkaW5nJTIwZ3VpZGVyJTIwd2l0aCUyMG5ldyUyMHR5cGUlM0ElMjBQZXJ0dXJiZWRBdHRlbnRpb25HdWlkYW5jZSUyQyUyMHByZXZpb3VzJTIwdHlwZSUzQSUyMENsYXNzaWZpZXJGcmVlR3VpZGFuY2U=",highlighted:'ModularPipeline.update_components: adding guider with new <span class="hljs-built_in">type</span>: PerturbedAttentionGuidance, previous <span class="hljs-built_in">type</span>: ClassifierFreeGuidance',wrap:!1}}),{c(){e=J("p"),e.textContent=d,t=c(),m(u.$$.fragment)},l(l){e=$(l,"P",{"data-svelte-h":!0}),U(e)!=="svelte-hc9w95"&&(e.textContent=d),t=o(l),M(u.$$.fragment,l)},m(l,f){i(l,e,f),i(l,t,f),h(u,l,f),n=!0},p:es,i(l){n||(j(u.$$.fragment,l),n=!0)},o(l){y(u.$$.fragment,l),n=!1},d(l){l&&(p(e),p(t)),g(u,l)}}}function Ps(Z){let e,d;return e=new w({props:{code:"Z3VpZGVyX3NwZWMlMjAlM0QlMjB0MmlfcGlwZWxpbmUuZ2V0X2NvbXBvbmVudF9zcGVjKCUyMmd1aWRlciUyMiklMEFndWlkZXIlMjAlM0QlMjBndWlkZXJfc3BlYy5jcmVhdGUoZ3VpZGFuY2Vfc2NhbGUlM0QxMCklMEF0MmlfcGlwZWxpbmUudXBkYXRlX2NvbXBvbmVudHMoZ3VpZGVyJTNEZ3VpZGVyKQ==",highlighted:`guider_spec = t2i_pipeline.get_component_spec(<span class="hljs-string">&quot;guider&quot;</span>)
guider = guider_spec.create(guidance_scale=<span class="hljs-number">10</span>)
t2i_pipeline.update_components(guider=guider)`,wrap:!1}}),{c(){m(e.$$.fragment)},l(t){M(e.$$.fragment,t)},m(t,u){h(e,t,u),d=!0},p:es,i(t){d||(j(e.$$.fragment,t),d=!0)},o(t){y(e.$$.fragment,t),d=!1},d(t){g(e,t)}}}function Ds(Z){let e,d;return e=new w({props:{code:"Z3VpZGVyX3NwZWMlMjAlM0QlMjB0MmlfcGlwZWxpbmUuZ2V0X2NvbXBvbmVudF9zcGVjKCUyMmd1aWRlciUyMiklMEFndWlkZXJfc3BlYy5jb25maWclNUIlMjJndWlkYW5jZV9zY2FsZSUyMiU1RCUyMCUzRCUyMDEwJTBBdDJpX3BpcGVsaW5lLnVwZGF0ZV9jb21wb25lbnRzKGd1aWRlciUzRGd1aWRlcl9zcGVjKQ==",highlighted:`guider_spec = t2i_pipeline.get_component_spec(<span class="hljs-string">&quot;guider&quot;</span>)
guider_spec.config[<span class="hljs-string">&quot;guidance_scale&quot;</span>] = <span class="hljs-number">10</span>
t2i_pipeline.update_components(guider=guider_spec)`,wrap:!1}}),{c(){m(e.$$.fragment)},l(t){M(e.$$.fragment,t)},m(t,u){h(e,t,u),d=!0},p:es,i(t){d||(j(e.$$.fragment,t),d=!0)},o(t){y(e.$$.fragment,t),d=!1},d(t){g(e,t)}}}function Ks(Z){let e,d,t,u;return e=new Us({props:{id:"switch",option:"create",$$slots:{default:[Ps]},$$scope:{ctx:Z}}}),t=new Us({props:{id:"switch",option:"update_components",$$slots:{default:[Ds]},$$scope:{ctx:Z}}}),{c(){m(e.$$.fragment),d=c(),m(t.$$.fragment)},l(n){M(e.$$.fragment,n),d=o(n),M(t.$$.fragment,n)},m(n,l){h(e,n,l),i(n,d,l),h(t,n,l),u=!0},p(n,l){const f={};l&2&&(f.$$scope={dirty:l,ctx:n}),e.$set(f);const b={};l&2&&(b.$$scope={dirty:l,ctx:n}),t.$set(b)},i(n){u||(j(e.$$.fragment,n),j(t.$$.fragment,n),u=!0)},o(n){y(e.$$.fragment,n),y(t.$$.fragment,n),u=!1},d(n){n&&p(d),g(e,n),g(t,n)}}}function Os(Z){let e,d="Edit the <code>modular_model_index.json</code> file and add a loading specification for the guider by pointing to a folder containing the guider config.",t,u,n;return u=new w({props:{code:"JTdCJTBBJTIwJTIwJTIyZ3VpZGVyJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIyZGlmZnVzZXJzJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyUGVydHVyYmVkQXR0ZW50aW9uR3VpZGFuY2UlMjIlMkMlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXBvJTIyJTNBJTIwJTIyWWlZaVh1JTJGbW9kdWxhci1sb2FkZXItdDJpLWd1aWRlciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnJldmlzaW9uJTIyJTNBJTIwbnVsbCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnN1YmZvbGRlciUyMiUzQSUyMCUyMnBhZ19ndWlkZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjJ0eXBlX2hpbnQlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkaWZmdXNlcnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJQZXJ0dXJiZWRBdHRlbnRpb25HdWlkYW5jZSUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnZhcmlhbnQlMjIlM0ElMjBudWxsJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTVEJTJD",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;guider&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;PerturbedAttentionGuidance&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-punctuation">{</span>
      <span class="hljs-attr">&quot;repo&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;YiYiXu/modular-loader-t2i-guider&quot;</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;revision&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">null</span></span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;subfolder&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;pag_guider&quot;</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;type_hint&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
        <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
        <span class="hljs-string">&quot;PerturbedAttentionGuidance&quot;</span>
      <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;variant&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">null</span></span>
    <span class="hljs-punctuation">}</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>`,wrap:!1}}),{c(){e=J("p"),e.innerHTML=d,t=c(),m(u.$$.fragment)},l(l){e=$(l,"P",{"data-svelte-h":!0}),U(e)!=="svelte-1ouml9j"&&(e.innerHTML=d),t=o(l),M(u.$$.fragment,l)},m(l,f){i(l,e,f),i(l,t,f),h(u,l,f),n=!0},p:es,i(l){n||(j(u.$$.fragment,l),n=!0)},o(l){y(u.$$.fragment,l),n=!1},d(l){l&&(p(e),p(t)),g(u,l)}}}function se(Z){let e,d="Changing the creation method will return text letting you know you’re changing the creation type to <code>from_pretrained</code>.",t,u,n;return u=new w({props:{code:"TW9kdWxhclBpcGVsaW5lLnVwZGF0ZV9jb21wb25lbnRzJTNBJTIwY2hhbmdpbmclMjB0aGUlMjBkZWZhdWx0X2NyZWF0aW9uX21ldGhvZCUyMG9mJTIwZ3VpZGVyJTIwZnJvbSUyMGZyb21fY29uZmlnJTIwdG8lMjBmcm9tX3ByZXRyYWluZWQu",highlighted:"ModularPipeline.update_components: changing the default_creation_method of guider from from_config to from_pretrained.",wrap:!1}}),{c(){e=J("p"),e.innerHTML=d,t=c(),m(u.$$.fragment)},l(l){e=$(l,"P",{"data-svelte-h":!0}),U(e)!=="svelte-m9mcnd"&&(e.innerHTML=d),t=o(l),M(u.$$.fragment,l)},m(l,f){i(l,e,f),i(l,t,f),h(u,l,f),n=!0},p:es,i(l){n||(j(u.$$.fragment,l),n=!0)},o(l){y(u.$$.fragment,l),n=!1},d(l){l&&(p(e),p(t)),g(u,l)}}}function ee(Z){let e,d='Change the <code>default_creation_method()</code> to <code>from_pretrained</code> and use <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.update_components">update_components()</a> to update the guider and component specifications as well as the pipeline config.',t,u,n,l,f,b,x='To make it the default guider for a pipeline, call <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a>. This is an optional step and not necessary if you are only experimenting locally.',T,W,V;return u=new Ys({props:{warning:!1,$$slots:{default:[se]},$$scope:{ctx:Z}}}),l=new w({props:{code:"Z3VpZGVyX3NwZWMlMjAlM0QlMjB0MmlfcGlwZWxpbmUuZ2V0X2NvbXBvbmVudF9zcGVjKCUyMmd1aWRlciUyMiklMEFndWlkZXJfc3BlYy5kZWZhdWx0X2NyZWF0aW9uX21ldGhvZCUzRCUyMmZyb21fcHJldHJhaW5lZCUyMiUwQWd1aWRlcl9zcGVjLnJlcG8lM0QlMjJZaVlpWHUlMkZtb2R1bGFyLWxvYWRlci10MmktZ3VpZGVyJTIyJTBBZ3VpZGVyX3NwZWMuc3ViZm9sZGVyJTNEJTIycGFnX2d1aWRlciUyMiUwQXBhZ19ndWlkZXIlMjAlM0QlMjBndWlkZXJfc3BlYy5sb2FkKCklMEF0MmlfcGlwZWxpbmUudXBkYXRlX2NvbXBvbmVudHMoZ3VpZGVyJTNEcGFnX2d1aWRlcik=",highlighted:`guider_spec = t2i_pipeline.get_component_spec(<span class="hljs-string">&quot;guider&quot;</span>)
guider_spec.default_creation_method=<span class="hljs-string">&quot;from_pretrained&quot;</span>
guider_spec.repo=<span class="hljs-string">&quot;YiYiXu/modular-loader-t2i-guider&quot;</span>
guider_spec.subfolder=<span class="hljs-string">&quot;pag_guider&quot;</span>
pag_guider = guider_spec.load()
t2i_pipeline.update_components(guider=pag_guider)`,wrap:!1}}),W=new w({props:{code:"dDJpX3BpcGVsaW5lLnB1c2hfdG9faHViKCUyMllpWWlYdSUyRm1vZHVsYXItZG9jLWd1aWRlciUyMik=",highlighted:'t2i_pipeline.push_to_hub(<span class="hljs-string">&quot;YiYiXu/modular-doc-guider&quot;</span>)',wrap:!1}}),{c(){e=J("p"),e.innerHTML=d,t=c(),m(u.$$.fragment),n=c(),m(l.$$.fragment),f=c(),b=J("p"),b.innerHTML=x,T=c(),m(W.$$.fragment)},l(r){e=$(r,"P",{"data-svelte-h":!0}),U(e)!=="svelte-e2g9i8"&&(e.innerHTML=d),t=o(r),M(u.$$.fragment,r),n=o(r),M(l.$$.fragment,r),f=o(r),b=$(r,"P",{"data-svelte-h":!0}),U(b)!=="svelte-15ac2ub"&&(b.innerHTML=x),T=o(r),M(W.$$.fragment,r)},m(r,_){i(r,e,_),i(r,t,_),h(u,r,_),i(r,n,_),h(l,r,_),i(r,f,_),i(r,b,_),i(r,T,_),h(W,r,_),V=!0},p(r,_){const C={};_&2&&(C.$$scope={dirty:_,ctx:r}),u.$set(C)},i(r){V||(j(u.$$.fragment,r),j(l.$$.fragment,r),j(W.$$.fragment,r),V=!0)},o(r){y(u.$$.fragment,r),y(l.$$.fragment,r),y(W.$$.fragment,r),V=!1},d(r){r&&(p(e),p(t),p(n),p(f),p(b),p(T)),g(u,r),g(l,r),g(W,r)}}}function le(Z){let e,d,t,u;return e=new Us({props:{id:"upload",option:"modular_model_index.json",$$slots:{default:[Os]},$$scope:{ctx:Z}}}),t=new Us({props:{id:"upload",option:"update_components",$$slots:{default:[ee]},$$scope:{ctx:Z}}}),{c(){m(e.$$.fragment),d=c(),m(t.$$.fragment)},l(n){M(e.$$.fragment,n),d=o(n),M(t.$$.fragment,n)},m(n,l){h(e,n,l),i(n,d,l),h(t,n,l),u=!0},p(n,l){const f={};l&2&&(f.$$scope={dirty:l,ctx:n}),e.$set(f);const b={};l&2&&(b.$$scope={dirty:l,ctx:n}),t.$set(b)},i(n){u||(j(e.$$.fragment,n),j(t.$$.fragment,n),u=!0)},o(n){y(e.$$.fragment,n),y(t.$$.fragment,n),u=!1},d(n){n&&p(d),g(e,n),g(t,n)}}}function ne(Z){let e,d,t,u,n,l,f,b='<a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-free guidance</a> steers model generation that better match a prompt and is commonly used to improve generation quality, control, and adherence to prompts. There are different types of guidance methods, and in Diffusers, they are known as <em>guiders</em>. Like blocks, it is easy to switch and use different guiders for different use cases without rewriting the pipeline.',x,T,W="This guide will show you how to switch guiders, adjust guider parameters, and load and share them to the Hub.",V,r,_,C,ws='<a href="/docs/diffusers/main/en/api/modular_diffusers/guiders#diffusers.ClassifierFreeGuidance">ClassifierFreeGuidance</a> is the default guider and created when a pipeline is initialized with <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline_blocks#diffusers.ModularPipelineBlocks.init_pipeline">init_pipeline()</a>. It is created by <code>from_config</code> which means it doesn’t require loading specifications from a modular repository. A guider won’t be listed in <code>modular_model_index.json</code>.',ls,I,Ts='Use <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.get_component_spec">get_component_spec()</a> to inspect a guider.',ns,B,as,R,Ws='Switch to a different guider by passing the new guider to <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.update_components">update_components()</a>.',ts,k,ps,v,is,N,Cs='Use <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.get_component_spec">get_component_spec()</a> again to verify the guider type is different.',us,A,rs,Y,cs,Q,Vs="Guiders that are already saved on the Hub with a <code>modular_model_index.json</code> file are considered a <code>from_pretrained</code> component now instead of a <code>from_config</code> component.",os,F,ds,E,ks='The guider is only created after calling <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.load_components">load_components()</a> based on the loading specification in <code>modular_model_index.json</code>.',fs,q,ms,H,Ms,z,Gs='The guider parameters can be adjusted with either the <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline_components#diffusers.ComponentSpec.create">create()</a> method or with <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.update_components">update_components()</a>. The example below changes the <code>guidance_scale</code> value.',hs,G,js,L,ys,S,Xs='Call the <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method on a custom guider to share it to the Hub.',gs,P,Js,D,xs='To make this guider available to the pipeline, either modify the <code>modular_model_index.json</code> file or use the <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.update_components">update_components()</a> method.',$s,X,Zs,K,_s,O,bs;return n=new ss({props:{title:"Guiders",local:"guiders",headingTag:"h1"}}),r=new ss({props:{title:"Switching guiders",local:"switching-guiders",headingTag:"h2"}}),B=new w({props:{code:"dDJpX3BpcGVsaW5lLmdldF9jb21wb25lbnRfc3BlYyglMjJndWlkZXIlMjIpJTBBQ29tcG9uZW50U3BlYyhuYW1lJTNEJ2d1aWRlciclMkMlMjB0eXBlX2hpbnQlM0QlM0NjbGFzcyUyMCdkaWZmdXNlcnMuZ3VpZGVycy5jbGFzc2lmaWVyX2ZyZWVfZ3VpZGFuY2UuQ2xhc3NpZmllckZyZWVHdWlkYW5jZSclM0UlMkMlMjBkZXNjcmlwdGlvbiUzRE5vbmUlMkMlMjBjb25maWclM0RGcm96ZW5EaWN0KCU1QignZ3VpZGFuY2Vfc2NhbGUnJTJDJTIwNy41KSUyQyUyMCgnZ3VpZGFuY2VfcmVzY2FsZSclMkMlMjAwLjApJTJDJTIwKCd1c2Vfb3JpZ2luYWxfZm9ybXVsYXRpb24nJTJDJTIwRmFsc2UpJTJDJTIwKCdzdGFydCclMkMlMjAwLjApJTJDJTIwKCdzdG9wJyUyQyUyMDEuMCklMkMlMjAoJ191c2VfZGVmYXVsdF92YWx1ZXMnJTJDJTIwJTVCJ3N0YXJ0JyUyQyUyMCdndWlkYW5jZV9yZXNjYWxlJyUyQyUyMCdzdG9wJyUyQyUyMCd1c2Vfb3JpZ2luYWxfZm9ybXVsYXRpb24nJTVEKSU1RCklMkMlMjByZXBvJTNETm9uZSUyQyUyMHN1YmZvbGRlciUzRE5vbmUlMkMlMjB2YXJpYW50JTNETm9uZSUyQyUyMHJldmlzaW9uJTNETm9uZSUyQyUyMGRlZmF1bHRfY3JlYXRpb25fbWV0aG9kJTNEJ2Zyb21fY29uZmlnJyk=",highlighted:`t2i_pipeline.get_component_spec(<span class="hljs-string">&quot;guider&quot;</span>)
ComponentSpec(name=<span class="hljs-string">&#x27;guider&#x27;</span>, type_hint=&lt;<span class="hljs-keyword">class</span> <span class="hljs-string">&#x27;diffusers.guiders.classifier_free_guidance.ClassifierFreeGuidance&#x27;</span>&gt;, description=<span class="hljs-literal">None</span>, config=FrozenDict([(<span class="hljs-string">&#x27;guidance_scale&#x27;</span>, <span class="hljs-number">7.5</span>), (<span class="hljs-string">&#x27;guidance_rescale&#x27;</span>, <span class="hljs-number">0.0</span>), (<span class="hljs-string">&#x27;use_original_formulation&#x27;</span>, <span class="hljs-literal">False</span>), (<span class="hljs-string">&#x27;start&#x27;</span>, <span class="hljs-number">0.0</span>), (<span class="hljs-string">&#x27;stop&#x27;</span>, <span class="hljs-number">1.0</span>), (<span class="hljs-string">&#x27;_use_default_values&#x27;</span>, [<span class="hljs-string">&#x27;start&#x27;</span>, <span class="hljs-string">&#x27;guidance_rescale&#x27;</span>, <span class="hljs-string">&#x27;stop&#x27;</span>, <span class="hljs-string">&#x27;use_original_formulation&#x27;</span>])]), repo=<span class="hljs-literal">None</span>, subfolder=<span class="hljs-literal">None</span>, variant=<span class="hljs-literal">None</span>, revision=<span class="hljs-literal">None</span>, default_creation_method=<span class="hljs-string">&#x27;from_config&#x27;</span>)`,wrap:!1}}),k=new Ys({props:{warning:!1,$$slots:{default:[Ss]},$$scope:{ctx:Z}}}),v=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMExheWVyU2tpcENvbmZpZyUyQyUyMFBlcnR1cmJlZEF0dGVudGlvbkd1aWRhbmNlJTBBJTBBY29uZmlnJTIwJTNEJTIwTGF5ZXJTa2lwQ29uZmlnKGluZGljZXMlM0QlNUIyJTJDJTIwOSU1RCUyQyUyMGZxbiUzRCUyMm1pZF9ibG9jay5hdHRlbnRpb25zLjAudHJhbnNmb3JtZXJfYmxvY2tzJTIyJTJDJTIwc2tpcF9hdHRlbnRpb24lM0RGYWxzZSUyQyUyMHNraXBfYXR0ZW50aW9uX3Njb3JlcyUzRFRydWUlMkMlMjBza2lwX2ZmJTNERmFsc2UpJTBBZ3VpZGVyJTIwJTNEJTIwUGVydHVyYmVkQXR0ZW50aW9uR3VpZGFuY2UoJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMjBwZXJ0dXJiZWRfZ3VpZGFuY2Vfc2NhbGUlM0QyLjUlMkMlMjBwZXJ0dXJiZWRfZ3VpZGFuY2VfY29uZmlnJTNEY29uZmlnJTBBKSUwQXQyaV9waXBlbGluZS51cGRhdGVfY29tcG9uZW50cyhndWlkZXIlM0RndWlkZXIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LayerSkipConfig, PerturbedAttentionGuidance

config = LayerSkipConfig(indices=[<span class="hljs-number">2</span>, <span class="hljs-number">9</span>], fqn=<span class="hljs-string">&quot;mid_block.attentions.0.transformer_blocks&quot;</span>, skip_attention=<span class="hljs-literal">False</span>, skip_attention_scores=<span class="hljs-literal">True</span>, skip_ff=<span class="hljs-literal">False</span>)
guider = PerturbedAttentionGuidance(
    guidance_scale=<span class="hljs-number">5.0</span>, perturbed_guidance_scale=<span class="hljs-number">2.5</span>, perturbed_guidance_config=config
)
t2i_pipeline.update_components(guider=guider)`,wrap:!1}}),A=new w({props:{code:"dDJpX3BpcGVsaW5lLmdldF9jb21wb25lbnRfc3BlYyglMjJndWlkZXIlMjIpJTBBQ29tcG9uZW50U3BlYyhuYW1lJTNEJ2d1aWRlciclMkMlMjB0eXBlX2hpbnQlM0QlM0NjbGFzcyUyMCdkaWZmdXNlcnMuZ3VpZGVycy5wZXJ0dXJiZWRfYXR0ZW50aW9uX2d1aWRhbmNlLlBlcnR1cmJlZEF0dGVudGlvbkd1aWRhbmNlJyUzRSUyQyUyMGRlc2NyaXB0aW9uJTNETm9uZSUyQyUyMGNvbmZpZyUzREZyb3plbkRpY3QoJTVCKCdndWlkYW5jZV9zY2FsZSclMkMlMjA1LjApJTJDJTIwKCdwZXJ0dXJiZWRfZ3VpZGFuY2Vfc2NhbGUnJTJDJTIwMi41KSUyQyUyMCgncGVydHVyYmVkX2d1aWRhbmNlX3N0YXJ0JyUyQyUyMDAuMDEpJTJDJTIwKCdwZXJ0dXJiZWRfZ3VpZGFuY2Vfc3RvcCclMkMlMjAwLjIpJTJDJTIwKCdwZXJ0dXJiZWRfZ3VpZGFuY2VfbGF5ZXJzJyUyQyUyME5vbmUpJTJDJTIwKCdwZXJ0dXJiZWRfZ3VpZGFuY2VfY29uZmlnJyUyQyUyMExheWVyU2tpcENvbmZpZyhpbmRpY2VzJTNEJTVCMiUyQyUyMDklNUQlMkMlMjBmcW4lM0QnbWlkX2Jsb2NrLmF0dGVudGlvbnMuMC50cmFuc2Zvcm1lcl9ibG9ja3MnJTJDJTIwc2tpcF9hdHRlbnRpb24lM0RGYWxzZSUyQyUyMHNraXBfYXR0ZW50aW9uX3Njb3JlcyUzRFRydWUlMkMlMjBza2lwX2ZmJTNERmFsc2UlMkMlMjBkcm9wb3V0JTNEMS4wKSklMkMlMjAoJ2d1aWRhbmNlX3Jlc2NhbGUnJTJDJTIwMC4wKSUyQyUyMCgndXNlX29yaWdpbmFsX2Zvcm11bGF0aW9uJyUyQyUyMEZhbHNlKSUyQyUyMCgnc3RhcnQnJTJDJTIwMC4wKSUyQyUyMCgnc3RvcCclMkMlMjAxLjApJTJDJTIwKCdfdXNlX2RlZmF1bHRfdmFsdWVzJyUyQyUyMCU1QidwZXJ0dXJiZWRfZ3VpZGFuY2Vfc3RhcnQnJTJDJTIwJ3VzZV9vcmlnaW5hbF9mb3JtdWxhdGlvbiclMkMlMjAncGVydHVyYmVkX2d1aWRhbmNlX2xheWVycyclMkMlMjAnc3RvcCclMkMlMjAnc3RhcnQnJTJDJTIwJ2d1aWRhbmNlX3Jlc2NhbGUnJTJDJTIwJ3BlcnR1cmJlZF9ndWlkYW5jZV9zdG9wJyU1RCklMkMlMjAoJ19jbGFzc19uYW1lJyUyQyUyMCdQZXJ0dXJiZWRBdHRlbnRpb25HdWlkYW5jZScpJTJDJTIwKCdfZGlmZnVzZXJzX3ZlcnNpb24nJTJDJTIwJzAuMzUuMC5kZXYwJyklNUQpJTJDJTIwcmVwbyUzRE5vbmUlMkMlMjBzdWJmb2xkZXIlM0ROb25lJTJDJTIwdmFyaWFudCUzRE5vbmUlMkMlMjByZXZpc2lvbiUzRE5vbmUlMkMlMjBkZWZhdWx0X2NyZWF0aW9uX21ldGhvZCUzRCdmcm9tX2NvbmZpZycp",highlighted:`t2i_pipeline.get_component_spec(<span class="hljs-string">&quot;guider&quot;</span>)
ComponentSpec(name=<span class="hljs-string">&#x27;guider&#x27;</span>, type_hint=&lt;<span class="hljs-keyword">class</span> <span class="hljs-string">&#x27;diffusers.guiders.perturbed_attention_guidance.PerturbedAttentionGuidance&#x27;</span>&gt;, description=<span class="hljs-literal">None</span>, config=FrozenDict([(<span class="hljs-string">&#x27;guidance_scale&#x27;</span>, <span class="hljs-number">5.0</span>), (<span class="hljs-string">&#x27;perturbed_guidance_scale&#x27;</span>, <span class="hljs-number">2.5</span>), (<span class="hljs-string">&#x27;perturbed_guidance_start&#x27;</span>, <span class="hljs-number">0.01</span>), (<span class="hljs-string">&#x27;perturbed_guidance_stop&#x27;</span>, <span class="hljs-number">0.2</span>), (<span class="hljs-string">&#x27;perturbed_guidance_layers&#x27;</span>, <span class="hljs-literal">None</span>), (<span class="hljs-string">&#x27;perturbed_guidance_config&#x27;</span>, LayerSkipConfig(indices=[<span class="hljs-number">2</span>, <span class="hljs-number">9</span>], fqn=<span class="hljs-string">&#x27;mid_block.attentions.0.transformer_blocks&#x27;</span>, skip_attention=<span class="hljs-literal">False</span>, skip_attention_scores=<span class="hljs-literal">True</span>, skip_ff=<span class="hljs-literal">False</span>, dropout=<span class="hljs-number">1.0</span>)), (<span class="hljs-string">&#x27;guidance_rescale&#x27;</span>, <span class="hljs-number">0.0</span>), (<span class="hljs-string">&#x27;use_original_formulation&#x27;</span>, <span class="hljs-literal">False</span>), (<span class="hljs-string">&#x27;start&#x27;</span>, <span class="hljs-number">0.0</span>), (<span class="hljs-string">&#x27;stop&#x27;</span>, <span class="hljs-number">1.0</span>), (<span class="hljs-string">&#x27;_use_default_values&#x27;</span>, [<span class="hljs-string">&#x27;perturbed_guidance_start&#x27;</span>, <span class="hljs-string">&#x27;use_original_formulation&#x27;</span>, <span class="hljs-string">&#x27;perturbed_guidance_layers&#x27;</span>, <span class="hljs-string">&#x27;stop&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>, <span class="hljs-string">&#x27;guidance_rescale&#x27;</span>, <span class="hljs-string">&#x27;perturbed_guidance_stop&#x27;</span>]), (<span class="hljs-string">&#x27;_class_name&#x27;</span>, <span class="hljs-string">&#x27;PerturbedAttentionGuidance&#x27;</span>), (<span class="hljs-string">&#x27;_diffusers_version&#x27;</span>, <span class="hljs-string">&#x27;0.35.0.dev0&#x27;</span>)]), repo=<span class="hljs-literal">None</span>, subfolder=<span class="hljs-literal">None</span>, variant=<span class="hljs-literal">None</span>, revision=<span class="hljs-literal">None</span>, default_creation_method=<span class="hljs-string">&#x27;from_config&#x27;</span>)`,wrap:!1}}),Y=new ss({props:{title:"Loading custom guiders",local:"loading-custom-guiders",headingTag:"h2"}}),F=new w({props:{code:"JTdCJTBBJTIwJTIwJTIyZ3VpZGVyJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwbnVsbCUyQyUwQSUyMCUyMCUyMCUyMG51bGwlMkMlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjJyZXBvJTIyJTNBJTIwJTIyWWlZaVh1JTJGbW9kdWxhci1sb2FkZXItdDJpLWd1aWRlciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnJldmlzaW9uJTIyJTNBJTIwbnVsbCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnN1YmZvbGRlciUyMiUzQSUyMCUyMnBhZ19ndWlkZXIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjJ0eXBlX2hpbnQlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJkaWZmdXNlcnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJQZXJ0dXJiZWRBdHRlbnRpb25HdWlkYW5jZSUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMnZhcmlhbnQlMjIlM0ElMjBudWxsJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTVEJTBBJTdE",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;guider&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-literal"><span class="hljs-keyword">null</span></span><span class="hljs-punctuation">,</span>
    <span class="hljs-literal"><span class="hljs-keyword">null</span></span><span class="hljs-punctuation">,</span>
    <span class="hljs-punctuation">{</span>
      <span class="hljs-attr">&quot;repo&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;YiYiXu/modular-loader-t2i-guider&quot;</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;revision&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">null</span></span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;subfolder&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;pag_guider&quot;</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;type_hint&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
        <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
        <span class="hljs-string">&quot;PerturbedAttentionGuidance&quot;</span>
      <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
      <span class="hljs-attr">&quot;variant&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">null</span></span>
    <span class="hljs-punctuation">}</span>
  <span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),q=new w({props:{code:"dDJpX3BpcGVsaW5lJTIwJTNEJTIwdDJpX2Jsb2Nrcy5pbml0X3BpcGVsaW5lKCUyMllpWWlYdSUyRm1vZHVsYXItZG9jLWd1aWRlciUyMiklMEElMjMlMjBub3QlMjBjcmVhdGVkJTIwZHVyaW5nJTIwaW5pdCUwQWFzc2VydCUyMHQyaV9waXBlbGluZS5ndWlkZXIlMjBpcyUyME5vbmUlMEF0MmlfcGlwZWxpbmUubG9hZF9jb21wb25lbnRzKCklMEElMjMlMjBsb2FkZWQlMjBhcyUyMFBBRyUyMGd1aWRlciUwQXQyaV9waXBlbGluZS5ndWlkZXI=",highlighted:`t2i_pipeline = t2i_blocks.init_pipeline(<span class="hljs-string">&quot;YiYiXu/modular-doc-guider&quot;</span>)
<span class="hljs-comment"># not created during init</span>
<span class="hljs-keyword">assert</span> t2i_pipeline.guider <span class="hljs-keyword">is</span> <span class="hljs-literal">None</span>
t2i_pipeline.load_components()
<span class="hljs-comment"># loaded as PAG guider</span>
t2i_pipeline.guider`,wrap:!1}}),H=new ss({props:{title:"Changing guider parameters",local:"changing-guider-parameters",headingTag:"h2"}}),G=new As({props:{id:"switch",options:["create","update_components"],$$slots:{default:[Ks]},$$scope:{ctx:Z}}}),L=new ss({props:{title:"Uploading custom guiders",local:"uploading-custom-guiders",headingTag:"h2"}}),P=new w({props:{code:"Z3VpZGVyLnB1c2hfdG9faHViKCUyMllpWWlYdSUyRm1vZHVsYXItbG9hZGVyLXQyaS1ndWlkZXIlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJwYWdfZ3VpZGVyJTIyKQ==",highlighted:'guider.push_to_hub(<span class="hljs-string">&quot;YiYiXu/modular-loader-t2i-guider&quot;</span>, subfolder=<span class="hljs-string">&quot;pag_guider&quot;</span>)',wrap:!1}}),X=new As({props:{id:"upload",options:["modular_model_index.json","update_components"],$$slots:{default:[le]},$$scope:{ctx:Z}}}),K=new Ls({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/modular_diffusers/guiders.md"}}),{c(){e=J("meta"),d=c(),t=J("p"),u=c(),m(n.$$.fragment),l=c(),f=J("p"),f.innerHTML=b,x=c(),T=J("p"),T.textContent=W,V=c(),m(r.$$.fragment),_=c(),C=J("p"),C.innerHTML=ws,ls=c(),I=J("p"),I.innerHTML=Ts,ns=c(),m(B.$$.fragment),as=c(),R=J("p"),R.innerHTML=Ws,ts=c(),m(k.$$.fragment),ps=c(),m(v.$$.fragment),is=c(),N=J("p"),N.innerHTML=Cs,us=c(),m(A.$$.fragment),rs=c(),m(Y.$$.fragment),cs=c(),Q=J("p"),Q.innerHTML=Vs,os=c(),m(F.$$.fragment),ds=c(),E=J("p"),E.innerHTML=ks,fs=c(),m(q.$$.fragment),ms=c(),m(H.$$.fragment),Ms=c(),z=J("p"),z.innerHTML=Gs,hs=c(),m(G.$$.fragment),js=c(),m(L.$$.fragment),ys=c(),S=J("p"),S.innerHTML=Xs,gs=c(),m(P.$$.fragment),Js=c(),D=J("p"),D.innerHTML=xs,$s=c(),m(X.$$.fragment),Zs=c(),m(K.$$.fragment),_s=c(),O=J("p"),this.h()},l(s){const a=Hs("svelte-u9bgzb",document.head);e=$(a,"META",{name:!0,content:!0}),a.forEach(p),d=o(s),t=$(s,"P",{}),vs(t).forEach(p),u=o(s),M(n.$$.fragment,s),l=o(s),f=$(s,"P",{"data-svelte-h":!0}),U(f)!=="svelte-eyka96"&&(f.innerHTML=b),x=o(s),T=$(s,"P",{"data-svelte-h":!0}),U(T)!=="svelte-1ir8as7"&&(T.textContent=W),V=o(s),M(r.$$.fragment,s),_=o(s),C=$(s,"P",{"data-svelte-h":!0}),U(C)!=="svelte-okj828"&&(C.innerHTML=ws),ls=o(s),I=$(s,"P",{"data-svelte-h":!0}),U(I)!=="svelte-26f64c"&&(I.innerHTML=Ts),ns=o(s),M(B.$$.fragment,s),as=o(s),R=$(s,"P",{"data-svelte-h":!0}),U(R)!=="svelte-14ovw6"&&(R.innerHTML=Ws),ts=o(s),M(k.$$.fragment,s),ps=o(s),M(v.$$.fragment,s),is=o(s),N=$(s,"P",{"data-svelte-h":!0}),U(N)!=="svelte-1dzarv8"&&(N.innerHTML=Cs),us=o(s),M(A.$$.fragment,s),rs=o(s),M(Y.$$.fragment,s),cs=o(s),Q=$(s,"P",{"data-svelte-h":!0}),U(Q)!=="svelte-xt8m5q"&&(Q.innerHTML=Vs),os=o(s),M(F.$$.fragment,s),ds=o(s),E=$(s,"P",{"data-svelte-h":!0}),U(E)!=="svelte-l163td"&&(E.innerHTML=ks),fs=o(s),M(q.$$.fragment,s),ms=o(s),M(H.$$.fragment,s),Ms=o(s),z=$(s,"P",{"data-svelte-h":!0}),U(z)!=="svelte-1rlpllq"&&(z.innerHTML=Gs),hs=o(s),M(G.$$.fragment,s),js=o(s),M(L.$$.fragment,s),ys=o(s),S=$(s,"P",{"data-svelte-h":!0}),U(S)!=="svelte-mtv9uz"&&(S.innerHTML=Xs),gs=o(s),M(P.$$.fragment,s),Js=o(s),D=$(s,"P",{"data-svelte-h":!0}),U(D)!=="svelte-1qqg4b1"&&(D.innerHTML=xs),$s=o(s),M(X.$$.fragment,s),Zs=o(s),M(K.$$.fragment,s),_s=o(s),O=$(s,"P",{}),vs(O).forEach(p),this.h()},h(){Ns(e,"name","hf:doc:metadata"),Ns(e,"content",ae)},m(s,a){zs(document.head,e),i(s,d,a),i(s,t,a),i(s,u,a),h(n,s,a),i(s,l,a),i(s,f,a),i(s,x,a),i(s,T,a),i(s,V,a),h(r,s,a),i(s,_,a),i(s,C,a),i(s,ls,a),i(s,I,a),i(s,ns,a),h(B,s,a),i(s,as,a),i(s,R,a),i(s,ts,a),h(k,s,a),i(s,ps,a),h(v,s,a),i(s,is,a),i(s,N,a),i(s,us,a),h(A,s,a),i(s,rs,a),h(Y,s,a),i(s,cs,a),i(s,Q,a),i(s,os,a),h(F,s,a),i(s,ds,a),i(s,E,a),i(s,fs,a),h(q,s,a),i(s,ms,a),h(H,s,a),i(s,Ms,a),i(s,z,a),i(s,hs,a),h(G,s,a),i(s,js,a),h(L,s,a),i(s,ys,a),i(s,S,a),i(s,gs,a),h(P,s,a),i(s,Js,a),i(s,D,a),i(s,$s,a),h(X,s,a),i(s,Zs,a),h(K,s,a),i(s,_s,a),i(s,O,a),bs=!0},p(s,[a]){const Is={};a&2&&(Is.$$scope={dirty:a,ctx:s}),k.$set(Is);const Bs={};a&2&&(Bs.$$scope={dirty:a,ctx:s}),G.$set(Bs);const Rs={};a&2&&(Rs.$$scope={dirty:a,ctx:s}),X.$set(Rs)},i(s){bs||(j(n.$$.fragment,s),j(r.$$.fragment,s),j(B.$$.fragment,s),j(k.$$.fragment,s),j(v.$$.fragment,s),j(A.$$.fragment,s),j(Y.$$.fragment,s),j(F.$$.fragment,s),j(q.$$.fragment,s),j(H.$$.fragment,s),j(G.$$.fragment,s),j(L.$$.fragment,s),j(P.$$.fragment,s),j(X.$$.fragment,s),j(K.$$.fragment,s),bs=!0)},o(s){y(n.$$.fragment,s),y(r.$$.fragment,s),y(B.$$.fragment,s),y(k.$$.fragment,s),y(v.$$.fragment,s),y(A.$$.fragment,s),y(Y.$$.fragment,s),y(F.$$.fragment,s),y(q.$$.fragment,s),y(H.$$.fragment,s),y(G.$$.fragment,s),y(L.$$.fragment,s),y(P.$$.fragment,s),y(X.$$.fragment,s),y(K.$$.fragment,s),bs=!1},d(s){s&&(p(d),p(t),p(u),p(l),p(f),p(x),p(T),p(V),p(_),p(C),p(ls),p(I),p(ns),p(as),p(R),p(ts),p(ps),p(is),p(N),p(us),p(rs),p(cs),p(Q),p(os),p(ds),p(E),p(fs),p(ms),p(Ms),p(z),p(hs),p(js),p(ys),p(S),p(gs),p(Js),p(D),p($s),p(Zs),p(_s),p(O)),p(e),g(n,s),g(r,s),g(B,s),g(k,s),g(v,s),g(A,s),g(Y,s),g(F,s),g(q,s),g(H,s),g(G,s),g(L,s),g(P,s),g(X,s),g(K,s)}}}const ae='{"title":"Guiders","local":"guiders","sections":[{"title":"Switching guiders","local":"switching-guiders","sections":[],"depth":2},{"title":"Loading custom guiders","local":"loading-custom-guiders","sections":[],"depth":2},{"title":"Changing guider parameters","local":"changing-guider-parameters","sections":[],"depth":2},{"title":"Uploading custom guiders","local":"uploading-custom-guiders","sections":[],"depth":2}],"depth":1}';function te(Z){return Fs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class de extends Es{constructor(e){super(),qs(this,e,te,ne,Qs,{})}}export{de as component};
