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