import{s as vs,o as Es,n as ls}from"../chunks/scheduler.5c93273d.js";import{S as Fs,i as qs,g as h,s as r,r as J,A as Hs,h as $,f as p,c as o,j as Ns,u as m,x as _,k as Qs,y as zs,a as i,v as j,d as f,t as U,w as y}from"../chunks/index.e43dd92b.js";import{T as Ys}from"../chunks/Tip.1cbfe904.js";import{C as b}from"../chunks/CodeBlock.6896320e.js";import{H as ss,E as Ls}from"../chunks/getInferenceSnippets.d410b42d.js";import{H as As,a as _s}from"../chunks/HfOption.d50154c3.js";function Ds(g){let l,d="更改引导器将返回文本，让您知道您正在更改引导器类型。",t,c,e;return c=new b({props:{code:"TW9kdWxhclBpcGVsaW5lLnVwZGF0ZV9jb21wb25lbnRzJTNBJTIwJUU2JUI3JUJCJUU1JThBJUEwJUU1JTg1JUI3JUU2JTlDJTg5JUU2JTk2JUIwJUU3JUIxJUJCJUU1JTlFJThCJUU3JTlBJTg0JUU1JUJDJTk1JUU1JUFGJUJDJUU1JTk5JUE4JTNBJTIwUGVydHVyYmVkQXR0ZW50aW9uR3VpZGFuY2UlMkMlMjAlRTUlODUlODglRTUlODklOEQlRTclQjElQkIlRTUlOUUlOEIlM0ElMjBDbGFzc2lmaWVyRnJlZUd1aWRhbmNl",highlighted:"ModularPipeline.update_components: 添加具有新类型的引导器: PerturbedAttentionGuidance, 先前类型: ClassifierFreeGuidance",wrap:!1}}),{c(){l=h("p"),l.textContent=d,t=r(),J(c.$$.fragment)},l(n){l=$(n,"P",{"data-svelte-h":!0}),_(l)!=="svelte-33vhat"&&(l.textContent=d),t=o(n),m(c.$$.fragment,n)},m(n,M){i(n,l,M),i(n,t,M),j(c,n,M),e=!0},p:ls,i(n){e||(f(c.$$.fragment,n),e=!0)},o(n){U(c.$$.fragment,n),e=!1},d(n){n&&(p(l),p(t)),y(c,n)}}}function Ss(g){let l,d;return l=new b({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(){J(l.$$.fragment)},l(t){m(l.$$.fragment,t)},m(t,c){j(l,t,c),d=!0},p:ls,i(t){d||(f(l.$$.fragment,t),d=!0)},o(t){U(l.$$.fragment,t),d=!1},d(t){y(l,t)}}}function Ps(g){let l,d;return l=new b({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(){J(l.$$.fragment)},l(t){m(l.$$.fragment,t)},m(t,c){j(l,t,c),d=!0},p:ls,i(t){d||(f(l.$$.fragment,t),d=!0)},o(t){U(l.$$.fragment,t),d=!1},d(t){y(l,t)}}}function Ks(g){let l,d,t,c;return l=new _s({props:{id:"switch",option:"create",$$slots:{default:[Ss]},$$scope:{ctx:g}}}),t=new _s({props:{id:"switch",option:"update_components",$$slots:{default:[Ps]},$$scope:{ctx:g}}}),{c(){J(l.$$.fragment),d=r(),J(t.$$.fragment)},l(e){m(l.$$.fragment,e),d=o(e),m(t.$$.fragment,e)},m(e,n){j(l,e,n),i(e,d,n),j(t,e,n),c=!0},p(e,n){const M={};n&2&&(M.$$scope={dirty:n,ctx:e}),l.$set(M);const Z={};n&2&&(Z.$$scope={dirty:n,ctx:e}),t.$set(Z)},i(e){c||(f(l.$$.fragment,e),f(t.$$.fragment,e),c=!0)},o(e){U(l.$$.fragment,e),U(t.$$.fragment,e),c=!1},d(e){e&&p(d),y(l,e),y(t,e)}}}function Os(g){let l,d=`编辑 <code>modular_model_index.json</code> 文件，并添加引导器的加载规范，指向包含引导器配置的文件夹
例如。`,t,c,e;return c=new b({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(){l=h("p"),l.innerHTML=d,t=r(),J(c.$$.fragment)},l(n){l=$(n,"P",{"data-svelte-h":!0}),_(l)!=="svelte-1593jyl"&&(l.innerHTML=d),t=o(n),m(c.$$.fragment,n)},m(n,M){i(n,l,M),i(n,t,M),j(c,n,M),e=!0},p:ls,i(n){e||(f(c.$$.fragment,n),e=!0)},o(n){U(c.$$.fragment,n),e=!1},d(n){n&&(p(l),p(t)),y(c,n)}}}function sl(g){let l,d="更改创建方法将返回文本，告知您正在将创建类型更改为 <code>from_pretrained</code>。",t,c,e;return c=new b({props:{code:"TW9kdWxhclBpcGVsaW5lLnVwZGF0ZV9jb21wb25lbnRzJTNBJTIwJUU1JUIwJTg2JUU1JUJDJTk1JUU1JUFGJUJDJUU1JTk5JUE4JUU3JTlBJTg0JTIwZGVmYXVsdF9jcmVhdGlvbl9tZXRob2QlMjAlRTQlQkIlOEUlMjBmcm9tX2NvbmZpZyUyMCVFNiU5QiVCNCVFNiU5NCVCOSVFNCVCOCVCQSUyMGZyb21fcHJldHJhaW5lZCVFMyU4MCU4Mg==",highlighted:"ModularPipeline.update_components: 将引导器的 default_creation_method 从 from_config 更改为 from_pretrained。",wrap:!1}}),{c(){l=h("p"),l.innerHTML=d,t=r(),J(c.$$.fragment)},l(n){l=$(n,"P",{"data-svelte-h":!0}),_(l)!=="svelte-1ey9qmd"&&(l.innerHTML=d),t=o(n),m(c.$$.fragment,n)},m(n,M){i(n,l,M),i(n,t,M),j(c,n,M),e=!0},p:ls,i(n){e||(f(c.$$.fragment,n),e=!0)},o(n){U(c.$$.fragment,n),e=!1},d(n){n&&(p(l),p(t)),y(c,n)}}}function ll(g){let l,d="将 <code>default_creation_method()</code> 更改为 <code>from_pretrained</code> 并使用 <code>update_components()</code> 来更新引导器和组件规范以及管道配置。",t,c,e,n,M,Z,x="要使其成为管道的默认引导器，请调用 <code>push_to_hub()</code>。这是一个可选步骤，如果您仅在本地进行实验，则不需要。",w,W,C;return c=new Ys({props:{warning:!1,$$slots:{default:[sl]},$$scope:{ctx:g}}}),n=new b({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 b({props:{code:"dDJpX3BpcGVsaW5lLnB1c2hfdG9faHViKCUyMllpWWlYdSUyRm1vZHVsYXItZG9jLWd1aWRlciUyMik=",highlighted:'t2i_pipeline.push_to_hub(<span class="hljs-string">&quot;YiYiXu/modular-doc-guider&quot;</span>)',wrap:!1}}),{c(){l=h("p"),l.innerHTML=d,t=r(),J(c.$$.fragment),e=r(),J(n.$$.fragment),M=r(),Z=h("p"),Z.innerHTML=x,w=r(),J(W.$$.fragment)},l(u){l=$(u,"P",{"data-svelte-h":!0}),_(l)!=="svelte-8z78f8"&&(l.innerHTML=d),t=o(u),m(c.$$.fragment,u),e=o(u),m(n.$$.fragment,u),M=o(u),Z=$(u,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-17sy0mx"&&(Z.innerHTML=x),w=o(u),m(W.$$.fragment,u)},m(u,T){i(u,l,T),i(u,t,T),j(c,u,T),i(u,e,T),j(n,u,T),i(u,M,T),i(u,Z,T),i(u,w,T),j(W,u,T),C=!0},p(u,T){const V={};T&2&&(V.$$scope={dirty:T,ctx:u}),c.$set(V)},i(u){C||(f(c.$$.fragment,u),f(n.$$.fragment,u),f(W.$$.fragment,u),C=!0)},o(u){U(c.$$.fragment,u),U(n.$$.fragment,u),U(W.$$.fragment,u),C=!1},d(u){u&&(p(l),p(t),p(e),p(M),p(Z),p(w)),y(c,u),y(n,u),y(W,u)}}}function nl(g){let l,d,t,c;return l=new _s({props:{id:"upload",option:"modular_model_index.json",$$slots:{default:[Os]},$$scope:{ctx:g}}}),t=new _s({props:{id:"upload",option:"update_components",$$slots:{default:[ll]},$$scope:{ctx:g}}}),{c(){J(l.$$.fragment),d=r(),J(t.$$.fragment)},l(e){m(l.$$.fragment,e),d=o(e),m(t.$$.fragment,e)},m(e,n){j(l,e,n),i(e,d,n),j(t,e,n),c=!0},p(e,n){const M={};n&2&&(M.$$scope={dirty:n,ctx:e}),l.$set(M);const Z={};n&2&&(Z.$$scope={dirty:n,ctx:e}),t.$set(Z)},i(e){c||(f(l.$$.fragment,e),f(t.$$.fragment,e),c=!0)},o(e){U(l.$$.fragment,e),U(t.$$.fragment,e),c=!1},d(e){e&&p(d),y(l,e),y(t,e)}}}function el(g){let l,d,t,c,e,n,M,Z='<a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-free guidance</a> 引导模型生成更好地匹配提示，通常用于提高生成质量、控制和提示的遵循度。有不同类型的引导方法，在 Diffusers 中，它们被称为<em>引导器</em>。与块类似，可以轻松切换和使用不同的引导器以适应不同的用例，而无需重写管道。',x,w,W="本指南将向您展示如何切换引导器、调整引导器参数，以及将它们加载并共享到 Hub。",C,u,T,V,bs="<code>ClassifierFreeGuidance</code> 是默认引导器，在使用 <code>init_pipeline()</code> 初始化管道时创建。它通过 <code>from_config</code> 创建，这意味着它不需要从模块化存储库加载规范。引导器不会列在 <code>modular_model_index.json</code> 中。",ns,I,ws="使用 <code>get_component_spec()</code> 来检查引导器。",es,R,as,B,Ws="通过将新引导器传递给 <code>update_components()</code> 来切换到不同的引导器。",ts,k,ps,N,is,Q,Vs="再次使用 <code>get_component_spec()</code> 来验证引导器类型是否不同。",cs,A,us,Y,rs,v,Cs="已经在 Hub 上保存并带有 <code>modular_model_index.json</code> 文件的引导器现在被视为 <code>from_pretrained</code> 组件，而不是 <code>from_config</code> 组件。",os,E,ds,F,ks="引导器只有在调用 <code>load_components()</code> 之后才会创建，基于 <code>modular_model_index.json</code> 中的加载规范。",Ms,q,Js,H,ms,z,Gs="引导器参数可以通过 <code>create()</code> 方法或 <code>update_components()</code> 方法进行调整。下面的示例更改了 <code>guidance_scale</code> 值。",js,G,fs,L,Us,D,Xs="在自定义引导器上调用 <code>push_to_hub()</code> 方法，将其分享到 Hub。",ys,S,hs,P,xs="要使此引导器可用于管道，可以修改 <code>modular_model_index.json</code> 文件或使用 <code>update_components()</code> 方法。",$s,X,gs,K,Ts,O,Zs;return e=new ss({props:{title:"引导器",local:"引导器",headingTag:"h1"}}),u=new ss({props:{title:"切换引导器",local:"切换引导器",headingTag:"h2"}}),R=new b({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:[Ds]},$$scope:{ctx:g}}}),N=new b({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 b({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:"加载自定义引导器",local:"加载自定义引导器",headingTag:"h2"}}),E=new b({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 b({props:{code:"dDJpX3BpcGVsaW5lJTIwJTNEJTIwdDJpX2Jsb2Nrcy5pbml0X3BpcGVsaW5lKCUyMllpWWlYdSUyRm1vZHVsYXItZG9jLWd1aWRlciUyMiklMEElMjMlMjAlRTUlOUMlQTglRTUlODglOUQlRTUlQTclOEIlRTUlOEMlOTYlRTYlOTclQjYlRTYlOUMlQUElRTUlODglOUIlRTUlQkIlQkElMEFhc3NlcnQlMjB0MmlfcGlwZWxpbmUuZ3VpZGVyJTIwaXMlMjBOb25lJTBBdDJpX3BpcGVsaW5lLmxvYWRfY29tcG9uZW50cygpJTBBJTIzJTIwJUU1JThBJUEwJUU4JUJEJUJEJUU0JUI4JUJBJTIwUEFHJTIwJUU1JUJDJTk1JUU1JUFGJUJDJUU1JTk5JUE4JTBBdDJpX3BpcGVsaW5lLmd1aWRlcg==",highlighted:`t2i_pipeline = t2i_blocks.init_pipeline(<span class="hljs-string">&quot;YiYiXu/modular-doc-guider&quot;</span>)
<span class="hljs-comment"># 在初始化时未创建</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"># 加载为 PAG 引导器</span>
t2i_pipeline.guider`,wrap:!1}}),H=new ss({props:{title:"更改引导器参数",local:"更改引导器参数",headingTag:"h2"}}),G=new As({props:{id:"switch",options:["create","update_components"],$$slots:{default:[Ks]},$$scope:{ctx:g}}}),L=new ss({props:{title:"上传自定义引导器",local:"上传自定义引导器",headingTag:"h2"}}),S=new b({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:[nl]},$$scope:{ctx:g}}}),K=new Ls({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/modular_diffusers/guiders.md"}}),{c(){l=h("meta"),d=r(),t=h("p"),c=r(),J(e.$$.fragment),n=r(),M=h("p"),M.innerHTML=Z,x=r(),w=h("p"),w.textContent=W,C=r(),J(u.$$.fragment),T=r(),V=h("p"),V.innerHTML=bs,ns=r(),I=h("p"),I.innerHTML=ws,es=r(),J(R.$$.fragment),as=r(),B=h("p"),B.innerHTML=Ws,ts=r(),J(k.$$.fragment),ps=r(),J(N.$$.fragment),is=r(),Q=h("p"),Q.innerHTML=Vs,cs=r(),J(A.$$.fragment),us=r(),J(Y.$$.fragment),rs=r(),v=h("p"),v.innerHTML=Cs,os=r(),J(E.$$.fragment),ds=r(),F=h("p"),F.innerHTML=ks,Ms=r(),J(q.$$.fragment),Js=r(),J(H.$$.fragment),ms=r(),z=h("p"),z.innerHTML=Gs,js=r(),J(G.$$.fragment),fs=r(),J(L.$$.fragment),Us=r(),D=h("p"),D.innerHTML=Xs,ys=r(),J(S.$$.fragment),hs=r(),P=h("p"),P.innerHTML=xs,$s=r(),J(X.$$.fragment),gs=r(),J(K.$$.fragment),Ts=r(),O=h("p"),this.h()},l(s){const a=Hs("svelte-u9bgzb",document.head);l=$(a,"META",{name:!0,content:!0}),a.forEach(p),d=o(s),t=$(s,"P",{}),Ns(t).forEach(p),c=o(s),m(e.$$.fragment,s),n=o(s),M=$(s,"P",{"data-svelte-h":!0}),_(M)!=="svelte-1iwhoj0"&&(M.innerHTML=Z),x=o(s),w=$(s,"P",{"data-svelte-h":!0}),_(w)!=="svelte-3z0omg"&&(w.textContent=W),C=o(s),m(u.$$.fragment,s),T=o(s),V=$(s,"P",{"data-svelte-h":!0}),_(V)!=="svelte-1ku6bpr"&&(V.innerHTML=bs),ns=o(s),I=$(s,"P",{"data-svelte-h":!0}),_(I)!=="svelte-19hxoke"&&(I.innerHTML=ws),es=o(s),m(R.$$.fragment,s),as=o(s),B=$(s,"P",{"data-svelte-h":!0}),_(B)!=="svelte-10xevcx"&&(B.innerHTML=Ws),ts=o(s),m(k.$$.fragment,s),ps=o(s),m(N.$$.fragment,s),is=o(s),Q=$(s,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-1mmyg0a"&&(Q.innerHTML=Vs),cs=o(s),m(A.$$.fragment,s),us=o(s),m(Y.$$.fragment,s),rs=o(s),v=$(s,"P",{"data-svelte-h":!0}),_(v)!=="svelte-egn8rj"&&(v.innerHTML=Cs),os=o(s),m(E.$$.fragment,s),ds=o(s),F=$(s,"P",{"data-svelte-h":!0}),_(F)!=="svelte-s65gxe"&&(F.innerHTML=ks),Ms=o(s),m(q.$$.fragment,s),Js=o(s),m(H.$$.fragment,s),ms=o(s),z=$(s,"P",{"data-svelte-h":!0}),_(z)!=="svelte-zwnbgd"&&(z.innerHTML=Gs),js=o(s),m(G.$$.fragment,s),fs=o(s),m(L.$$.fragment,s),Us=o(s),D=$(s,"P",{"data-svelte-h":!0}),_(D)!=="svelte-1o7fr7l"&&(D.innerHTML=Xs),ys=o(s),m(S.$$.fragment,s),hs=o(s),P=$(s,"P",{"data-svelte-h":!0}),_(P)!=="svelte-wbgo9d"&&(P.innerHTML=xs),$s=o(s),m(X.$$.fragment,s),gs=o(s),m(K.$$.fragment,s),Ts=o(s),O=$(s,"P",{}),Ns(O).forEach(p),this.h()},h(){Qs(l,"name","hf:doc:metadata"),Qs(l,"content",al)},m(s,a){zs(document.head,l),i(s,d,a),i(s,t,a),i(s,c,a),j(e,s,a),i(s,n,a),i(s,M,a),i(s,x,a),i(s,w,a),i(s,C,a),j(u,s,a),i(s,T,a),i(s,V,a),i(s,ns,a),i(s,I,a),i(s,es,a),j(R,s,a),i(s,as,a),i(s,B,a),i(s,ts,a),j(k,s,a),i(s,ps,a),j(N,s,a),i(s,is,a),i(s,Q,a),i(s,cs,a),j(A,s,a),i(s,us,a),j(Y,s,a),i(s,rs,a),i(s,v,a),i(s,os,a),j(E,s,a),i(s,ds,a),i(s,F,a),i(s,Ms,a),j(q,s,a),i(s,Js,a),j(H,s,a),i(s,ms,a),i(s,z,a),i(s,js,a),j(G,s,a),i(s,fs,a),j(L,s,a),i(s,Us,a),i(s,D,a),i(s,ys,a),j(S,s,a),i(s,hs,a),i(s,P,a),i(s,$s,a),j(X,s,a),i(s,gs,a),j(K,s,a),i(s,Ts,a),i(s,O,a),Zs=!0},p(s,[a]){const Is={};a&2&&(Is.$$scope={dirty:a,ctx:s}),k.$set(Is);const Rs={};a&2&&(Rs.$$scope={dirty:a,ctx:s}),G.$set(Rs);const Bs={};a&2&&(Bs.$$scope={dirty:a,ctx:s}),X.$set(Bs)},i(s){Zs||(f(e.$$.fragment,s),f(u.$$.fragment,s),f(R.$$.fragment,s),f(k.$$.fragment,s),f(N.$$.fragment,s),f(A.$$.fragment,s),f(Y.$$.fragment,s),f(E.$$.fragment,s),f(q.$$.fragment,s),f(H.$$.fragment,s),f(G.$$.fragment,s),f(L.$$.fragment,s),f(S.$$.fragment,s),f(X.$$.fragment,s),f(K.$$.fragment,s),Zs=!0)},o(s){U(e.$$.fragment,s),U(u.$$.fragment,s),U(R.$$.fragment,s),U(k.$$.fragment,s),U(N.$$.fragment,s),U(A.$$.fragment,s),U(Y.$$.fragment,s),U(E.$$.fragment,s),U(q.$$.fragment,s),U(H.$$.fragment,s),U(G.$$.fragment,s),U(L.$$.fragment,s),U(S.$$.fragment,s),U(X.$$.fragment,s),U(K.$$.fragment,s),Zs=!1},d(s){s&&(p(d),p(t),p(c),p(n),p(M),p(x),p(w),p(C),p(T),p(V),p(ns),p(I),p(es),p(as),p(B),p(ts),p(ps),p(is),p(Q),p(cs),p(us),p(rs),p(v),p(os),p(ds),p(F),p(Ms),p(Js),p(ms),p(z),p(js),p(fs),p(Us),p(D),p(ys),p(hs),p(P),p($s),p(gs),p(Ts),p(O)),p(l),y(e,s),y(u,s),y(R,s),y(k,s),y(N,s),y(A,s),y(Y,s),y(E,s),y(q,s),y(H,s),y(G,s),y(L,s),y(S,s),y(X,s),y(K,s)}}}const al='{"title":"引导器","local":"引导器","sections":[{"title":"切换引导器","local":"切换引导器","sections":[],"depth":2},{"title":"加载自定义引导器","local":"加载自定义引导器","sections":[],"depth":2},{"title":"更改引导器参数","local":"更改引导器参数","sections":[],"depth":2},{"title":"上传自定义引导器","local":"上传自定义引导器","sections":[],"depth":2}],"depth":1}';function tl(g){return Es(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class dl extends Fs{constructor(l){super(),qs(this,l,tl,el,vs,{})}}export{dl as component};
