import{s as zs,o as Ls,n as xs}from"../chunks/scheduler.53228c21.js";import{S as Ss,i as Ps,e as J,s as r,c as f,h as Ds,a as Z,d as n,b as c,f as Vs,g as M,j as U,k as Gs,l as is,m as t,n as m,t as h,o as j,p as y}from"../chunks/index.100fac89.js";import{C as Ks}from"../chunks/CopyLLMTxtMenu.2cdbb51f.js";import{C as W}from"../chunks/CodeBlock.d30a6509.js";import{H as ps,E as Os}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.3fcbbc76.js";import{H as Hs,a as Xs}from"../chunks/HfOption.fad27e59.js";function se(w){let a,d;return a=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(){f(a.$$.fragment)},l(p){M(a.$$.fragment,p)},m(p,o){m(a,p,o),d=!0},p:xs,i(p){d||(h(a.$$.fragment,p),d=!0)},o(p){j(a.$$.fragment,p),d=!1},d(p){y(a,p)}}}function ee(w){let a,d;return a=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(){f(a.$$.fragment)},l(p){M(a.$$.fragment,p)},m(p,o){m(a,p,o),d=!0},p:xs,i(p){d||(h(a.$$.fragment,p),d=!0)},o(p){j(a.$$.fragment,p),d=!1},d(p){y(a,p)}}}function le(w){let a,d,p,o;return a=new Xs({props:{id:"switch",option:"create",$$slots:{default:[se]},$$scope:{ctx:w}}}),p=new Xs({props:{id:"switch",option:"update_components",$$slots:{default:[ee]},$$scope:{ctx:w}}}),{c(){f(a.$$.fragment),d=r(),f(p.$$.fragment)},l(l){M(a.$$.fragment,l),d=c(l),M(p.$$.fragment,l)},m(l,i){m(a,l,i),t(l,d,i),m(p,l,i),o=!0},p(l,i){const g={};i&2&&(g.$$scope={dirty:i,ctx:l}),a.$set(g);const b={};i&2&&(b.$$scope={dirty:i,ctx:l}),p.$set(b)},i(l){o||(h(a.$$.fragment,l),h(p.$$.fragment,l),o=!0)},o(l){j(a.$$.fragment,l),j(p.$$.fragment,l),o=!1},d(l){l&&n(d),y(a,l),y(p,l)}}}function ne(w){let a,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.",p,o,l;return o=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(){a=J("p"),a.innerHTML=d,p=r(),f(o.$$.fragment)},l(i){a=Z(i,"P",{"data-svelte-h":!0}),U(a)!=="svelte-1ouml9j"&&(a.innerHTML=d),p=c(i),M(o.$$.fragment,i)},m(i,g){t(i,a,g),t(i,p,g),m(o,i,g),l=!0},p:xs,i(i){l||(h(o.$$.fragment,i),l=!0)},o(i){j(o.$$.fragment,i),l=!1},d(i){i&&(n(a),n(p)),y(o,i)}}}function ae(w){let a,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.',p,o,l,i="Changing the creation method will return text letting you know you’re changing the creation type to <code>from_pretrained</code>.",g,b,C,k,V,$,as='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.',G,T,X;return b=new W({props:{code:"TW9kdWxhclBpcGVsaW5lLnVwZGF0ZV9jb21wb25lbnRzJTNBJTIwY2hhbmdpbmclMjB0aGUlMjBkZWZhdWx0X2NyZWF0aW9uX21ldGhvZCUyMG9mJTIwZ3VpZGVyJTIwZnJvbSUyMGZyb21fY29uZmlnJTIwdG8lMjBmcm9tX3ByZXRyYWluZWQu",highlighted:"ModularPipeline.update_components: changing the default_creation_method of guider from from_config to from_pretrained.",wrap:!1}}),k=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}}),T=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(){a=J("p"),a.innerHTML=d,p=r(),o=J("blockquote"),l=J("p"),l.innerHTML=i,g=r(),f(b.$$.fragment),C=r(),f(k.$$.fragment),V=r(),$=J("p"),$.innerHTML=as,G=r(),f(T.$$.fragment),this.h()},l(u){a=Z(u,"P",{"data-svelte-h":!0}),U(a)!=="svelte-e2g9i8"&&(a.innerHTML=d),p=c(u),o=Z(u,"BLOCKQUOTE",{class:!0});var _=Vs(o);l=Z(_,"P",{"data-svelte-h":!0}),U(l)!=="svelte-1xgh49p"&&(l.innerHTML=i),g=c(_),M(b.$$.fragment,_),_.forEach(n),C=c(u),M(k.$$.fragment,u),V=c(u),$=Z(u,"P",{"data-svelte-h":!0}),U($)!=="svelte-15ac2ub"&&($.innerHTML=as),G=c(u),M(T.$$.fragment,u),this.h()},h(){Gs(o,"class","tip")},m(u,_){t(u,a,_),t(u,p,_),t(u,o,_),is(o,l),is(o,g),m(b,o,null),t(u,C,_),m(k,u,_),t(u,V,_),t(u,$,_),t(u,G,_),m(T,u,_),X=!0},p:xs,i(u){X||(h(b.$$.fragment,u),h(k.$$.fragment,u),h(T.$$.fragment,u),X=!0)},o(u){j(b.$$.fragment,u),j(k.$$.fragment,u),j(T.$$.fragment,u),X=!1},d(u){u&&(n(a),n(p),n(o),n(C),n(V),n($),n(G)),y(b),y(k,u),y(T,u)}}}function te(w){let a,d,p,o;return a=new Xs({props:{id:"upload",option:"modular_model_index.json",$$slots:{default:[ne]},$$scope:{ctx:w}}}),p=new Xs({props:{id:"upload",option:"update_components",$$slots:{default:[ae]},$$scope:{ctx:w}}}),{c(){f(a.$$.fragment),d=r(),f(p.$$.fragment)},l(l){M(a.$$.fragment,l),d=c(l),M(p.$$.fragment,l)},m(l,i){m(a,l,i),t(l,d,i),m(p,l,i),o=!0},p(l,i){const g={};i&2&&(g.$$scope={dirty:i,ctx:l}),a.$set(g);const b={};i&2&&(b.$$scope={dirty:i,ctx:l}),p.$set(b)},i(l){o||(h(a.$$.fragment,l),h(p.$$.fragment,l),o=!0)},o(l){j(a.$$.fragment,l),j(p.$$.fragment,l),o=!1},d(l){l&&n(d),y(a,l),y(p,l)}}}function pe(w){let a,d,p,o,l,i,g,b,C,k='<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.',V,$,as="This guide will show you how to switch guiders, adjust guider parameters, and load and share them to the Hub.",G,T,X,u,_='<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>.',us,R,Is='Use <a href="/docs/diffusers/main/en/api/modular_diffusers/pipeline#diffusers.ModularPipeline.get_component_spec">get_component_spec()</a> to inspect a guider.',rs,v,cs,N,Rs='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>.',os,x,ns,vs="Changing guiders will return text letting you know you’re changing the guider type.",Bs,A,ds,Y,fs,Q,Ns='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.',Ms,E,ms,q,hs,F,As="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.",js,H,ys,z,Ys='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>.',gs,L,Js,S,Zs,P,Qs='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.',bs,B,_s,D,Us,K,Es='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.',$s,O,Ts,ss,qs='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.',ws,I,Ws,es,Cs,ts,ks;return l=new Ks({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),g=new ps({props:{title:"Guiders",local:"guiders",headingTag:"h1"}}),T=new ps({props:{title:"Switching guiders",local:"switching-guiders",headingTag:"h2"}}),v=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}}),A=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}}),Y=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}}),E=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}}),q=new ps({props:{title:"Loading custom guiders",local:"loading-custom-guiders",headingTag:"h2"}}),H=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}}),L=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}}),S=new ps({props:{title:"Changing guider parameters",local:"changing-guider-parameters",headingTag:"h2"}}),B=new Hs({props:{id:"switch",options:["create","update_components"],$$slots:{default:[le]},$$scope:{ctx:w}}}),D=new ps({props:{title:"Uploading custom guiders",local:"uploading-custom-guiders",headingTag:"h2"}}),O=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}}),I=new Hs({props:{id:"upload",options:["modular_model_index.json","update_components"],$$slots:{default:[te]},$$scope:{ctx:w}}}),es=new Os({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/modular_diffusers/guiders.md"}}),{c(){a=J("meta"),d=r(),p=J("p"),o=r(),f(l.$$.fragment),i=r(),f(g.$$.fragment),b=r(),C=J("p"),C.innerHTML=k,V=r(),$=J("p"),$.textContent=as,G=r(),f(T.$$.fragment),X=r(),u=J("p"),u.innerHTML=_,us=r(),R=J("p"),R.innerHTML=Is,rs=r(),f(v.$$.fragment),cs=r(),N=J("p"),N.innerHTML=Rs,os=r(),x=J("blockquote"),ns=J("p"),ns.textContent=vs,Bs=r(),f(A.$$.fragment),ds=r(),f(Y.$$.fragment),fs=r(),Q=J("p"),Q.innerHTML=Ns,Ms=r(),f(E.$$.fragment),ms=r(),f(q.$$.fragment),hs=r(),F=J("p"),F.innerHTML=As,js=r(),f(H.$$.fragment),ys=r(),z=J("p"),z.innerHTML=Ys,gs=r(),f(L.$$.fragment),Js=r(),f(S.$$.fragment),Zs=r(),P=J("p"),P.innerHTML=Qs,bs=r(),f(B.$$.fragment),_s=r(),f(D.$$.fragment),Us=r(),K=J("p"),K.innerHTML=Es,$s=r(),f(O.$$.fragment),Ts=r(),ss=J("p"),ss.innerHTML=qs,ws=r(),f(I.$$.fragment),Ws=r(),f(es.$$.fragment),Cs=r(),ts=J("p"),this.h()},l(s){const e=Ds("svelte-u9bgzb",document.head);a=Z(e,"META",{name:!0,content:!0}),e.forEach(n),d=c(s),p=Z(s,"P",{}),Vs(p).forEach(n),o=c(s),M(l.$$.fragment,s),i=c(s),M(g.$$.fragment,s),b=c(s),C=Z(s,"P",{"data-svelte-h":!0}),U(C)!=="svelte-eyka96"&&(C.innerHTML=k),V=c(s),$=Z(s,"P",{"data-svelte-h":!0}),U($)!=="svelte-1ir8as7"&&($.textContent=as),G=c(s),M(T.$$.fragment,s),X=c(s),u=Z(s,"P",{"data-svelte-h":!0}),U(u)!=="svelte-okj828"&&(u.innerHTML=_),us=c(s),R=Z(s,"P",{"data-svelte-h":!0}),U(R)!=="svelte-26f64c"&&(R.innerHTML=Is),rs=c(s),M(v.$$.fragment,s),cs=c(s),N=Z(s,"P",{"data-svelte-h":!0}),U(N)!=="svelte-14ovw6"&&(N.innerHTML=Rs),os=c(s),x=Z(s,"BLOCKQUOTE",{class:!0});var ls=Vs(x);ns=Z(ls,"P",{"data-svelte-h":!0}),U(ns)!=="svelte-1lubf19"&&(ns.textContent=vs),Bs=c(ls),M(A.$$.fragment,ls),ls.forEach(n),ds=c(s),M(Y.$$.fragment,s),fs=c(s),Q=Z(s,"P",{"data-svelte-h":!0}),U(Q)!=="svelte-1dzarv8"&&(Q.innerHTML=Ns),Ms=c(s),M(E.$$.fragment,s),ms=c(s),M(q.$$.fragment,s),hs=c(s),F=Z(s,"P",{"data-svelte-h":!0}),U(F)!=="svelte-xt8m5q"&&(F.innerHTML=As),js=c(s),M(H.$$.fragment,s),ys=c(s),z=Z(s,"P",{"data-svelte-h":!0}),U(z)!=="svelte-l163td"&&(z.innerHTML=Ys),gs=c(s),M(L.$$.fragment,s),Js=c(s),M(S.$$.fragment,s),Zs=c(s),P=Z(s,"P",{"data-svelte-h":!0}),U(P)!=="svelte-1rlpllq"&&(P.innerHTML=Qs),bs=c(s),M(B.$$.fragment,s),_s=c(s),M(D.$$.fragment,s),Us=c(s),K=Z(s,"P",{"data-svelte-h":!0}),U(K)!=="svelte-mtv9uz"&&(K.innerHTML=Es),$s=c(s),M(O.$$.fragment,s),Ts=c(s),ss=Z(s,"P",{"data-svelte-h":!0}),U(ss)!=="svelte-1qqg4b1"&&(ss.innerHTML=qs),ws=c(s),M(I.$$.fragment,s),Ws=c(s),M(es.$$.fragment,s),Cs=c(s),ts=Z(s,"P",{}),Vs(ts).forEach(n),this.h()},h(){Gs(a,"name","hf:doc:metadata"),Gs(a,"content",ie),Gs(x,"class","tip")},m(s,e){is(document.head,a),t(s,d,e),t(s,p,e),t(s,o,e),m(l,s,e),t(s,i,e),m(g,s,e),t(s,b,e),t(s,C,e),t(s,V,e),t(s,$,e),t(s,G,e),m(T,s,e),t(s,X,e),t(s,u,e),t(s,us,e),t(s,R,e),t(s,rs,e),m(v,s,e),t(s,cs,e),t(s,N,e),t(s,os,e),t(s,x,e),is(x,ns),is(x,Bs),m(A,x,null),t(s,ds,e),m(Y,s,e),t(s,fs,e),t(s,Q,e),t(s,Ms,e),m(E,s,e),t(s,ms,e),m(q,s,e),t(s,hs,e),t(s,F,e),t(s,js,e),m(H,s,e),t(s,ys,e),t(s,z,e),t(s,gs,e),m(L,s,e),t(s,Js,e),m(S,s,e),t(s,Zs,e),t(s,P,e),t(s,bs,e),m(B,s,e),t(s,_s,e),m(D,s,e),t(s,Us,e),t(s,K,e),t(s,$s,e),m(O,s,e),t(s,Ts,e),t(s,ss,e),t(s,ws,e),m(I,s,e),t(s,Ws,e),m(es,s,e),t(s,Cs,e),t(s,ts,e),ks=!0},p(s,[e]){const ls={};e&2&&(ls.$$scope={dirty:e,ctx:s}),B.$set(ls);const Fs={};e&2&&(Fs.$$scope={dirty:e,ctx:s}),I.$set(Fs)},i(s){ks||(h(l.$$.fragment,s),h(g.$$.fragment,s),h(T.$$.fragment,s),h(v.$$.fragment,s),h(A.$$.fragment,s),h(Y.$$.fragment,s),h(E.$$.fragment,s),h(q.$$.fragment,s),h(H.$$.fragment,s),h(L.$$.fragment,s),h(S.$$.fragment,s),h(B.$$.fragment,s),h(D.$$.fragment,s),h(O.$$.fragment,s),h(I.$$.fragment,s),h(es.$$.fragment,s),ks=!0)},o(s){j(l.$$.fragment,s),j(g.$$.fragment,s),j(T.$$.fragment,s),j(v.$$.fragment,s),j(A.$$.fragment,s),j(Y.$$.fragment,s),j(E.$$.fragment,s),j(q.$$.fragment,s),j(H.$$.fragment,s),j(L.$$.fragment,s),j(S.$$.fragment,s),j(B.$$.fragment,s),j(D.$$.fragment,s),j(O.$$.fragment,s),j(I.$$.fragment,s),j(es.$$.fragment,s),ks=!1},d(s){s&&(n(d),n(p),n(o),n(i),n(b),n(C),n(V),n($),n(G),n(X),n(u),n(us),n(R),n(rs),n(cs),n(N),n(os),n(x),n(ds),n(fs),n(Q),n(Ms),n(ms),n(hs),n(F),n(js),n(ys),n(z),n(gs),n(Js),n(Zs),n(P),n(bs),n(_s),n(Us),n(K),n($s),n(Ts),n(ss),n(ws),n(Ws),n(Cs),n(ts)),n(a),y(l,s),y(g,s),y(T,s),y(v,s),y(A),y(Y,s),y(E,s),y(q,s),y(H,s),y(L,s),y(S,s),y(B,s),y(D,s),y(O,s),y(I,s),y(es,s)}}}const ie='{"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 ue(w){return Ls(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class me extends Ss{constructor(a){super(),Ps(this,a,ue,pe,zs,{})}}export{me as component};
