import{s as gt,n as ht,o as ct}from"../chunks/scheduler.e4ff9b64.js";import{S as bt,i as xt,e as n,s,c as M,h as _t,a as o,d as l,b as a,f as dt,g as L,j as r,k as mt,l as $t,m as i,n as J,t as H,o as U,p as B}from"../chunks/index.09f1bca0.js";import{C as wt,H as pt,E as Ct}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.dde31fc2.js";import{C as ut}from"../chunks/CodeBlock.54e44b16.js";function vt(K){let f,I,P,R,d,k,m,E,p,tt='🤗 Diffusers 提供了一系列训练脚本供您训练自己的diffusion模型。您可以在 <a href="https://github.com/huggingface/diffusers/tree/main/examples" rel="nofollow">diffusers/examples</a> 找到所有训练脚本。',F,u,et="每个训练脚本具有以下特点：",z,g,lt="<li><strong>独立完整</strong>：训练脚本不依赖任何本地文件，所有运行所需的包都通过 <code>requirements.txt</code> 文件安装</li> <li><strong>易于调整</strong>：这些脚本是针对特定任务的训练示例，并不能开箱即用地适用于所有训练场景。您可能需要根据具体用例调整脚本。为此，我们完全公开了数据预处理代码和训练循环，方便您进行修改</li> <li><strong>新手友好</strong>：脚本设计注重易懂性和入门友好性，而非包含最新最优方法以获得最具竞争力的结果。我们有意省略了过于复杂的训练方法</li> <li><strong>单一用途</strong>：每个脚本仅针对一个任务设计，确保代码可读性和可理解性</li>",W,h,it="当前提供的训练脚本包括：",X,c,st='<thead><tr><th>训练类型</th> <th>支持SDXL</th> <th>支持LoRA</th> <th>支持Flax</th></tr></thead> <tbody><tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/unconditional_image_generation" rel="nofollow">unconditional image generation</a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/training_example.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a></td> <td></td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/text_to_image" rel="nofollow">text-to-image</a></td> <td>👍</td> <td>👍</td> <td>👍</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion" rel="nofollow">textual inversion</a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_textual_inversion_training.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a></td> <td></td> <td></td> <td>👍</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/dreambooth" rel="nofollow">DreamBooth</a> <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_dreambooth_training.ipynb" rel="nofollow"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a></td> <td>👍</td> <td>👍</td> <td>👍</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/controlnet" rel="nofollow">ControlNet</a></td> <td>👍</td> <td></td> <td>👍</td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/instruct_pix2pix" rel="nofollow">InstructPix2Pix</a></td> <td>👍</td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/custom_diffusion" rel="nofollow">Custom Diffusion</a></td> <td></td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/t2i_adapter" rel="nofollow">T2I-Adapters</a></td> <td>👍</td> <td></td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/kandinsky2_2/text_to_image" rel="nofollow">Kandinsky 2.2</a></td> <td></td> <td>👍</td> <td></td></tr> <tr><td><a href="https://github.com/huggingface/diffusers/tree/main/examples/wuerstchen/text_to_image" rel="nofollow">Wuerstchen</a></td> <td></td> <td>👍</td> <td></td></tr></tbody>',Z,b,at='这些示例处于<strong>积极维护</strong>状态，如果遇到问题请随时提交issue。如果您认为应该添加其他训练示例，欢迎创建<a href="https://github.com/huggingface/diffusers/issues/new?assignees=&amp;labels=&amp;template=feature_request.md&amp;title=" rel="nofollow">功能请求</a>与我们讨论，我们将评估其是否符合独立完整、易于调整、新手友好和单一用途的标准。',S,x,D,_,nt="请按照以下步骤在新虚拟环境中从源码安装库，确保能成功运行最新版本的示例脚本：",V,$,q,w,ot='然后进入具体训练脚本目录（例如<a href="https://github.com/huggingface/diffusers/tree/main/examples/dreambooth" rel="nofollow">DreamBooth</a>），安装对应的<code>requirements.txt</code>文件。部分脚本针对SDXL、LoRA或Flax有特定要求文件，使用时请确保安装对应文件。',G,C,A,v,rt="为加速训练并降低内存消耗，我们建议：",N,T,ft='<li>使用PyTorch 2.0或更高版本，自动启用<a href="../optimization/fp16#scaled-dot-product-attention">缩放点积注意力</a>（无需修改训练代码）</li> <li>安装<a href="../optimization/xformers">xFormers</a>以启用内存高效注意力机制</li>',Y,y,O,j,Q;return d=new wt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),m=new pt({props:{title:"概述",local:"概述",headingTag:"h1"}}),x=new pt({props:{title:"安装",local:"安装",headingTag:"h2"}}),$=new ut({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install .`,wrap:!1}}),C=new ut({props:{code:"Y2QlMjBleGFtcGxlcyUyRmRyZWFtYm9vdGglMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0JTBBJTIzJTIwJUU1JUE2JTgyJUU5JTlDJTgwJUU3JTk0JUE4RHJlYW1Cb290aCVFOCVBRSVBRCVFNyVCQiU4M1NEWEwlMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHNfc2R4bC50eHQ=",highlighted:`<span class="hljs-built_in">cd</span> examples/dreambooth
pip install -r requirements.txt
<span class="hljs-comment"># 如需用DreamBooth训练SDXL</span>
pip install -r requirements_sdxl.txt`,wrap:!1}}),y=new Ct({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/training/overview.md"}}),{c(){f=n("meta"),I=s(),P=n("p"),R=s(),M(d.$$.fragment),k=s(),M(m.$$.fragment),E=s(),p=n("p"),p.innerHTML=tt,F=s(),u=n("p"),u.textContent=et,z=s(),g=n("ul"),g.innerHTML=lt,W=s(),h=n("p"),h.textContent=it,X=s(),c=n("table"),c.innerHTML=st,Z=s(),b=n("p"),b.innerHTML=at,S=s(),M(x.$$.fragment),D=s(),_=n("p"),_.textContent=nt,V=s(),M($.$$.fragment),q=s(),w=n("p"),w.innerHTML=ot,G=s(),M(C.$$.fragment),A=s(),v=n("p"),v.textContent=rt,N=s(),T=n("ul"),T.innerHTML=ft,Y=s(),M(y.$$.fragment),O=s(),j=n("p"),this.h()},l(t){const e=_t("svelte-u9bgzb",document.head);f=o(e,"META",{name:!0,content:!0}),e.forEach(l),I=a(t),P=o(t,"P",{}),dt(P).forEach(l),R=a(t),L(d.$$.fragment,t),k=a(t),L(m.$$.fragment,t),E=a(t),p=o(t,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1neo90y"&&(p.innerHTML=tt),F=a(t),u=o(t,"P",{"data-svelte-h":!0}),r(u)!=="svelte-5pvswp"&&(u.textContent=et),z=a(t),g=o(t,"UL",{"data-svelte-h":!0}),r(g)!=="svelte-xoqjgx"&&(g.innerHTML=lt),W=a(t),h=o(t,"P",{"data-svelte-h":!0}),r(h)!=="svelte-14p5r7u"&&(h.textContent=it),X=a(t),c=o(t,"TABLE",{"data-svelte-h":!0}),r(c)!=="svelte-h8xzd3"&&(c.innerHTML=st),Z=a(t),b=o(t,"P",{"data-svelte-h":!0}),r(b)!=="svelte-rleprd"&&(b.innerHTML=at),S=a(t),L(x.$$.fragment,t),D=a(t),_=o(t,"P",{"data-svelte-h":!0}),r(_)!=="svelte-tu9bzc"&&(_.textContent=nt),V=a(t),L($.$$.fragment,t),q=a(t),w=o(t,"P",{"data-svelte-h":!0}),r(w)!=="svelte-p14hlq"&&(w.innerHTML=ot),G=a(t),L(C.$$.fragment,t),A=a(t),v=o(t,"P",{"data-svelte-h":!0}),r(v)!=="svelte-hdwswn"&&(v.textContent=rt),N=a(t),T=o(t,"UL",{"data-svelte-h":!0}),r(T)!=="svelte-18es2ri"&&(T.innerHTML=ft),Y=a(t),L(y.$$.fragment,t),O=a(t),j=o(t,"P",{}),dt(j).forEach(l),this.h()},h(){mt(f,"name","hf:doc:metadata"),mt(f,"content",Tt)},m(t,e){$t(document.head,f),i(t,I,e),i(t,P,e),i(t,R,e),J(d,t,e),i(t,k,e),J(m,t,e),i(t,E,e),i(t,p,e),i(t,F,e),i(t,u,e),i(t,z,e),i(t,g,e),i(t,W,e),i(t,h,e),i(t,X,e),i(t,c,e),i(t,Z,e),i(t,b,e),i(t,S,e),J(x,t,e),i(t,D,e),i(t,_,e),i(t,V,e),J($,t,e),i(t,q,e),i(t,w,e),i(t,G,e),J(C,t,e),i(t,A,e),i(t,v,e),i(t,N,e),i(t,T,e),i(t,Y,e),J(y,t,e),i(t,O,e),i(t,j,e),Q=!0},p:ht,i(t){Q||(H(d.$$.fragment,t),H(m.$$.fragment,t),H(x.$$.fragment,t),H($.$$.fragment,t),H(C.$$.fragment,t),H(y.$$.fragment,t),Q=!0)},o(t){U(d.$$.fragment,t),U(m.$$.fragment,t),U(x.$$.fragment,t),U($.$$.fragment,t),U(C.$$.fragment,t),U(y.$$.fragment,t),Q=!1},d(t){t&&(l(I),l(P),l(R),l(k),l(E),l(p),l(F),l(u),l(z),l(g),l(W),l(h),l(X),l(c),l(Z),l(b),l(S),l(D),l(_),l(V),l(q),l(w),l(G),l(A),l(v),l(N),l(T),l(Y),l(O),l(j)),l(f),B(d,t),B(m,t),B(x,t),B($,t),B(C,t),B(y,t)}}}const Tt='{"title":"概述","local":"概述","sections":[{"title":"安装","local":"安装","sections":[],"depth":2}],"depth":1}';function yt(K){return ct(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ut extends bt{constructor(f){super(),xt(this,f,yt,vt,gt,{})}}export{Ut as component};
