import{s as Rs,o as Gs,n as N}from"../chunks/scheduler.5c93273d.js";import{S as Is,i as Vs,g as d,s as o,r as u,A as Xs,h as J,f as s,c as r,j as Zs,u as T,x as U,k as Cs,y as Bs,a,v as y,d as b,t as h,w}from"../chunks/index.e43dd92b.js";import{T as Vl}from"../chunks/Tip.1cbfe904.js";import{C as R}from"../chunks/CodeBlock.6896320e.js";import{H as x,E as Ns}from"../chunks/getInferenceSnippets.d410b42d.js";import{H as rt,a as F}from"../chunks/HfOption.d50154c3.js";function Ws(j){let t,f;return t=new R({props:{code:"Y2QlMjBleGFtcGxlcyUyRmRyZWFtYm9vdGglMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/dreambooth
pip install -r requirements.txt`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){T(t.$$.fragment,n)},m(n,M){y(t,n,M),f=!0},p:N,i(n){f||(b(t.$$.fragment,n),f=!0)},o(n){h(t.$$.fragment,n),f=!1},d(n){w(t,n)}}}function vs(j){let t,f;return t=new R({props:{code:"Y2QlMjBleGFtcGxlcyUyRmRyZWFtYm9vdGglMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHNfZmxheC50eHQ=",highlighted:`<span class="hljs-built_in">cd</span> examples/dreambooth
pip install -r requirements_flax.txt`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){T(t.$$.fragment,n)},m(n,M){y(t,n,M),f=!0},p:N,i(n){f||(b(t.$$.fragment,n),f=!0)},o(n){h(t.$$.fragment,n),f=!1},d(n){w(t,n)}}}function Fs(j){let t,f,n,M;return t=new F({props:{id:"installation",option:"PyTorch",$$slots:{default:[Ws]},$$scope:{ctx:j}}}),n=new F({props:{id:"installation",option:"Flax",$$slots:{default:[vs]},$$scope:{ctx:j}}}),{c(){u(t.$$.fragment),f=o(),u(n.$$.fragment)},l(p){T(t.$$.fragment,p),f=r(p),T(n.$$.fragment,p)},m(p,i){y(t,p,i),a(p,f,i),y(n,p,i),M=!0},p(p,i){const c={};i&2&&(c.$$scope={dirty:i,ctx:p}),t.$set(c);const $={};i&2&&($.$$scope={dirty:i,ctx:p}),n.$set($)},i(p){M||(b(t.$$.fragment,p),b(n.$$.fragment,p),M=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),M=!1},d(p){p&&s(f),w(t,p),w(n,p)}}}function Es(j){let t,f='🤗 Accelerate 是一个库，用于帮助您在多个 GPU/TPU 上或使用混合精度进行训练。它会根据您的硬件和环境自动配置训练设置。查看 🤗 Accelerate <a href="https://huggingface.co/docs/accelerate/quicktour" rel="nofollow">快速入门</a> 以了解更多信息。';return{c(){t=d("p"),t.innerHTML=f},l(n){t=J(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-otsbtw"&&(t.innerHTML=f)},m(n,M){a(n,t,M)},p:N,d(n){n&&s(t)}}}function xs(j){let t,f='以下部分重点介绍了训练脚本中对于理解如何修改它很重要的部分，但并未详细涵盖脚本的每个方面。如果您有兴趣了解更多，请随时阅读<a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py" rel="nofollow">脚本</a>，并告诉我们如果您有任何问题或疑虑。';return{c(){t=d("p"),t.innerHTML=f},l(n){t=J(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-pvjois"&&(t.innerHTML=f)},m(n,M){a(n,t,M)},p:N,d(n){n&&s(t)}}}function ks(j){let t,f='DreamBooth 对训练超参数非常敏感，容易过拟合。阅读 <a href="https://huggingface.co/blog/dreambooth" rel="nofollow">使用 🧨 Diffusers 训练 Stable Diffusion 与 Dreambooth</a> 博客文章，了解针对不同主题的推荐设置，以帮助您选择合适的超参数。';return{c(){t=d("p"),t.innerHTML=f},l(n){t=J(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1a0qioh"&&(t.innerHTML=f)},m(n,M){a(n,t,M)},p:N,d(n){n&&s(t)}}}function Ys(j){let t,f="在 16GB GPU 上，您可以使用 bitsandbytes 8 位优化器和梯度检查点来帮助训练 DreamBooth 模型。安装 bitsandbytes：",n,M,p,i,c="然后，将以下参数添加到您的训练命令中：",$,m,_;return M=new R({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcw==",highlighted:"pip install bitsandbytes",wrap:!1}}),m=new R({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUM=",highlighted:`accelerate launch train_dreambooth.py \\
  --gradient_checkpointing \\
  --use_8bit_adam \\`,wrap:!1}}),{c(){t=d("p"),t.textContent=f,n=o(),u(M.$$.fragment),p=o(),i=d("p"),i.textContent=c,$=o(),u(m.$$.fragment)},l(Z){t=J(Z,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1tref92"&&(t.textContent=f),n=r(Z),T(M.$$.fragment,Z),p=r(Z),i=J(Z,"P",{"data-svelte-h":!0}),U(i)!=="svelte-13tkjff"&&(i.textContent=c),$=r(Z),T(m.$$.fragment,Z)},m(Z,G){a(Z,t,G),a(Z,n,G),y(M,Z,G),a(Z,p,G),a(Z,i,G),a(Z,$,G),y(m,Z,G),_=!0},p:N,i(Z){_||(b(M.$$.fragment,Z),b(m.$$.fragment,Z),_=!0)},o(Z){h(M.$$.fragment,Z),h(m.$$.fragment,Z),_=!1},d(Z){Z&&(s(t),s(n),s(p),s(i),s($)),w(M,Z),w(m,Z)}}}function As(j){let t,f="在 12GB GPU 上，您需要 bitsandbytes 8 位优化器、梯度检查点、xFormers，并将梯度设置为 <code>None</code> 而不是零以减少内存使用。",n,M,p;return M=new R({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUyMCU1QyUwQSUyMCUyMC0tc2V0X2dyYWRzX3RvX25vbmUlMjAlNUM=",highlighted:`accelerate launch train_dreambooth.py \\
  --use_8bit_adam \\
  --gradient_checkpointing \\
  --enable_xformers_memory_efficient_attention \\
  --set_grads_to_none \\`,wrap:!1}}),{c(){t=d("p"),t.innerHTML=f,n=o(),u(M.$$.fragment)},l(i){t=J(i,"P",{"data-svelte-h":!0}),U(t)!=="svelte-iq1zeg"&&(t.innerHTML=f),n=r(i),T(M.$$.fragment,i)},m(i,c){a(i,t,c),a(i,n,c),y(M,i,c),p=!0},p:N,i(i){p||(b(M.$$.fragment,i),p=!0)},o(i){h(M.$$.fragment,i),p=!1},d(i){i&&(s(t),s(n)),w(M,i)}}}function Ss(j){let t,f='在 8GB GPU 上，您需要 <a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a> 将一些张量从 vRAM 卸载到 CPU 或 NVME，以便在更少的 GPU 内存下进行训练。',n,M,p="运行以下命令来配置您的 🤗 Accelerate 环境：",i,c,$,m,_='在配置过程中，确认您想使用 DeepSpeed。现在，通过结合 DeepSpeed 阶段 2、fp16 混合精度以及将模型参数和优化器状态卸载到 CPU，应该可以在低于 8GB vRAM 的情况下进行训练。缺点是这需要更多的系统 RAM（约 25 GB）。有关更多配置选项，请参阅 <a href="https://huggingface.co/docs/accelerate/usage_guides/deepspeed" rel="nofollow">DeepSpeed 文档</a>。',Z,G,V='您还应将默认的 Adam 优化器更改为 DeepSpeed 的优化版本 <a href="https://deepspeed.readthedocs.io/en/latest/optimizers.html#adam-cpu" rel="nofollow"><code>deepspeed.ops.adam.DeepSpeedCPUAdam</code></a> 以获得显著的速度提升。启用 <code>DeepSpeedCPUAdam</code> 要求您的系统 CUDA 工具链版本与 PyTorch 安装的版本相同。',v,B,X="目前，bitsandbytes 8 位优化器似乎与 DeepSpeed 不兼容。",E,g,I="就是这样！您不需要向训练命令添加任何额外参数。",k;return c=new R({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),{c(){t=d("p"),t.innerHTML=f,n=o(),M=d("p"),M.textContent=p,i=o(),u(c.$$.fragment),$=o(),m=d("p"),m.innerHTML=_,Z=o(),G=d("p"),G.innerHTML=V,v=o(),B=d("p"),B.textContent=X,E=o(),g=d("p"),g.textContent=I},l(C){t=J(C,"P",{"data-svelte-h":!0}),U(t)!=="svelte-jkd0g3"&&(t.innerHTML=f),n=r(C),M=J(C,"P",{"data-svelte-h":!0}),U(M)!=="svelte-axex8f"&&(M.textContent=p),i=r(C),T(c.$$.fragment,C),$=r(C),m=J(C,"P",{"data-svelte-h":!0}),U(m)!=="svelte-yd1wd8"&&(m.innerHTML=_),Z=r(C),G=J(C,"P",{"data-svelte-h":!0}),U(G)!=="svelte-1fv4fvf"&&(G.innerHTML=V),v=r(C),B=J(C,"P",{"data-svelte-h":!0}),U(B)!=="svelte-eh5hb5"&&(B.textContent=X),E=r(C),g=J(C,"P",{"data-svelte-h":!0}),U(g)!=="svelte-15aa0ut"&&(g.textContent=I)},m(C,W){a(C,t,W),a(C,n,W),a(C,M,W),a(C,i,W),y(c,C,W),a(C,$,W),a(C,m,W),a(C,Z,W),a(C,G,W),a(C,v,W),a(C,B,W),a(C,E,W),a(C,g,W),k=!0},p:N,i(C){k||(b(c.$$.fragment,C),k=!0)},o(C){h(c.$$.fragment,C),k=!1},d(C){C&&(s(t),s(n),s(M),s(i),s($),s(m),s(Z),s(G),s(v),s(B),s(E),s(g)),w(c,C)}}}function Ls(j){let t,f,n,M,p,i;return t=new F({props:{id:"gpu-select",option:"16GB",$$slots:{default:[Ys]},$$scope:{ctx:j}}}),n=new F({props:{id:"gpu-select",option:"12GB",$$slots:{default:[As]},$$scope:{ctx:j}}}),p=new F({props:{id:"gpu-select",option:"8GB",$$slots:{default:[Ss]},$$scope:{ctx:j}}}),{c(){u(t.$$.fragment),f=o(),u(n.$$.fragment),M=o(),u(p.$$.fragment)},l(c){T(t.$$.fragment,c),f=r(c),T(n.$$.fragment,c),M=r(c),T(p.$$.fragment,c)},m(c,$){y(t,c,$),a(c,f,$),y(n,c,$),a(c,M,$),y(p,c,$),i=!0},p(c,$){const m={};$&2&&(m.$$scope={dirty:$,ctx:c}),t.$set(m);const _={};$&2&&(_.$$scope={dirty:$,ctx:c}),n.$set(_);const Z={};$&2&&(Z.$$scope={dirty:$,ctx:c}),p.$set(Z)},i(c){i||(b(t.$$.fragment,c),b(n.$$.fragment,c),b(p.$$.fragment,c),i=!0)},o(c){h(t.$$.fragment,c),h(n.$$.fragment,c),h(p.$$.fragment,c),i=!1},d(c){c&&(s(f),s(M)),w(t,c),w(n,c),w(p,c)}}}function zs(j){let t,f;return t=new R({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMi4lMkZkb2clMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aF90b18lMEFzYXZlZF9tb2RlbCUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjB0cmFpbl9kcmVhbWJvb3RoLnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX2RhdGFfZGlyJTNEJTI0SU5TVEFOQ0VfRElSJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0QxJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNENWUtNiUyMCU1QyUwQSUyMCUyMC0tbHJfc2NoZWR1bGVyJTNEJTIyY29uc3RhbnQlMjIlMjAlNUMlMEElMjAlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDAlMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDQwMCUyMCU1QyUwQSUyMCUyMC0tcHVzaF90b19odWI=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;./dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_
saved_model&quot;</span>

accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=5e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --max_train_steps=400 \\
  --push_to_hub`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){T(t.$$.fragment,n)},m(n,M){y(t,n,M),f=!0},p:N,i(n){f||(b(t.$$.fragment,n),f=!0)},o(n){h(t.$$.fragment,n),f=!1},d(n){w(t,n)}}}function Qs(j){let t,f;return t=new R({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMmR1b25nbmElMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQtZmxheCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMi4lMkZkb2clMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aC10by1zYXZlLW1vZGVsJTIyJTBBJTBBcHl0aG9uJTIwdHJhaW5fZHJlYW1ib290aF9mbGF4LnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX2RhdGFfZGlyJTNEJTI0SU5TVEFOQ0VfRElSJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNENWUtNiUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNENDAwJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;duongna/stable-diffusion-v1-4-flax&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;./dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>

python train_dreambooth_flax.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --learning_rate=5e-6 \\
  --max_train_steps=400 \\
  --push_to_hub`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){T(t.$$.fragment,n)},m(n,M){y(t,n,M),f=!0},p:N,i(n){f||(b(t.$$.fragment,n),f=!0)},o(n){h(t.$$.fragment,n),f=!1},d(n){w(t,n)}}}function Ds(j){let t,f,n,M;return t=new F({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[zs]},$$scope:{ctx:j}}}),n=new F({props:{id:"training-inference",option:"Flax",$$slots:{default:[Qs]},$$scope:{ctx:j}}}),{c(){u(t.$$.fragment),f=o(),u(n.$$.fragment)},l(p){T(t.$$.fragment,p),f=r(p),T(n.$$.fragment,p)},m(p,i){y(t,p,i),a(p,f,i),y(n,p,i),M=!0},p(p,i){const c={};i&2&&(c.$$scope={dirty:i,ctx:p}),t.$set(c);const $={};i&2&&($.$$scope={dirty:i,ctx:p}),n.$set($)},i(p){M||(b(t.$$.fragment,p),b(n.$$.fragment,p),M=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),M=!1},d(p){p&&s(f),w(t,p),w(n,p)}}}function Hs(j){let t,f="等不及在训练完成前就尝试您的模型进行推理？🤭 请确保安装了最新版本的 🤗 Accelerate。",n,M,p;return M=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTJDJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ0xJUFRleHRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk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UzRDcuNSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyZG9nLWJ1Y2tldC5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, UNet2DConditionModel
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPTextModel
<span class="hljs-keyword">import</span> torch

unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">&quot;path/to/model/checkpoint-100/unet&quot;</span>)

<span class="hljs-comment"># 如果您使用了 \`--args.train_text_encoder\` 进行训练，请确保也加载文本编码器</span>
text_encoder = CLIPTextModel.from_pretrained(<span class="hljs-string">&quot;path/to/model/checkpoint-100/checkpoint-100/text_encoder&quot;</span>)

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, unet=unet, text_encoder=text_encoder, dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipeline(<span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span>, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){t=d("p"),t.textContent=f,n=o(),u(M.$$.fragment)},l(i){t=J(i,"P",{"data-svelte-h":!0}),U(t)!=="svelte-hc92np"&&(t.textContent=f),n=r(i),T(M.$$.fragment,i)},m(i,c){a(i,t,c),a(i,n,c),y(M,i,c),p=!0},p:N,i(i){p||(b(M.$$.fragment,i),p=!0)},o(i){h(M.$$.fragment,i),p=!1},d(i){i&&(s(t),s(n)),w(M,i)}}}function qs(j){let t,f;return t=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJwYXRoX3RvX3NhdmVkX21vZGVsJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKCUyMkElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIwaW4lMjBhJTIwYnVja2V0JTIyJTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q3LjUpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmRvZy1idWNrZXQucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;path_to_saved_model&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = pipeline(<span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span>, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){T(t.$$.fragment,n)},m(n,M){y(t,n,M),f=!0},p:N,i(n){f||(b(t.$$.fragment,n),f=!0)},o(n){h(t.$$.fragment,n),f=!1},d(n){w(t,n)}}}function Ps(j){let t,f;return t=new R({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsY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ZXMlMjAlM0QlMjBwaXBlbGluZShwcm9tcHRfaWRzJTJDJTIwcGFyYW1zJTJDJTIwcHJuZ19zZWVkJTJDJTIwbnVtX2luZmVyZW5jZV8lMEFzdGVwcyUyQyUyMGppdCUzRFRydWUpLmltYWdlcyUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lLm51bXB5X3RvX3BpbChucC5hc2FycmF5KGltYWdlcy5yZXNoYXBlKChudW1fc2FtcGxlcyUyQyklMjAlMkIlMjBpbWFnZXMuc2hhcGUlNUItMyUzQSU1RCkpKSUwQWltYWdlLnNhdmUoJTIyZG9nLWJ1Y2tldC5wbmclMjIp",highlighted:`<span class="hljs-keyword">import</span> jax
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> flax.jax_utils <span class="hljs-keyword">import</span> replicate
<span class="hljs-keyword">from</span> flax.training.common_utils <span class="hljs-keyword">import</span> shard
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxStableDiffusionPipeline

pipeline, params = FlaxStableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;path-to-your-trained-model&quot;</span>, dtype=jax.numpy.bfloat16)

prompt = <span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span>
prng_seed = jax.random.PRNGKey(<span class="hljs-number">0</span>)
num_inference_steps = <span class="hljs-number">50</span>

num_samples = jax.device_count()
prompt = num_samples * [prompt]
prompt_ids = pipeline.prepare_inputs(prompt)

<span class="hljs-comment"># 分片输入和随机数生成器</span>
params = replicate(params)
prng_seed = jax.random.split(prng_seed, jax.device_count())
prompt_ids = shard(prompt_ids)

images = pipeline(prompt_ids, params, prng_seed, num_inference_
steps, jit=<span class="hljs-literal">True</span>).images
images = pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) + images.shape[-<span class="hljs-number">3</span>:])))
image.save(<span class="hljs-string">&quot;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){u(t.$$.fragment)},l(n){T(t.$$.fragment,n)},m(n,M){y(t,n,M),f=!0},p:N,i(n){f||(b(t.$$.fragment,n),f=!0)},o(n){h(t.$$.fragment,n),f=!1},d(n){w(t,n)}}}function Os(j){let t,f,n,M;return t=new F({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[qs]},$$scope:{ctx:j}}}),n=new F({props:{id:"training-inference",option:"Flax",$$slots:{default:[Ps]},$$scope:{ctx:j}}}),{c(){u(t.$$.fragment),f=o(),u(n.$$.fragment)},l(p){T(t.$$.fragment,p),f=r(p),T(n.$$.fragment,p)},m(p,i){y(t,p,i),a(p,f,i),y(n,p,i),M=!0},p(p,i){const c={};i&2&&(c.$$scope={dirty:i,ctx:p}),t.$set(c);const $={};i&2&&($.$$scope={dirty:i,ctx:p}),n.$set($)},i(p){M||(b(t.$$.fragment,p),b(n.$$.fragment,p),M=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),M=!1},d(p){p&&s(f),w(t,p),w(n,p)}}}function Ks(j){let t,f="使用 LoRA 和 DreamBooth 训练 DeepFloyd IF 的第 1 阶段需要约 28GB 内存。",n,M,p;return M=new R({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkRlZXBGbG95ZCUyRklGLUktWEwtdjEuMCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMmRvZyUyMiUwQWV4cG9ydCUyME9VVFBVVF9ESVIlM0QlMjJkcmVhbWJvb3RoX2RvZ19sb3JhJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGhfbG9yYS5weSUyMCU1QyUwQSUyMCUyMC0tcmVwb3J0X3RvJTIwd2FuZGIlMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfZGF0YV9kaXIlM0QlMjRJTlNUQU5DRV9ESVIlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9wcm9tcHQlM0QlMjJhJTIwc2tzJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENjQlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0Q0JTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0QxJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNENWUtNiUyMCU1QyUwQSUyMCUyMC0tc2NhbGVfbHIlMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDEyMDAlMjAlNUMlMEElMjAlMjAtLXZhbGlkYXRpb25fcHJvbXB0JTNEJTIyYSUyMHNrcyUyMGRvZyUyMiUyMCU1QyUwQSUyMCUyMC0tdmFsaWRhdGlvbl9lcG9jaHMlM0QyNSUyMCU1QyUwQSUyMCUyMC0tY2hlY2twb2ludGluZ19zdGVwcyUzRDEwMCUyMCU1QyUwQSUyMCUyMC0tcHJlX2NvbXB1dGVfdGV4dF9lbWJlZGRpbmdzJTIwJTVDJTBBJTIwJTIwLS10b2tlbml6ZXJfbWF4X2xlbmd0aCUzRDc3JTIwJTVDJTBBJTIwJTIwLS10ZXh0X2VuY29kZXJfdXNlX2F0dGVudGlvbl9tYXNr",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;dreambooth_dog_lora&quot;</span>

accelerate launch train_dreambooth_lora.py \\
  --report_to wandb \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a sks dog&quot;</span> \\
  --resolution=64 \\
  --train_batch_size=4 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=5e-6 \\
  --scale_lr \\
  --max_train_steps=1200 \\
  --validation_prompt=<span class="hljs-string">&quot;a sks dog&quot;</span> \\
  --validation_epochs=25 \\
  --checkpointing_steps=100 \\
  --pre_compute_text_embeddings \\
  --tokenizer_max_length=77 \\
  --text_encoder_use_attention_mask`,wrap:!1}}),{c(){t=d("p"),t.textContent=f,n=o(),u(M.$$.fragment)},l(i){t=J(i,"P",{"data-svelte-h":!0}),U(t)!=="svelte-c5ggda"&&(t.textContent=f),n=r(i),T(M.$$.fragment,i)},m(i,c){a(i,t,c),a(i,n,c),y(M,i,c),p=!0},p:N,i(i){p||(b(M.$$.fragment,i),p=!0)},o(i){h(M.$$.fragment,i),p=!1},d(i){i&&(s(t),s(n)),w(M,i)}}}function ea(j){let t,f="对于使用 LoRA 和 DreamBooth 的 DeepFloyd IF 第 2 阶段，请注意这些参数：",n,M,p="<li><code>--validation_images</code>，验证期间用于上采样的图像</li> <li><code>--class_labels_conditioning=timesteps</code>，根据需要额外条件化 UNet，如第 2 阶段中所需</li> <li><code>--learning_rate=1e-6</code>，与第 1 阶段相比使用较低的学习率</li> <li><code>--resolution=256</code>，上采样器的预期分辨率</li>",i,c,$;return c=new R({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMmRvZyUyMiUwQWV4cG9ydCUyME9VVFBVVF9ESVIlM0QlMjJkcmVhbWJvb3RoX2RvZ191cHNjYWxlJTIyJTBBZXhwb3J0JTIwVkFMSURBVElPTl9JTUFHRVMlM0QlMjJkb2dfZG93bnNpemVk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XBzJTNENTAwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wcmVfY29tcHV0ZV90ZXh0X2VtYmVkZGluZ3MlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRva2VuaXplcl9tYXhfbGVuZ3RoJTNENzclMjAlNUMlMEElMjAlMjAlMjAlMjAtLXRleHRfZW5jb2Rlcl91c2VfYXR0ZW50aW9uX21hc2slMjAlNUMlMEElMjAlMjAlMjAlMjAtLXZhbGlkYXRpb25faW1hZ2VzJTIwJTI0VkFMSURBVElPTl9JTUFHRVMlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWNsYXNzX2xhYmVsc19jb25kaXRpb25pbmclM0R0aW1lc3RlcHM=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;dreambooth_dog_upscale&quot;</span>
<span class="hljs-built_in">export</span> VALIDATION_IMAGES=<span class="hljs-string">&quot;dog_downsized/image_1.png dog_downsized/image_2.png dog_downsized/image_3.png dog_downsized/image_4.png&quot;</span>

python train_dreambooth_lora.py \\
    --report_to wandb \\
    --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
    --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
    --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
    --instance_prompt=<span class="hljs-string">&quot;a sks dog&quot;</span> \\
    --resolution=256 \\
    --train_batch_size=4 \\
    --gradient_accumulation_steps=1 \\
    --learning_rate=1e-6 \\
    --max_train_steps=2000 \\
    --validation_prompt=<span class="hljs-string">&quot;a sks dog&quot;</span> \\
    --validation_epochs=100 \\
    --checkpointing_steps=500 \\
    --pre_compute_text_embeddings \\
    --tokenizer_max_length=77 \\
    --text_encoder_use_attention_mask \\
    --validation_images <span class="hljs-variable">$VALIDATION_IMAGES</span> \\
    --class_labels_conditioning=timesteps`,wrap:!1}}),{c(){t=d("p"),t.textContent=f,n=o(),M=d("ul"),M.innerHTML=p,i=o(),u(c.$$.fragment)},l(m){t=J(m,"P",{"data-svelte-h":!0}),U(t)!=="svelte-11ldul9"&&(t.textContent=f),n=r(m),M=J(m,"UL",{"data-svelte-h":!0}),U(M)!=="svelte-1ktyq6"&&(M.innerHTML=p),i=r(m),T(c.$$.fragment,m)},m(m,_){a(m,t,_),a(m,n,_),a(m,M,_),a(m,i,_),y(c,m,_),$=!0},p:N,i(m){$||(b(c.$$.fragment,m),$=!0)},o(m){h(c.$$.fragment,m),$=!1},d(m){m&&(s(t),s(n),s(M),s(i)),w(c,m)}}}function ta(j){let t,f="对于使用 DreamBooth 的 DeepFloyd IF 第 1 阶段，请注意这些参数：",n,M,p="<li><code>--skip_save_text_encoder</code>，跳过保存完整 T5 文本编码器与微调模型</li> <li><code>--use_8bit_adam</code>，使用 8 位 Adam 优化器以节省内存，因为</li>",i,c,$="优化器状态的大小在训练完整模型时",m,_,Z="<li><code>--learning_rate=1e-7</code>，对于完整模型训练应使用非常低的学习率，否则模型质量会下降（您可以使用更高的学习率和更大的批次大小）</li>",G,V,v="使用8位Adam和批次大小为4进行训练，完整模型可以在约48GB内存下训练。",B,X,E;return X=new R({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkRlZXBGbG95ZCUyRklGLUktWEwtdjEuMCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMmRvZyUyMiUwQWV4cG9ydCUyME9VVFBVVF9ESVIlM0QlMjJkcmVhbWJvb3RoX2lmJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCUyMCU1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built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;dreambooth_if&quot;</span>

accelerate launch train_dreambooth.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=64 \\
  --train_batch_size=4 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=1e-7 \\
  --max_train_steps=150 \\
  --validation_prompt <span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --validation_steps 25 \\
  --text_encoder_use_attention_mask \\
  --tokenizer_max_length 77 \\
  --pre_compute_text_embeddings \\
  --use_8bit_adam \\
  --set_grads_to_none \\
  --skip_save_text_encoder \\
  --push_to_hub`,wrap:!1}}),{c(){t=d("p"),t.textContent=f,n=o(),M=d("ul"),M.innerHTML=p,i=o(),c=d("p"),c.textContent=$,m=o(),_=d("ul"),_.innerHTML=Z,G=o(),V=d("p"),V.textContent=v,B=o(),u(X.$$.fragment)},l(g){t=J(g,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1lq2f7s"&&(t.textContent=f),n=r(g),M=J(g,"UL",{"data-svelte-h":!0}),U(M)!=="svelte-1ozc2pw"&&(M.innerHTML=p),i=r(g),c=J(g,"P",{"data-svelte-h":!0}),U(c)!=="svelte-8hl20r"&&(c.textContent=$),m=r(g),_=J(g,"UL",{"data-svelte-h":!0}),U(_)!=="svelte-12mqcsr"&&(_.innerHTML=Z),G=r(g),V=J(g,"P",{"data-svelte-h":!0}),U(V)!=="svelte-aqv281"&&(V.textContent=v),B=r(g),T(X.$$.fragment,g)},m(g,I){a(g,t,I),a(g,n,I),a(g,M,I),a(g,i,I),a(g,c,I),a(g,m,I),a(g,_,I),a(g,G,I),a(g,V,I),a(g,B,I),y(X,g,I),E=!0},p:N,i(g){E||(b(X.$$.fragment,g),E=!0)},o(g){h(X.$$.fragment,g),E=!1},d(g){g&&(s(t),s(n),s(M),s(i),s(c),s(m),s(_),s(G),s(V),s(B)),w(X,g)}}}function la(j){let t,f="对于DeepFloyd IF的第二阶段DreamBooth，请注意这些参数：",n,M,p="<li><code>--learning_rate=5e-6</code>，使用较低的学习率和较小的有效批次大小</li> <li><code>--resolution=256</code>，上采样器的预期分辨率</li> <li><code>--train_batch_size=2</code> 和 <code>--gradient_accumulation_steps=6</code>，为了有效训练包含面部的图像，需要更大的批次大小</li>",i,c,$;return c=new R({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkRlZXBGbG95ZCUyRklGLUlJLUwtdjEuMCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMmRvZyUyMiUwQWV4cG9ydCUyME9VVFBVVF9ESVIlM0QlMjJkcmVhbWJvb3RoX2RvZ191cHNjYWxlJTIyJTBBZXhwb3J0JTIwVkFMSURBVElPTl9JTUFHRVMlM0QlMjJkb2dfZG93bnNpemVkJTJGaW1hZ2VfMS5wbmclMjBkb2dfZG93bnNpemVkJTJGaW1hZ2VfMi5wbmclMjBkb2dfZG93bnNpemVkJTJGaW1hZ2VfMy5wbmclMjBkb2dfZG93bnNpemVkJTJGaW1hZ2VfNC5wbmclMjIlMEElMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwdHJhaW5fZHJlYW1ib290aC5weSUyMCU1QyUwQSUyMCUyMC0tcmVwb3J0X3RvJTIwd2FuZGIlMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfZGF0YV9kaXIlM0QlMjRJTlNUQU5DRV9ESVIlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9wcm9tcHQlM0QlMjJhJTIwc2tzJTIwZG9nJTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNEMjU2JTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMiUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNENiUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDVlLTYlMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDIwMDAlMjAlNUMlMEElMjAlMjAtLXZhbGlkYXRpb25fcHJvbXB0JTNEJTIyYSUyMHNrcyUyMGRvZyUyMiUyMCU1QyUwQSUyMCUyMC0tdmFsaWRhdGlvbl9zdGVwcyUzRDE1MCUyMCU1QyUwQSUyMCUyMC0tY2hlY2twb2ludGluZ19zdGVwcyUzRDUwMCUyMCU1QyUwQSUyMCUyMC0tcHJlX2NvbXB1dGVfdGV4dF9lbWJlZGRpbmdzJTIwJTVDJTBBJTIwJTIwLS10b2tlbml6ZXJfbWF4X2xlbmd0aCUzRDc3JTIwJTVDJTBBJTIwJTIwLS10ZXh0X2VuY29kZXJfdXNlX2F0dGVudGlvbl9tYXNrJTIwJTVDJTBBJTIwJTIwLS12YWxpZGF0aW9uX2ltYWdlcyUyMCUyNFZBTElEQVRJT05fSU1BR0VTJTIwJTVDJTBBJTIwJTIwLS1jbGFzc19sYWJlbHNfY29uZGl0aW9uaW5nJTIwdGltZXN0ZXBzJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;DeepFloyd/IF-II-L-v1.0&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;dreambooth_dog_upscale&quot;</span>
<span class="hljs-built_in">export</span> VALIDATION_IMAGES=<span class="hljs-string">&quot;dog_downsized/image_1.png dog_downsized/image_2.png dog_downsized/image_3.png dog_downsized/image_4.png&quot;</span>

accelerate launch train_dreambooth.py \\
  --report_to wandb \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --instance_prompt=<span class="hljs-string">&quot;a sks dog&quot;</span> \\
  --resolution=256 \\
  --train_batch_size=2 \\
  --gradient_accumulation_steps=6 \\
  --learning_rate=5e-6 \\
  --max_train_steps=2000 \\
  --validation_prompt=<span class="hljs-string">&quot;a sks dog&quot;</span> \\
  --validation_steps=150 \\
  --checkpointing_steps=500 \\
  --pre_compute_text_embeddings \\
  --tokenizer_max_length=77 \\
  --text_encoder_use_attention_mask \\
  --validation_images <span class="hljs-variable">$VALIDATION_IMAGES</span> \\
  --class_labels_conditioning timesteps \\
  --push_to_hub`,wrap:!1}}),{c(){t=d("p"),t.textContent=f,n=o(),M=d("ul"),M.innerHTML=p,i=o(),u(c.$$.fragment)},l(m){t=J(m,"P",{"data-svelte-h":!0}),U(t)!=="svelte-19neukg"&&(t.textContent=f),n=r(m),M=J(m,"UL",{"data-svelte-h":!0}),U(M)!=="svelte-11mh8rd"&&(M.innerHTML=p),i=r(m),T(c.$$.fragment,m)},m(m,_){a(m,t,_),a(m,n,_),a(m,M,_),a(m,i,_),y(c,m,_),$=!0},p:N,i(m){$||(b(c.$$.fragment,m),$=!0)},o(m){h(c.$$.fragment,m),$=!1},d(m){m&&(s(t),s(n),s(M),s(i)),w(c,m)}}}function sa(j){let t,f,n,M,p,i,c,$;return t=new F({props:{id:"IF-DreamBooth",option:"Stage 1 LoRA DreamBooth",$$slots:{default:[Ks]},$$scope:{ctx:j}}}),n=new F({props:{id:"IF-DreamBooth",option:"Stage 2 LoRA DreamBooth",$$slots:{default:[ea]},$$scope:{ctx:j}}}),p=new F({props:{id:"IF-DreamBooth",option:"Stage 1 DreamBooth",$$slots:{default:[ta]},$$scope:{ctx:j}}}),c=new F({props:{id:"IF-DreamBooth",option:"Stage 2 DreamBooth",$$slots:{default:[la]},$$scope:{ctx:j}}}),{c(){u(t.$$.fragment),f=o(),u(n.$$.fragment),M=o(),u(p.$$.fragment),i=o(),u(c.$$.fragment)},l(m){T(t.$$.fragment,m),f=r(m),T(n.$$.fragment,m),M=r(m),T(p.$$.fragment,m),i=r(m),T(c.$$.fragment,m)},m(m,_){y(t,m,_),a(m,f,_),y(n,m,_),a(m,M,_),y(p,m,_),a(m,i,_),y(c,m,_),$=!0},p(m,_){const Z={};_&2&&(Z.$$scope={dirty:_,ctx:m}),t.$set(Z);const G={};_&2&&(G.$$scope={dirty:_,ctx:m}),n.$set(G);const V={};_&2&&(V.$$scope={dirty:_,ctx:m}),p.$set(V);const v={};_&2&&(v.$$scope={dirty:_,ctx:m}),c.$set(v)},i(m){$||(b(t.$$.fragment,m),b(n.$$.fragment,m),b(p.$$.fragment,m),b(c.$$.fragment,m),$=!0)},o(m){h(t.$$.fragment,m),h(n.$$.fragment,m),h(p.$$.fragment,m),h(c.$$.fragment,m),$=!1},d(m){m&&(s(f),s(M),s(i)),w(t,m),w(n,m),w(p,m),w(c,m)}}}function aa(j){let t,f,n,M,p,i,c,$='<a href="https://huggingface.co/papers/2208.12242" rel="nofollow">DreamBooth</a> 是一种训练技术，通过仅训练少数主题或风格的图像来更新整个扩散模型。它通过在提示中关联一个特殊词与示例图像来工作。',m,_,Z='如果您在 vRAM 有限的 GPU 上训练，应尝试在训练命令中启用 <code>gradient_checkpointing</code> 和 <code>mixed_precision</code> 参数。您还可以通过使用 <a href="../optimization/xformers">xFormers</a> 的内存高效注意力来减少内存占用。JAX/Flax 训练也支持在 TPU 和 GPU 上进行高效训练，但不支持梯度检查点或 xFormers。如果您想使用 Flax 更快地训练，应拥有内存 &gt;30GB 的 GPU。',G,V,v='本指南将探索 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py" rel="nofollow">train_dreambooth.py</a> 脚本，帮助您更熟悉它，以及如何根据您的用例进行适配。',B,X,E="在运行脚本之前，请确保从源代码安装库：",g,I,k,C,W="导航到包含训练脚本的示例文件夹，并安装脚本所需的依赖项：",Mt,Y,mt,A,ct,P,Xl="初始化 🤗 Accelerate 环境：",ft,O,dt,K,Bl="要设置默认的 🤗 Accelerate 环境而不选择任何配置：",Jt,ee,Ut,te,Nl="或者，如果您的环境不支持交互式 shell，例如笔记本，您可以使用：",ut,le,Tt,se,Wl=`最后，如果您想在自己的数据集上训练模型，请查看 <a href="create_dataset">创建用于训练的数据集</a> 指南，了解如何创建与
训练脚本。`,yt,S,bt,ae,ht,L,wt,ne,vl='训练脚本提供了许多参数来自定义您的训练运行。所有参数及其描述都可以在 <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L228" rel="nofollow"><code>parse_args()</code></a> 函数中找到。参数设置了默认值，这些默认值应该开箱即用效果不错，但如果您愿意，也可以在训练命令中设置自己的值。',_t,pe,Fl="例如，要以 bf16 格式进行训练：",$t,ie,jt,oe,El="一些基本且重要的参数需要了解和指定：",gt,re,xl="<li><code>--pretrained_model_name_or_path</code>: Hub 上的模型名称或预训练模型的本地路径</li> <li><code>--instance_data_dir</code>: 包含训练数据集（示例图像）的文件夹路径</li> <li><code>--instance_prompt</code>: 包含示例图像特殊单词的文本提示</li> <li><code>--train_text_encoder</code>: 是否也训练文本编码器</li> <li><code>--output_dir</code>: 保存训练后模型的位置</li> <li><code>--push_to_hub</code>: 是否将训练后的模型推送到 Hub</li> <li><code>--checkpointing_steps</code>: 模型训练时保存检查点的频率；这在训练因某种原因中断时很有用，您可以通过在训练命令中添加 <code>--resume_from_checkpoint</code> 来从该检查点继续训练</li>",Zt,Me,Ct,me,kl='<a href="https://huggingface.co/papers/2303.09556" rel="nofollow">Min-SNR</a> 加权策略可以通过重新平衡损失来帮助训练，以实现更快的收敛。训练脚本支持预测 <code>epsilon</code>（噪声）或 <code>v_prediction</code>，但 Min-SNR 与两种预测类型都兼容。此加权策略仅由 PyTorch 支持，在 Flax 训练脚本中不可用。',Rt,ce,Yl="添加 <code>--snr_gamma</code> 参数并将其设置为推荐值 5.0：",Gt,fe,It,de,Vt,Je,Al=`先验保持损失是一种使用模型自身生成的样本来帮助它学习如何生成更多样化图像的方法。因为这些生成的样本图像属于您提供的图像相同的类别，它们帮助模型 r
etain 它已经学到的关于类别的知识，以及它如何利用已经了解的类别信息来创建新的组合。`,Xt,Ue,Sl="<li><code>--with_prior_preservation</code>: 是否使用先验保留损失</li> <li><code>--prior_loss_weight</code>: 控制先验保留损失对模型的影响程度</li> <li><code>--class_data_dir</code>: 包含生成的类别样本图像的文件夹路径</li> <li><code>--class_prompt</code>: 描述生成的样本图像类别的文本提示</li>",Bt,ue,Nt,Te,Wt,ye,Ll="为了提高生成输出的质量，除了 UNet 之外，您还可以训练文本编码器。这需要额外的内存，并且您需要一个至少有 24GB 显存的 GPU。如果您拥有必要的硬件，那么训练文本编码器会产生更好的结果，尤其是在生成面部图像时。通过以下方式启用此选项：",vt,be,Ft,he,Et,we,zl="DreamBooth 附带了自己的数据集类：",xt,_e,Ql='<li><a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L604" rel="nofollow"><code>DreamBoothDataset</code></a>: 预处理图像和类别图像，并对提示进行分词以用于训练</li> <li><a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L738" rel="nofollow"><code>PromptDataset</code></a>: 生成提示嵌入以生成类别图像</li>',kt,$e,Dl='如果您启用了<a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L842" rel="nofollow">先验保留损失</a>，类别图像在此处生成：',Yt,je,At,ge,Hl='接下来是 <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L799" rel="nofollow"><code>main()</code></a> 函数，它处理设置训练数据集和训练循环本身。脚本加载 <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L898" rel="nofollow">tokenizer</a>、<a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L912C1-L912C1" rel="nofollow">scheduler 和 models</a>：',St,Ze,Lt,Ce,ql='然后，是时候<a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L1073" rel="nofollow">创建训练数据集</a>和从<code>DreamBoothDataset</code>创建DataLoader：',zt,Re,Qt,Ge,Pl='最后，<a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L1151" rel="nofollow">训练循环</a>处理剩余步骤，例如将图像转换为潜在空间、向输入添加噪声、预测噪声残差和计算损失。',Dt,Ie,Ol='如果您想了解更多关于训练循环的工作原理，请查看<a href="../using-diffusers/write_own_pipeline">理解管道、模型和调度器</a>教程，该教程分解了去噪过程的基本模式。',Ht,Ve,qt,Xe,Kl="您现在准备好启动训练脚本了！🚀",Pt,Be,es='对于本指南，您将下载一些<a href="https://huggingface.co/datasets/diffusers/dog-example" rel="nofollow">狗的图片</a>的图像并将它们存储在一个目录中。但请记住，您可以根据需要创建和使用自己的数据集（请参阅<a href="create_dataset">创建用于训练的数据集</a>指南）。',Ot,Ne,Kt,We,ts="设置环境变量 <code>MODEL_NAME</code> 为 Hub 上的模型 ID 或本地模型路径，<code>INSTANCE_DIR</code> 为您刚刚下载狗图像的路径，<code>OUTPUT_DIR</code> 为您想保存模型的位置。您将使用 <code>sks</code> 作为特殊词来绑定训练。",el,ve,ls="如果您有兴趣跟随训练过程，可以定期保存生成的图像作为训练进度。将以下参数添加到训练命令中：",tl,Fe,ll,Ee,ss="在启动脚本之前，还有一件事！根据您拥有的 GPU，您可能需要启用某些优化来训练 DreamBooth。",sl,z,al,Q,nl,xe,as="训练完成后，您可以使用新训练的模型进行推理！",pl,D,il,H,ol,ke,rl,Ye,ns='LoRA 是一种训练技术，可显著减少可训练参数的数量。因此，训练速度更快，并且更容易存储生成的权重，因为它们小得多（约 100MB）。使用 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora.py" rel="nofollow">train_dreambooth_lora.py</a> 脚本通过 LoRA 进行训练。',Ml,Ae,ps='LoRA 训练脚本在 <a href="lora">LoRA 训练</a> 指南中有更详细的讨论。',ml,Se,cl,Le,is='Stable Diffusion XL (SDXL) 是一个强大的文本到图像模型，可生成高分辨率图像，并在其架构中添加了第二个文本编码器。使用 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora_sdxl.py" rel="nofollow">train_dreambooth_lora_sdxl.py</a> 脚本通过 LoRA 训练 SDXL 模型。',fl,ze,os='SDXL 训练脚本在 <a href="sdxl">SDXL 训练</a> 指南中有更详细的讨论。',dl,Qe,Jl,De,rs='DeepFloyd IF 是一个级联像素扩散模型，包含三个阶段。第一阶段生成基础图像，第二和第三阶段逐步将基础图像放大为高分辨率 1024x1024 图像。使用 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora.py" rel="nofollow">train_dreambooth_lora.py</a> 或 <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py" rel="nofollow">train_dreambooth.py</a> 脚本通过 LoRA 或完整模型训练 DeepFloyd IF 模型。',Ul,He,Ms="DeepFloyd IF 使用预测方差，但 Diffusers 训练脚本使用预测误差，因此训练的 DeepFloyd IF 模型被切换到固定方差调度。训练脚本将为您更新完全训练模型的调度器配置。但是，当您加载保存的 LoRA 权重时，还必须更新管道的调度器配置。",ul,qe,Tl,Pe,ms="第二阶段模型需要额外的验证图像进行放大。您可以下载并使用训练图像的缩小版本。",yl,Oe,bl,Ke,cs="以下代码示例简要概述了如何结合 DreamBooth 和 LoRA 训练 DeepFloyd IF 模型。一些需要注意的重要参数包括：",hl,et,fs=`<li><code>--resolution=64</code>，需要更小的分辨率，因为 DeepFloyd IF 是
一个像素扩散模型，用于处理未压缩的像素，输入图像必须更小</li> <li><code>--pre_compute_text_embeddings</code>，提前计算文本嵌入以节省内存，因为 <code>T5Model</code> 可能占用大量内存</li> <li><code>--tokenizer_max_length=77</code>，您可以使用更长的默认文本长度与 T5 作为文本编码器，但默认模型编码过程使用较短的文本长度</li> <li><code>--text_encoder_use_attention_mask</code>，将注意力掩码传递给文本编码器</li>`,wl,q,_l,tt,$l,lt,ds="训练DeepFloyd IF模型可能具有挑战性，但以下是我们发现有用的技巧：",jl,st,Js=`<li>LoRA对于训练第一阶段模型已足够，因为模型的低分辨率使得表示更精细的细节变得困难，无论如何。</li> <li>对于常见或简单的对象，您不一定需要微调上采样器。确保传递给上采样器的提示被调整以移除实例提示中的新令牌。例如，如果您第一阶段提示是”a sks dog”，那么您第二阶段的提示应该是”a dog”。</li> <li>对于更精细的细节，如面部，完全训练
使用阶段2上采样器比使用LoRA训练阶段2模型更好。使用更大的批次大小和较低的学习率也有帮助。</li> <li>应使用较低的学习率来训练阶段2模型。</li> <li><code>DDPMScheduler</code> 比训练脚本中使用的DPMSolver效果更好。</li>`,gl,at,Zl,nt,Us="恭喜您训练了您的DreamBooth模型！要了解更多关于如何使用您的新模型的信息，以下指南可能有所帮助：",Cl,pt,us='<li>如果您使用LoRA训练了您的模型，请学习如何<a href="../using-diffusers/loading_adapters">加载DreamBooth</a>模型进行推理。</li>',Rl,it,Gl,ot,Il;return p=new x({props:{title:"DreamBooth",local:"dreambooth",headingTag:"h1"}}),I=new R({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}}),Y=new rt({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[Fs]},$$scope:{ctx:j}}}),A=new Vl({props:{$$slots:{default:[Es]},$$scope:{ctx:j}}}),O=new R({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),ee=new R({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),le=new R({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`<span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> write_basic_config

write_basic_config()`,wrap:!1}}),S=new Vl({props:{$$slots:{default:[xs]},$$scope:{ctx:j}}}),ae=new x({props:{title:"脚本参数",local:"脚本参数",headingTag:"h2"}}),L=new Vl({props:{warning:!0,$$slots:{default:[ks]},$$scope:{ctx:j}}}),ie=new R({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmJmMTYlMjI=",highlighted:`accelerate launch train_dreambooth.py \\
    --mixed_precision=<span class="hljs-string">&quot;bf16&quot;</span>`,wrap:!1}}),Me=new x({props:{title:"Min-SNR 加权",local:"min-snr-加权",headingTag:"h3"}}),fe=new R({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_dreambooth.py \\
  --snr_gamma=5.0`,wrap:!1}}),de=new x({props:{title:"先验保持损失",local:"先验保持损失",headingTag:"h3"}}),ue=new R({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXdpdGhfcHJpb3JfcHJlc2VydmF0aW9uJTIwJTVDJTBBJTIwJTIwLS1wcmlvcl9sb3NzX3dlaWdodCUzRDEuMCUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfZGF0YV9kaXIlM0QlMjJwYXRoJTJGdG8lMkZjbGFzcyUyRmltYWdlcyUyMiUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfcHJvbXB0JTNEJTIydGV4dCUyMHByb21wdCUyMGRlc2NyaWJpbmclMjBjbGFzcyUyMg==",highlighted:`accelerate launch train_dreambooth.py \\
  --with_prior_preservation \\
  --prior_loss_weight=1.0 \\
  --class_data_dir=<span class="hljs-string">&quot;path/to/class/images&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;text prompt describing class&quot;</span>`,wrap:!1}}),Te=new x({props:{title:"训练文本编码器",local:"训练文本编码器",headingTag:"h3"}}),be=new R({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXRyYWluX3RleHRfZW5jb2Rlcg==",highlighted:`accelerate launch train_dreambooth.py \\
  --train_text_encoder`,wrap:!1}}),he=new x({props:{title:"训练脚本",local:"训练脚本",headingTag:"h2"}}),je=new R({props:{code:"c2FtcGxlX2RhdGFzZXQlMjAlM0QlMjBQcm9tcHREYXRhc2V0KGFyZ3MuY2xhc3NfcHJvbXB0JTJDJTIwbnVtX25ld19pbWFnZXMpJTBBc2FtcGxlX2RhdGFsb2FkZXIlMjAlM0QlMjB0b3JjaC51dGlscy5kYXRhLkRhdGFMb2FkZXIoc2FtcGxlX2RhdGFzZXQlMkMlMjBiYXRjaF9zaXplJTNEYXJncy5zYW1wbGVfYmF0Y2hfc2l6ZSklMEElMEFzYW1wbGVfZGF0YWxvYWRlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoc2FtcGxlX2RhdGFsb2FkZXIpJTBBcGlwZWxpbmUudG8oYWNjZWxlcmF0b3IuZGV2aWNlKSUwQSUwQWZvciUyMGV4YW1wbGUlMjBpbiUyMHRxZG0oJTBBJTIwJTIwJTIwJTIwc2FtcGxlX2RhdGFsb2FkZXIlMkMlMjBkZXNjJTNEJTIyR2VuZXJhdGluZyUyMGNsYXNzJTIwaW1hZ2VzJTIyJTJDJTIwZGlzYWJsZSUzRG5vdCUyMGFjY2VsZXJhdG9yLmlzX2xvY2FsX21haW5fcHJvY2VzcyUwQSklM0ElMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjBwaXBlbGluZShleGFtcGxlJTVCJTIycHJvbXB0JTIyJTVEKS5pbWFnZXM=",highlighted:`sample_dataset = PromptDataset(args.class_prompt, num_new_images)
sample_dataloader = torch.utils.data.DataLoader(sample_dataset, batch_size=args.sample_batch_size)

sample_dataloader = accelerator.prepare(sample_dataloader)
pipeline.to(accelerator.device)

<span class="hljs-keyword">for</span> example <span class="hljs-keyword">in</span> tqdm(
    sample_dataloader, desc=<span class="hljs-string">&quot;Generating class images&quot;</span>, disable=<span class="hljs-keyword">not</span> accelerator.is_local_main_process
):
    images = pipeline(example[<span class="hljs-string">&quot;prompt&quot;</span>]).images`,wrap:!1}}),Ze=new R({props:{code:"JTIzJTIwTG9hZCUyMHRoZSUyMHRva2VuaXplciUwQWlmJTIwYXJncy50b2tlbml6ZXJfbmFtZSUzQSUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0c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mlzaW9uJTBBKSUwQSUwQWlmJTIwbW9kZWxfaGFzX3ZhZShhcmdzKSUzQSUwQSUyMCUyMCUyMCUyMHZhZSUyMCUzRCUyMEF1dG9lbmNvZGVyS0wuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFyZ3MucHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglMkMlMjBzdWJmb2xkZXIlM0QlMjJ2YWUlMjIlMkMlMjByZXZpc2lvbiUzRGFyZ3MucmV2aXNpb24lMEElMjAlMjAlMjAlMjApJTBBZWxzZSUzQSUwQSUyMCUyMCUyMCUyMHZhZSUyMCUzRCUyME5vbmUlMEElMEF1bmV0JTIwJTNEJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMGFyZ3MucHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTIwcmV2aXNpb24lM0RhcmdzLnJldmlzaW9uJTBBKQ==",highlighted:`<span class="hljs-comment"># Load the tokenizer</span>
<span class="hljs-keyword">if</span> args.tokenizer_name:
    tokenizer = AutoTokenizer.from_pretrained(args.tokenizer_name, revision=args.revision, use_fast=<span class="hljs-literal">False</span>)
<span class="hljs-keyword">elif</span> args.pretrained_model_name_or_path:
    tokenizer = AutoTokenizer.from_pretrained(
        args.pretrained_model_name_or_path,
        subfolder=<span class="hljs-string">&quot;tokenizer&quot;</span>,
        revision=args.revision,
        use_fast=<span class="hljs-literal">False</span>,
    )

<span class="hljs-comment"># 加载调度器和模型</span>
noise_scheduler = DDPMScheduler.from_pretrained(args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
text_encoder = text_encoder_cls.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, revision=args.revision
)

<span class="hljs-keyword">if</span> model_has_vae(args):
    vae = AutoencoderKL.from_pretrained(
        args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, revision=args.revision
    )
<span class="hljs-keyword">else</span>:
    vae = <span class="hljs-literal">None</span>

unet = UNet2DConditionModel.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, revision=args.revision
)`,wrap:!1}}),Re=new R({props:{code:"dHJhaW5fZGF0YXNldCUyMCUzRCUyMERyZWFtQm9vdGhEYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGluc3RhbmNlX2RhdGFfcm9vdCUzRGFyZ3MuaW5zdGFuY2VfZGF0YV9kaXIlMkMlMEElMjAlMjAlMjAlMjBpbnN0YW5jZV9wcm9tcHQlM0RhcmdzLmluc3RhbmNlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGNsYXNzX2RhdGFfcm9vdCUzRGFyZ3MuY2xhc3NfZGF0YV9kaXIlMjBpZiUyMGFyZ3Mud2l0aF9wcmlvcl9wcmVzZXJ2YXRpb24lMjBlbHNlJTIwTm9uZSUyQyUwQSUyMCUyMCUyMCUyMGNsYXNzX3Byb21wdCUzRGFyZ3MuY2xhc3NfcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwY2xhc3NfbnVtJTNEYXJncy5udW1fY2xhc3NfaW1hZ2VzJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwc2l6ZSUzRGFyZ3MucmVzb2x1dGlvbiUyQyUwQSUyMCUyMCUyMCUyMGNlbnRlcl9jcm9wJTNEYXJncy5jZW50ZXJfY3JvcCUyQyUwQSUyMCUyMCUyMCUyMGVuY29kZXJfaGlkZGVuX3N0YXRlcyUzRHByZV9jb21wdXRlZF9lbmNvZGVyX2hpZGRlbl9zdGF0ZXMlMkMlMEElMjAlMjAlMjAlMjBjbGFzc19wcm9tcHRfZW5jb2Rlcl9oaWRkZW5fc3RhdGVzJTNEcHJlX2NvbXB1dGVkX2NsYXNzX3Byb21wdF9lbmNvZGVyX2hpZGRlbl9zdGF0ZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXJfbWF4X2xlbmd0aCUzRGFyZ3MudG9rZW5pemVyX21heF9sZW5ndGglMkMlMEEpJTBBJTBBdHJhaW5fZGF0YWxvYWRlciUyMCUzRCUyMHRvcmNoLnV0aWxzLmRhdGEuRGF0YUxvYWRlciglMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRGFyZ3MudHJhaW5fYmF0Y2hfc2l6ZSUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGxhbWJkYSUyMGV4YW1wbGVzJTNBJTIwY29sbGF0ZV9mbihleGFtcGxlcyUyQyUyMGFyZ3Mud2l0aF9wcmlvcl9wcmVzZXJ2YXRpb24pJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3dvcmtlcnMlM0RhcmdzLmRhdGFsb2FkZXJfbnVtX3dvcmtlcnMlMkMlMEEp",highlighted:`train_dataset = DreamBoothDataset(
    instance_data_root=args.instance_data_dir,
    instance_prompt=args.instance_prompt,
    class_data_root=args.class_data_dir <span class="hljs-keyword">if</span> args.with_prior_preservation <span class="hljs-keyword">else</span> <span class="hljs-literal">None</span>,
    class_prompt=args.class_prompt,
    class_num=args.num_class_images,
    tokenizer=tokenizer,
    size=args.resolution,
    center_crop=args.center_crop,
    encoder_hidden_states=pre_computed_encoder_hidden_states,
    class_prompt_encoder_hidden_states=pre_computed_class_prompt_encoder_hidden_states,
    tokenizer_max_length=args.tokenizer_max_length,
)

train_dataloader = torch.utils.data.DataLoader(
    train_dataset,
    batch_size=args.train_batch_size,
    shuffle=<span class="hljs-literal">True</span>,
    collate_fn=<span class="hljs-keyword">lambda</span> examples: collate_fn(examples, args.with_prior_preservation),
    num_workers=args.dataloader_num_workers,
)`,wrap:!1}}),Ve=new x({props:{title:"启动脚本",local:"启动脚本",headingTag:"h2"}}),Ne=new R({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHNuYXBzaG90X2Rvd25sb2FkJTBBJTBBbG9jYWxfZGlyJTIwJTNEJTIwJTIyLiUyRmRvZyUyMiUwQXNuYXBzaG90X2Rvd25sb2FkKCUwQSUyMCUyMCUyMCUyMCUyMmRpZmZ1c2VycyUyRmRvZy1leGFtcGxlJTIyJTJDJTBBJTIwJTIwJTIwJTIwbG9jYWxfZGlyJTNEbG9jYWxfZGlyJTJDJTBBJTIwJTIwJTIwJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUyQyUwQSUyMCUyMCUyMCUyMGlnbm9yZV9wYXR0ZXJucyUzRCUyMi5naXRhdHRyaWJ1dGVzJTIyJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> snapshot_download

local_dir = <span class="hljs-string">&quot;./dog&quot;</span>
snapshot_download(
    <span class="hljs-string">&quot;diffusers/dog-example&quot;</span>,
    local_dir=local_dir,
    repo_type=<span class="hljs-string">&quot;dataset&quot;</span>,
    ignore_patterns=<span class="hljs-string">&quot;.gitattributes&quot;</span>,
)`,wrap:!1}}),Fe=new R({props:{code:"LS12YWxpZGF0aW9uX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwYSUyMHNrcyUyMGRvZyUyMiUwQS0tbnVtX3ZhbGlkYXRpb25faW1hZ2VzJTNENCUwQS0tdmFsaWRhdGlvbl9zdGVwcyUzRDEwMA==",highlighted:`--validation_prompt=<span class="hljs-string">&quot;a photo of a sks dog&quot;</span>
--num_validation_images=4
--validation_steps=100`,wrap:!1}}),z=new rt({props:{id:"gpu-select",options:["16GB","12GB","8GB"],$$slots:{default:[Ls]},$$scope:{ctx:j}}}),Q=new rt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[Ds]},$$scope:{ctx:j}}}),D=new Vl({props:{$$slots:{default:[Hs]},$$scope:{ctx:j}}}),H=new rt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[Os]},$$scope:{ctx:j}}}),ke=new x({props:{title:"LoRA",local:"lora",headingTag:"h2"}}),Se=new x({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),Qe=new x({props:{title:"DeepFloyd IF",local:"deepfloyd-if",headingTag:"h2"}}),qe=new R({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJEZWVwRmxveWQlMkZJRi1JLVhMLXYxLjAlMjIlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKSUwQSUwQXBpcGUubG9hZF9sb3JhX3dlaWdodHMoJTIyJTNDbG9yYSUyMHdlaWdodHMlMjBwYXRoJTNFJTIyKSUwQSUwQSUyMyUyMCVFNiU5QiVCNCVFNiU5NiVCMCVFOCVCMCU4MyVFNSVCQSVBNiVFNSU5OSVBOCVFOSU4NSU4RCVFNyVCRCVBRSVFNCVCOCVCQSVFNSU5QiVCQSVFNSVBRSU5QSVFNiU5NiVCOSVFNSVCNyVBRSVFOCVCMCU4MyVFNSVCQSVBNiUwQXBpcGUuc2NoZWR1bGVyJTIwJTNEJTIwcGlwZS5zY2hlZHVsZXIuX19jbGFzc19fLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyUyQyUyMHZhcmlhbmNlX3R5cGUlM0QlMjJmaXhlZF9zbWFsbCUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;DeepFloyd/IF-I-XL-v1.0&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>)

pipe.load_lora_weights(<span class="hljs-string">&quot;&lt;lora weights path&gt;&quot;</span>)

<span class="hljs-comment"># 更新调度器配置为固定方差调度</span>
pipe.scheduler = pipe.scheduler.__class__.from_config(pipe.scheduler.config, variance_type=<span class="hljs-string">&quot;fixed_small&quot;</span>)`,wrap:!1}}),Oe=new R({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHNuYXBzaG90X2Rvd25sb2FkJTBBJTBBbG9jYWxfZGlyJTIwJTNEJTIwJTIyLiUyRmRvZ19kb3duc2l6ZWQlMjIlMEFzbmFwc2hvdF9kb3dubG9hZCglMEElMjAlMjAlMjAlMjAlMjJkaWZmdXNlcnMlMkZkb2ctZXhhbXBsZS1kb3duc2l6ZWQlMjIlMkMlMEElMjAlMjAlMjAlMjBsb2NhbF9kaXIlM0Rsb2NhbF9kaXIlMkMlMEElMjAlMjAlMjAlMjByZXBvX3R5cGUlM0QlMjJkYXRhc2V0JTIyJTJDJTBBJTIwJTIwJTIwJTIwaWdub3JlX3BhdHRlcm5zJTNEJTIyLmdpdGF0dHJpYnV0ZXMlMjIlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> snapshot_download

local_dir = <span class="hljs-string">&quot;./dog_downsized&quot;</span>
snapshot_download(
    <span class="hljs-string">&quot;diffusers/dog-example-downsized&quot;</span>,
    local_dir=local_dir,
    repo_type=<span class="hljs-string">&quot;dataset&quot;</span>,
    ignore_patterns=<span class="hljs-string">&quot;.gitattributes&quot;</span>,
)`,wrap:!1}}),q=new rt({props:{id:"IF-DreamBooth",options:["Stage 1 LoRA DreamBooth","Stage 2 LoRA DreamBooth","Stage 1 DreamBooth","Stage 2 DreamBooth"],$$slots:{default:[sa]},$$scope:{ctx:j}}}),tt=new x({props:{title:"训练技巧",local:"训练技巧",headingTag:"h3"}}),at=new x({props:{title:"下一步",local:"下一步",headingTag:"h2"}}),it=new Ns({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/training/dreambooth.md"}}),{c(){t=d("meta"),f=o(),n=d("p"),M=o(),u(p.$$.fragment),i=o(),c=d("p"),c.innerHTML=$,m=o(),_=d("p"),_.innerHTML=Z,G=o(),V=d("p"),V.innerHTML=v,B=o(),X=d("p"),X.textContent=E,g=o(),u(I.$$.fragment),k=o(),C=d("p"),C.textContent=W,Mt=o(),u(Y.$$.fragment),mt=o(),u(A.$$.fragment),ct=o(),P=d("p"),P.textContent=Xl,ft=o(),u(O.$$.fragment),dt=o(),K=d("p"),K.textContent=Bl,Jt=o(),u(ee.$$.fragment),Ut=o(),te=d("p"),te.textContent=Nl,ut=o(),u(le.$$.fragment),Tt=o(),se=d("p"),se.innerHTML=Wl,yt=o(),u(S.$$.fragment),bt=o(),u(ae.$$.fragment),ht=o(),u(L.$$.fragment),wt=o(),ne=d("p"),ne.innerHTML=vl,_t=o(),pe=d("p"),pe.textContent=Fl,$t=o(),u(ie.$$.fragment),jt=o(),oe=d("p"),oe.textContent=El,gt=o(),re=d("ul"),re.innerHTML=xl,Zt=o(),u(Me.$$.fragment),Ct=o(),me=d("p"),me.innerHTML=kl,Rt=o(),ce=d("p"),ce.innerHTML=Yl,Gt=o(),u(fe.$$.fragment),It=o(),u(de.$$.fragment),Vt=o(),Je=d("p"),Je.textContent=Al,Xt=o(),Ue=d("ul"),Ue.innerHTML=Sl,Bt=o(),u(ue.$$.fragment),Nt=o(),u(Te.$$.fragment),Wt=o(),ye=d("p"),ye.textContent=Ll,vt=o(),u(be.$$.fragment),Ft=o(),u(he.$$.fragment),Et=o(),we=d("p"),we.textContent=zl,xt=o(),_e=d("ul"),_e.innerHTML=Ql,kt=o(),$e=d("p"),$e.innerHTML=Dl,Yt=o(),u(je.$$.fragment),At=o(),ge=d("p"),ge.innerHTML=Hl,St=o(),u(Ze.$$.fragment),Lt=o(),Ce=d("p"),Ce.innerHTML=ql,zt=o(),u(Re.$$.fragment),Qt=o(),Ge=d("p"),Ge.innerHTML=Pl,Dt=o(),Ie=d("p"),Ie.innerHTML=Ol,Ht=o(),u(Ve.$$.fragment),qt=o(),Xe=d("p"),Xe.textContent=Kl,Pt=o(),Be=d("p"),Be.innerHTML=es,Ot=o(),u(Ne.$$.fragment),Kt=o(),We=d("p"),We.innerHTML=ts,el=o(),ve=d("p"),ve.textContent=ls,tl=o(),u(Fe.$$.fragment),ll=o(),Ee=d("p"),Ee.textContent=ss,sl=o(),u(z.$$.fragment),al=o(),u(Q.$$.fragment),nl=o(),xe=d("p"),xe.textContent=as,pl=o(),u(D.$$.fragment),il=o(),u(H.$$.fragment),ol=o(),u(ke.$$.fragment),rl=o(),Ye=d("p"),Ye.innerHTML=ns,Ml=o(),Ae=d("p"),Ae.innerHTML=ps,ml=o(),u(Se.$$.fragment),cl=o(),Le=d("p"),Le.innerHTML=is,fl=o(),ze=d("p"),ze.innerHTML=os,dl=o(),u(Qe.$$.fragment),Jl=o(),De=d("p"),De.innerHTML=rs,Ul=o(),He=d("p"),He.textContent=Ms,ul=o(),u(qe.$$.fragment),Tl=o(),Pe=d("p"),Pe.textContent=ms,yl=o(),u(Oe.$$.fragment),bl=o(),Ke=d("p"),Ke.textContent=cs,hl=o(),et=d("ul"),et.innerHTML=fs,wl=o(),u(q.$$.fragment),_l=o(),u(tt.$$.fragment),$l=o(),lt=d("p"),lt.textContent=ds,jl=o(),st=d("ul"),st.innerHTML=Js,gl=o(),u(at.$$.fragment),Zl=o(),nt=d("p"),nt.textContent=Us,Cl=o(),pt=d("ul"),pt.innerHTML=us,Rl=o(),u(it.$$.fragment),Gl=o(),ot=d("p"),this.h()},l(e){const l=Xs("svelte-u9bgzb",document.head);t=J(l,"META",{name:!0,content:!0}),l.forEach(s),f=r(e),n=J(e,"P",{}),Zs(n).forEach(s),M=r(e),T(p.$$.fragment,e),i=r(e),c=J(e,"P",{"data-svelte-h":!0}),U(c)!=="svelte-1e9t3g6"&&(c.innerHTML=$),m=r(e),_=J(e,"P",{"data-svelte-h":!0}),U(_)!=="svelte-1ngr86v"&&(_.innerHTML=Z),G=r(e),V=J(e,"P",{"data-svelte-h":!0}),U(V)!=="svelte-rplwfa"&&(V.innerHTML=v),B=r(e),X=J(e,"P",{"data-svelte-h":!0}),U(X)!=="svelte-sgtnc7"&&(X.textContent=E),g=r(e),T(I.$$.fragment,e),k=r(e),C=J(e,"P",{"data-svelte-h":!0}),U(C)!=="svelte-p2mznn"&&(C.textContent=W),Mt=r(e),T(Y.$$.fragment,e),mt=r(e),T(A.$$.fragment,e),ct=r(e),P=J(e,"P",{"data-svelte-h":!0}),U(P)!=="svelte-2mxnyi"&&(P.textContent=Xl),ft=r(e),T(O.$$.fragment,e),dt=r(e),K=J(e,"P",{"data-svelte-h":!0}),U(K)!=="svelte-sl2ztp"&&(K.textContent=Bl),Jt=r(e),T(ee.$$.fragment,e),Ut=r(e),te=J(e,"P",{"data-svelte-h":!0}),U(te)!=="svelte-1dtw1zl"&&(te.textContent=Nl),ut=r(e),T(le.$$.fragment,e),Tt=r(e),se=J(e,"P",{"data-svelte-h":!0}),U(se)!=="svelte-1m05pet"&&(se.innerHTML=Wl),yt=r(e),T(S.$$.fragment,e),bt=r(e),T(ae.$$.fragment,e),ht=r(e),T(L.$$.fragment,e),wt=r(e),ne=J(e,"P",{"data-svelte-h":!0}),U(ne)!=="svelte-jyetfn"&&(ne.innerHTML=vl),_t=r(e),pe=J(e,"P",{"data-svelte-h":!0}),U(pe)!=="svelte-uzrh94"&&(pe.textContent=Fl),$t=r(e),T(ie.$$.fragment,e),jt=r(e),oe=J(e,"P",{"data-svelte-h":!0}),U(oe)!=="svelte-ks8wy6"&&(oe.textContent=El),gt=r(e),re=J(e,"UL",{"data-svelte-h":!0}),U(re)!=="svelte-55at4u"&&(re.innerHTML=xl),Zt=r(e),T(Me.$$.fragment,e),Ct=r(e),me=J(e,"P",{"data-svelte-h":!0}),U(me)!=="svelte-mcww0e"&&(me.innerHTML=kl),Rt=r(e),ce=J(e,"P",{"data-svelte-h":!0}),U(ce)!=="svelte-1dvfh3c"&&(ce.innerHTML=Yl),Gt=r(e),T(fe.$$.fragment,e),It=r(e),T(de.$$.fragment,e),Vt=r(e),Je=J(e,"P",{"data-svelte-h":!0}),U(Je)!=="svelte-18s4z57"&&(Je.textContent=Al),Xt=r(e),Ue=J(e,"UL",{"data-svelte-h":!0}),U(Ue)!=="svelte-1audnhp"&&(Ue.innerHTML=Sl),Bt=r(e),T(ue.$$.fragment,e),Nt=r(e),T(Te.$$.fragment,e),Wt=r(e),ye=J(e,"P",{"data-svelte-h":!0}),U(ye)!=="svelte-1qwsx6b"&&(ye.textContent=Ll),vt=r(e),T(be.$$.fragment,e),Ft=r(e),T(he.$$.fragment,e),Et=r(e),we=J(e,"P",{"data-svelte-h":!0}),U(we)!=="svelte-85252j"&&(we.textContent=zl),xt=r(e),_e=J(e,"UL",{"data-svelte-h":!0}),U(_e)!=="svelte-16ksb00"&&(_e.innerHTML=Ql),kt=r(e),$e=J(e,"P",{"data-svelte-h":!0}),U($e)!=="svelte-16cegbe"&&($e.innerHTML=Dl),Yt=r(e),T(je.$$.fragment,e),At=r(e),ge=J(e,"P",{"data-svelte-h":!0}),U(ge)!=="svelte-1a2q73b"&&(ge.innerHTML=Hl),St=r(e),T(Ze.$$.fragment,e),Lt=r(e),Ce=J(e,"P",{"data-svelte-h":!0}),U(Ce)!=="svelte-1jv11vt"&&(Ce.innerHTML=ql),zt=r(e),T(Re.$$.fragment,e),Qt=r(e),Ge=J(e,"P",{"data-svelte-h":!0}),U(Ge)!=="svelte-1u5xr53"&&(Ge.innerHTML=Pl),Dt=r(e),Ie=J(e,"P",{"data-svelte-h":!0}),U(Ie)!=="svelte-1kc06wj"&&(Ie.innerHTML=Ol),Ht=r(e),T(Ve.$$.fragment,e),qt=r(e),Xe=J(e,"P",{"data-svelte-h":!0}),U(Xe)!=="svelte-5ajv6x"&&(Xe.textContent=Kl),Pt=r(e),Be=J(e,"P",{"data-svelte-h":!0}),U(Be)!=="svelte-70dorz"&&(Be.innerHTML=es),Ot=r(e),T(Ne.$$.fragment,e),Kt=r(e),We=J(e,"P",{"data-svelte-h":!0}),U(We)!=="svelte-cqu8zz"&&(We.innerHTML=ts),el=r(e),ve=J(e,"P",{"data-svelte-h":!0}),U(ve)!=="svelte-1nc6qo"&&(ve.textContent=ls),tl=r(e),T(Fe.$$.fragment,e),ll=r(e),Ee=J(e,"P",{"data-svelte-h":!0}),U(Ee)!=="svelte-1c286rs"&&(Ee.textContent=ss),sl=r(e),T(z.$$.fragment,e),al=r(e),T(Q.$$.fragment,e),nl=r(e),xe=J(e,"P",{"data-svelte-h":!0}),U(xe)!=="svelte-2s2vlp"&&(xe.textContent=as),pl=r(e),T(D.$$.fragment,e),il=r(e),T(H.$$.fragment,e),ol=r(e),T(ke.$$.fragment,e),rl=r(e),Ye=J(e,"P",{"data-svelte-h":!0}),U(Ye)!=="svelte-99pbmn"&&(Ye.innerHTML=ns),Ml=r(e),Ae=J(e,"P",{"data-svelte-h":!0}),U(Ae)!=="svelte-147iht9"&&(Ae.innerHTML=ps),ml=r(e),T(Se.$$.fragment,e),cl=r(e),Le=J(e,"P",{"data-svelte-h":!0}),U(Le)!=="svelte-kvbsu5"&&(Le.innerHTML=is),fl=r(e),ze=J(e,"P",{"data-svelte-h":!0}),U(ze)!=="svelte-8i15cc"&&(ze.innerHTML=os),dl=r(e),T(Qe.$$.fragment,e),Jl=r(e),De=J(e,"P",{"data-svelte-h":!0}),U(De)!=="svelte-getdal"&&(De.innerHTML=rs),Ul=r(e),He=J(e,"P",{"data-svelte-h":!0}),U(He)!=="svelte-lp6rav"&&(He.textContent=Ms),ul=r(e),T(qe.$$.fragment,e),Tl=r(e),Pe=J(e,"P",{"data-svelte-h":!0}),U(Pe)!=="svelte-1brviy5"&&(Pe.textContent=ms),yl=r(e),T(Oe.$$.fragment,e),bl=r(e),Ke=J(e,"P",{"data-svelte-h":!0}),U(Ke)!=="svelte-ysfma6"&&(Ke.textContent=cs),hl=r(e),et=J(e,"UL",{"data-svelte-h":!0}),U(et)!=="svelte-ijmwiq"&&(et.innerHTML=fs),wl=r(e),T(q.$$.fragment,e),_l=r(e),T(tt.$$.fragment,e),$l=r(e),lt=J(e,"P",{"data-svelte-h":!0}),U(lt)!=="svelte-owgexi"&&(lt.textContent=ds),jl=r(e),st=J(e,"UL",{"data-svelte-h":!0}),U(st)!=="svelte-dwv5bq"&&(st.innerHTML=Js),gl=r(e),T(at.$$.fragment,e),Zl=r(e),nt=J(e,"P",{"data-svelte-h":!0}),U(nt)!=="svelte-1ymw29a"&&(nt.textContent=Us),Cl=r(e),pt=J(e,"UL",{"data-svelte-h":!0}),U(pt)!=="svelte-1ehx6zh"&&(pt.innerHTML=us),Rl=r(e),T(it.$$.fragment,e),Gl=r(e),ot=J(e,"P",{}),Zs(ot).forEach(s),this.h()},h(){Cs(t,"name","hf:doc:metadata"),Cs(t,"content",na)},m(e,l){Bs(document.head,t),a(e,f,l),a(e,n,l),a(e,M,l),y(p,e,l),a(e,i,l),a(e,c,l),a(e,m,l),a(e,_,l),a(e,G,l),a(e,V,l),a(e,B,l),a(e,X,l),a(e,g,l),y(I,e,l),a(e,k,l),a(e,C,l),a(e,Mt,l),y(Y,e,l),a(e,mt,l),y(A,e,l),a(e,ct,l),a(e,P,l),a(e,ft,l),y(O,e,l),a(e,dt,l),a(e,K,l),a(e,Jt,l),y(ee,e,l),a(e,Ut,l),a(e,te,l),a(e,ut,l),y(le,e,l),a(e,Tt,l),a(e,se,l),a(e,yt,l),y(S,e,l),a(e,bt,l),y(ae,e,l),a(e,ht,l),y(L,e,l),a(e,wt,l),a(e,ne,l),a(e,_t,l),a(e,pe,l),a(e,$t,l),y(ie,e,l),a(e,jt,l),a(e,oe,l),a(e,gt,l),a(e,re,l),a(e,Zt,l),y(Me,e,l),a(e,Ct,l),a(e,me,l),a(e,Rt,l),a(e,ce,l),a(e,Gt,l),y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ts.$$scope={dirty:l,ctx:e}),Y.$set(Ts);const ys={};l&2&&(ys.$$scope={dirty:l,ctx:e}),A.$set(ys);const bs={};l&2&&(bs.$$scope={dirty:l,ctx:e}),S.$set(bs);const hs={};l&2&&(hs.$$scope={dirty:l,ctx:e}),L.$set(hs);const ws={};l&2&&(ws.$$scope={dirty:l,ctx:e}),z.$set(ws);const _s={};l&2&&(_s.$$scope={dirty:l,ctx:e}),Q.$set(_s);const $s={};l&2&&($s.$$scope={dirty:l,ctx:e}),D.$set($s);const js={};l&2&&(js.$$scope={dirty:l,ctx:e}),H.$set(js);const gs={};l&2&&(gs.$$scope={dirty:l,ctx:e}),q.$set(gs)},i(e){Il||(b(p.$$.fragment,e),b(I.$$.fragment,e),b(Y.$$.fragment,e),b(A.$$.fragment,e),b(O.$$.fragment,e),b(ee.$$.fragment,e),b(le.$$.fragment,e),b(S.$$.fragment,e),b(ae.$$.fragment,e),b(L.$$.fragment,e),b(ie.$$.fragment,e),b(Me.$$.fragment,e),b(fe.$$.fragment,e),b(de.$$.fragment,e),b(ue.$$.fragment,e),b(Te.$$.fragment,e),b(be.$$.fragment,e),b(he.$$.fragment,e),b(je.$$.fragment,e),b(Ze.$$.fragment,e),b(Re.$$.fragment,e),b(Ve.$$.fragment,e),b(Ne.$$.fragment,e),b(Fe.$$.fragment,e),b(z.$$.fragment,e),b(Q.$$.fragment,e),b(D.$$.fragment,e),b(H.$$.fragment,e),b(ke.$$.fragment,e),b(Se.$$.fragment,e),b(Qe.$$.fragment,e),b(qe.$$.fragment,e),b(Oe.$$.fragment,e),b(q.$$.fragment,e),b(tt.$$.fragment,e),b(at.$$.fragment,e),b(it.$$.fragment,e),Il=!0)},o(e){h(p.$$.fragment,e),h(I.$$.fragment,e),h(Y.$$.fragment,e),h(A.$$.fragment,e),h(O.$$.fragment,e),h(ee.$$.fragment,e),h(le.$$.fragment,e),h(S.$$.fragment,e),h(ae.$$.fragment,e),h(L.$$.fragment,e),h(ie.$$.fragment,e),h(Me.$$.fragment,e),h(fe.$$.fragment,e),h(de.$$.fragment,e),h(ue.$$.fragment,e),h(Te.$$.fragment,e),h(be.$$.fragment,e),h(he.$$.fragment,e),h(je.$$.fragment,e),h(Ze.$$.fragment,e),h(Re.$$.fragment,e),h(Ve.$$.fragment,e),h(Ne.$$.fragment,e),h(Fe.$$.fragment,e),h(z.$$.fragment,e),h(Q.$$.fragment,e),h(D.$$.fragment,e),h(H.$$.fragment,e),h(ke.$$.fragment,e),h(Se.$$.fragment,e),h(Qe.$$.fragment,e),h(qe.$$.fragment,e),h(Oe.$$.fragment,e),h(q.$$.fragment,e),h(tt.$$.fragment,e),h(at.$$.fragment,e),h(it.$$.fragment,e),Il=!1},d(e){e&&(s(f),s(n),s(M),s(i),s(c),s(m),s(_),s(G),s(V),s(B),s(X),s(g),s(k),s(C),s(Mt),s(mt),s(ct),s(P),s(ft),s(dt),s(K),s(Jt),s(Ut),s(te),s(ut),s(Tt),s(se),s(yt),s(bt),s(ht),s(wt),s(ne),s(_t),s(pe),s($t),s(jt),s(oe),s(gt),s(re),s(Zt),s(Ct),s(me),s(Rt),s(ce),s(Gt),s(It),s(Vt),s(Je),s(Xt),s(Ue),s(Bt),s(Nt),s(Wt),s(ye),s(vt),s(Ft),s(Et),s(we),s(xt),s(_e),s(kt),s($e),s(Yt),s(At),s(ge),s(St),s(Lt),s(Ce),s(zt),s(Qt),s(Ge),s(Dt),s(Ie),s(Ht),s(qt),s(Xe),s(Pt),s(Be),s(Ot),s(Kt),s(We),s(el),s(ve),s(tl),s(ll),s(Ee),s(sl),s(al),s(nl),s(xe),s(pl),s(il),s(ol),s(rl),s(Ye),s(Ml),s(Ae),s(ml),s(cl),s(Le),s(fl),s(ze),s(dl),s(Jl),s(De),s(Ul),s(He),s(ul),s(Tl),s(Pe),s(yl),s(bl),s(Ke),s(hl),s(et),s(wl),s(_l),s($l),s(lt),s(jl),s(st),s(gl),s(Zl),s(nt),s(Cl),s(pt),s(Rl),s(Gl),s(ot)),s(t),w(p,e),w(I,e),w(Y,e),w(A,e),w(O,e),w(ee,e),w(le,e),w(S,e),w(ae,e),w(L,e),w(ie,e),w(Me,e),w(fe,e),w(de,e),w(ue,e),w(Te,e),w(be,e),w(he,e),w(je,e),w(Ze,e),w(Re,e),w(Ve,e),w(Ne,e),w(Fe,e),w(z,e),w(Q,e),w(D,e),w(H,e),w(ke,e),w(Se,e),w(Qe,e),w(qe,e),w(Oe,e),w(q,e),w(tt,e),w(at,e),w(it,e)}}}const na='{"title":"DreamBooth","local":"dreambooth","sections":[{"title":"脚本参数","local":"脚本参数","sections":[{"title":"Min-SNR 加权","local":"min-snr-加权","sections":[],"depth":3},{"title":"先验保持损失","local":"先验保持损失","sections":[],"depth":3},{"title":"训练文本编码器","local":"训练文本编码器","sections":[],"depth":3}],"depth":2},{"title":"训练脚本","local":"训练脚本","sections":[],"depth":2},{"title":"启动脚本","local":"启动脚本","sections":[],"depth":2},{"title":"LoRA","local":"lora","sections":[],"depth":2},{"title":"Stable Diffusion XL","local":"stable-diffusion-xl","sections":[],"depth":2},{"title":"DeepFloyd IF","local":"deepfloyd-if","sections":[{"title":"训练技巧","local":"训练技巧","sections":[],"depth":3}],"depth":2},{"title":"下一步","local":"下一步","sections":[],"depth":2}],"depth":1}';function pa(j){return Gs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fa extends Is{constructor(t){super(),Vs(this,t,pa,aa,Rs,{})}}export{fa as component};
