import{s as zt,o as At,n as W}from"../chunks/scheduler.5c93273d.js";import{S as Pt,i as qt,g as u,s as m,r as M,A as Dt,h as $,f as s,c as f,j as St,u as d,x as U,k as Qt,y as Ot,a,v as _,d as b,t as h,w as g}from"../chunks/index.e43dd92b.js";import{T as we}from"../chunks/Tip.1cbfe904.js";import{C as Z}from"../chunks/CodeBlock.6896320e.js";import{H as he,E as Kt}from"../chunks/getInferenceSnippets.d410b42d.js";import{H as Mt,a as ge}from"../chunks/HfOption.d50154c3.js";function el(T){let t,i="文生图训练脚本目前处于实验阶段，容易出现过拟合和灾难性遗忘等问题。建议尝试不同超参数以获得最佳数据集适配效果。";return{c(){t=u("p"),t.textContent=i},l(n){t=$(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-2ncujg"&&(t.textContent=i)},m(n,o){a(n,t,o)},p:W,d(n){n&&s(t)}}}function tl(T){let t,i;return t=new Z({props:{code:"Y2QlMjBleGFtcGxlcyUyRnRleHRfdG9faW1hZ2UlMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/text_to_image
pip install -r requirements.txt`,wrap:!1}}),{c(){M(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,o){_(t,n,o),i=!0},p:W,i(n){i||(b(t.$$.fragment,n),i=!0)},o(n){h(t.$$.fragment,n),i=!1},d(n){g(t,n)}}}function ll(T){let t,i;return t=new Z({props:{code:"Y2QlMjBleGFtcGxlcyUyRnRleHRfdG9faW1hZ2UlMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHNfZmxheC50eHQ=",highlighted:`<span class="hljs-built_in">cd</span> examples/text_to_image
pip install -r requirements_flax.txt`,wrap:!1}}),{c(){M(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,o){_(t,n,o),i=!0},p:W,i(n){i||(b(t.$$.fragment,n),i=!0)},o(n){h(t.$$.fragment,n),i=!1},d(n){g(t,n)}}}function nl(T){let t,i,n,o;return t=new ge({props:{id:"installation",option:"PyTorch",$$slots:{default:[tl]},$$scope:{ctx:T}}}),n=new ge({props:{id:"installation",option:"Flax",$$slots:{default:[ll]},$$scope:{ctx:T}}}),{c(){M(t.$$.fragment),i=m(),M(n.$$.fragment)},l(p){d(t.$$.fragment,p),i=f(p),d(n.$$.fragment,p)},m(p,r){_(t,p,r),a(p,i,r),_(n,p,r),o=!0},p(p,r){const w={};r&2&&(w.$$scope={dirty:r,ctx:p}),t.$set(w);const c={};r&2&&(c.$$scope={dirty:r,ctx:p}),n.$set(c)},i(p){o||(b(t.$$.fragment,p),b(n.$$.fragment,p),o=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),o=!1},d(p){p&&s(i),g(t,p),g(n,p)}}}function sl(T){let t,i='🤗 Accelerate 是支持多GPU/TPU训练和混合精度的工具库，能根据硬件环境自动配置训练参数。参阅 🤗 Accelerate <a href="https://huggingface.co/docs/accelerate/quicktour" rel="nofollow">快速入门</a> 了解更多。';return{c(){t=u("p"),t.innerHTML=i},l(n){t=$(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1s5hyjp"&&(t.innerHTML=i)},m(n,o){a(n,t,o)},p:W,d(n){n&&s(t)}}}function al(T){let t,i='以下重点介绍脚本中影响训练效果的关键参数，如需完整参数说明可查阅 <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py" rel="nofollow">脚本源码</a>。如有疑问欢迎反馈。';return{c(){t=u("p"),t.innerHTML=i},l(n){t=$(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1kevgos"&&(t.innerHTML=i)},m(n,o){a(n,t,o)},p:W,d(n){n&&s(t)}}}function pl(T){let t,i="使用本地数据集时，设置 <code>TRAIN_DIR</code> 和 <code>OUTPUT_DIR</code> 环境变量为数据集路径和模型保存路径。";return{c(){t=u("p"),t.innerHTML=i},l(n){t=$(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1xxjibg"&&(t.innerHTML=i)},m(n,o){a(n,t,o)},p:W,d(n){n&&s(t)}}}function il(T){let t,i='以 <a href="https://huggingface.co/datasets/lambdalabs/naruto-blip-captions" rel="nofollow">火影忍者BLIP标注数据集</a> 为例训练生成火影角色。设置环境变量 <code>MODEL_NAME</code> 和 <code>dataset_name</code> 指定模型和数据集（Hub或本地路径）。多GPU训练需在 <code>accelerate launch</code> 命令中添加 <code>--multi_gpu</code> 参数。',n,o,p,r,w;return o=new we({props:{$$slots:{default:[pl]},$$scope:{ctx:T}}}),r=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQWV4cG9ydCUyMGRhdGFzZXRfbmFtZSUzRCUyMmxhbWJkYWxhYnMlMkZuYXJ1dG8tYmxpcC1jYXB0aW9ucyUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjIlMjAlMjB0cmFpbl90ZXh0X3RvX2ltYWdlLnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlNUMlMEElMjAlMjAtLWRhdGFzZXRfbmFtZSUzRCUyNGRhdGFzZXRfbmFtZSUyMCU1QyUwQSUyMCUyMC0tdXNlX2VtYSUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMC0tY2VudGVyX2Nyb3AlMjAtLXJhbmRvbV9mbGlwJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNENCUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEMTUwMDAlMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0QxZS0wNSUyMCU1QyUwQSUyMCUyMC0tbWF4X2dyYWRfbm9ybSUzRDElMjAlNUMlMEElMjAlMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUyMCU1QyUwQSUyMCUyMC0tbHJfc2NoZWR1bGVyJTNEJTIyY29uc3RhbnQlMjIlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDAlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjJzZC1uYXJ1dG8tbW9kZWwlMjIlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",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> dataset_name=<span class="hljs-string">&quot;lambdalabs/naruto-blip-captions&quot;</span>

accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span>  train_text_to_image.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --dataset_name=<span class="hljs-variable">$dataset_name</span> \\
  --use_ema \\
  --resolution=512 --center_crop --random_flip \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=4 \\
  --gradient_checkpointing \\
  --max_train_steps=15000 \\
  --learning_rate=1e-05 \\
  --max_grad_norm=1 \\
  --enable_xformers_memory_efficient_attention \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> --lr_warmup_steps=0 \\
  --output_dir=<span class="hljs-string">&quot;sd-naruto-model&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){t=u("p"),t.innerHTML=i,n=m(),M(o.$$.fragment),p=m(),M(r.$$.fragment)},l(c){t=$(c,"P",{"data-svelte-h":!0}),U(t)!=="svelte-tmdnu8"&&(t.innerHTML=i),n=f(c),d(o.$$.fragment,c),p=f(c),d(r.$$.fragment,c)},m(c,J){a(c,t,J),a(c,n,J),_(o,c,J),a(c,p,J),_(r,c,J),w=!0},p(c,J){const x={};J&2&&(x.$$scope={dirty:J,ctx:c}),o.$set(x)},i(c){w||(b(o.$$.fragment,c),b(r.$$.fragment,c),w=!0)},o(c){h(o.$$.fragment,c),h(r.$$.fragment,c),w=!1},d(c){c&&(s(t),s(n),s(p)),g(o,c),g(r,c)}}}function ml(T){let t,i="使用本地数据集时，设置 <code>TRAIN_DIR</code> 和 <code>OUTPUT_DIR</code> 环境变量为数据集路径和模型保存路径。";return{c(){t=u("p"),t.innerHTML=i},l(n){t=$(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1xxjibg"&&(t.innerHTML=i)},m(n,o){a(n,t,o)},p:W,d(n){n&&s(t)}}}function fl(T){let t,i='Flax训练方案在TPU/GPU上效率更高（由 <a href="https://github.com/duongna21" rel="nofollow">@duongna211</a> 实现），TPU性能更优但GPU表现同样出色。',n,o,p="设置环境变量 <code>MODEL_NAME</code> 和 <code>dataset_name</code> 指定模型和数据集（Hub或本地路径）。",r,w,c,J,x;return w=new we({props:{$$slots:{default:[ml]},$$scope:{ctx:T}}}),J=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQWV4cG9ydCUyMGRhdGFzZXRfbmFtZSUzRCUyMmxhbWJkYWxhYnMlMkZuYXJ1dG8tYmxpcC1jYXB0aW9ucyUyMiUwQSUwQXB5dGhvbiUyMHRyYWluX3RleHRfdG9faW1hZ2VfZmxheC5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTVDJTBBJTIwJTIwLS1kYXRhc2V0X25hbWUlM0QlMjRkYXRhc2V0X25hbWUlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAtLWNlbnRlcl9jcm9wJTIwLS1yYW5kb21fZmxpcCUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDE1MDAwJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNEMWUtMDUlMjAlNUMlMEElMjAlMjAtLW1heF9ncmFkX25vcm0lM0QxJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTIyc2QtbmFydXRvLW1vZGVsJTIyJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",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> dataset_name=<span class="hljs-string">&quot;lambdalabs/naruto-blip-captions&quot;</span>

python train_text_to_image_flax.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --dataset_name=<span class="hljs-variable">$dataset_name</span> \\
  --resolution=512 --center_crop --random_flip \\
  --train_batch_size=1 \\
  --max_train_steps=15000 \\
  --learning_rate=1e-05 \\
  --max_grad_norm=1 \\
  --output_dir=<span class="hljs-string">&quot;sd-naruto-model&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){t=u("p"),t.innerHTML=i,n=m(),o=u("p"),o.innerHTML=p,r=m(),M(w.$$.fragment),c=m(),M(J.$$.fragment)},l(y){t=$(y,"P",{"data-svelte-h":!0}),U(t)!=="svelte-q05eox"&&(t.innerHTML=i),n=f(y),o=$(y,"P",{"data-svelte-h":!0}),U(o)!=="svelte-1ajdmne"&&(o.innerHTML=p),r=f(y),d(w.$$.fragment,y),c=f(y),d(J.$$.fragment,y)},m(y,j){a(y,t,j),a(y,n,j),a(y,o,j),a(y,r,j),_(w,y,j),a(y,c,j),_(J,y,j),x=!0},p(y,j){const Ue={};j&2&&(Ue.$$scope={dirty:j,ctx:y}),w.$set(Ue)},i(y){x||(b(w.$$.fragment,y),b(J.$$.fragment,y),x=!0)},o(y){h(w.$$.fragment,y),h(J.$$.fragment,y),x=!1},d(y){y&&(s(t),s(n),s(o),s(r),s(c)),g(w,y),g(J,y)}}}function ol(T){let t,i,n,o;return t=new ge({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[il]},$$scope:{ctx:T}}}),n=new ge({props:{id:"training-inference",option:"Flax",$$slots:{default:[fl]},$$scope:{ctx:T}}}),{c(){M(t.$$.fragment),i=m(),M(n.$$.fragment)},l(p){d(t.$$.fragment,p),i=f(p),d(n.$$.fragment,p)},m(p,r){_(t,p,r),a(p,i,r),_(n,p,r),o=!0},p(p,r){const w={};r&2&&(w.$$scope={dirty:r,ctx:p}),t.$set(w);const c={};r&2&&(c.$$scope={dirty:r,ctx:p}),n.$set(c)},i(p){o||(b(t.$$.fragment,p),b(n.$$.fragment,p),o=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),o=!1},d(p){p&&s(i),g(t,p),g(n,p)}}}function rl(T){let t,i;return t=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJwYXRoJTJGdG8lMkZzYXZlZF9tb2RlbCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0QlMjJ5b2RhJTIyKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJ5b2RhLW5hcnV0by5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipeline = StableDiffusionPipeline.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(prompt=<span class="hljs-string">&quot;yoda&quot;</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;yoda-naruto.png&quot;</span>)`,wrap:!1}}),{c(){M(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,o){_(t,n,o),i=!0},p:W,i(n){i||(b(t.$$.fragment,n),i=!0)},o(n){h(t.$$.fragment,n),i=!1},d(n){g(t,n)}}}function cl(T){let t,i;return t=new Z({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsYXgudHJhaW5pbmcuY29tbW9uX3V0aWxzJTIwaW1wb3J0JTIwc2hhcmQlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmxheFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4U3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdGglMkZ0byUyRnNhdmVkX21vZGVsJTIyJTJDJTIwZHR5cGUlM0RqYXgubnVtcHkuYmZsb2F0MTYpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyeW9kYSUyMG5hcnV0byUyMiUwQXBybmdfc2VlZCUyMCUzRCUyMGpheC5yYW5kb20uUFJOR0tleSgwKSUwQW51bV9pbmZlcmVuY2Vfc3RlcHMlMjAlM0QlMjA1MCUwQSUwQW51bV9zYW1wbGVzJTIwJTNEJTIwamF4LmRldmljZV9jb3VudCgpJTBBcHJvbXB0JTIwJTNEJTIwbnVtX3NhbXBsZXMlMjAqJTIwJTVCcHJvbXB0JTVEJTBBcHJvbXB0X2lkcyUyMCUzRCUyMHBpcGVsaW5lLnByZXBhcmVfaW5wdXRzKHByb21wdCklMEElMEElMjMlMjAlRTUlODglODYlRTclODklODclRTglQkUlOTMlRTUlODUlQTUlRTUlOTIlOEMlRTklOUElOEYlRTYlOUMlQkElRTYlOTUlQjAlMEFwYXJhbXMlMjAlM0QlMjByZXBsaWNhdGUocGFyYW1zKSUwQXBybmdfc2VlZCUyMCUzRCUyMGpheC5yYW5kb20uc3BsaXQocHJuZ19zZWVkJTJDJTIwamF4LmRldmljZV9jb3VudCgpKSUwQXByb21wdF9pZHMlMjAlM0QlMjBzaGFyZChwcm9tcHRfaWRzKSUwQSUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lKHByb21wdF9pZHMlMkMlMjBwYXJhbXMlMkMlMjBwcm5nX3NlZWQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTJDJTIwaml0JTNEVHJ1ZSkuaW1hZ2VzJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUubnVtcHlfdG9fcGlsKG5wLmFzYXJyYXkoaW1hZ2VzLnJlc2hhcGUoKG51bV9zYW1wbGVzJTJDKSUyMCUyQiUyMGltYWdlcy5zaGFwZSU1Qi0zJTNBJTVEKSkpJTBBaW1hZ2Uuc2F2ZSglMjJ5b2RhLW5hcnV0by5wbmclMjIp",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/saved_model&quot;</span>, dtype=jax.numpy.bfloat16)

prompt = <span class="hljs-string">&quot;yoda naruto&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;yoda-naruto.png&quot;</span>)`,wrap:!1}}),{c(){M(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,o){_(t,n,o),i=!0},p:W,i(n){i||(b(t.$$.fragment,n),i=!0)},o(n){h(t.$$.fragment,n),i=!1},d(n){g(t,n)}}}function ul(T){let t,i,n,o;return t=new ge({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[rl]},$$scope:{ctx:T}}}),n=new ge({props:{id:"training-inference",option:"Flax",$$slots:{default:[cl]},$$scope:{ctx:T}}}),{c(){M(t.$$.fragment),i=m(),M(n.$$.fragment)},l(p){d(t.$$.fragment,p),i=f(p),d(n.$$.fragment,p)},m(p,r){_(t,p,r),a(p,i,r),_(n,p,r),o=!0},p(p,r){const w={};r&2&&(w.$$scope={dirty:r,ctx:p}),t.$set(w);const c={};r&2&&(c.$$scope={dirty:r,ctx:p}),n.$set(c)},i(p){o||(b(t.$$.fragment,p),b(n.$$.fragment,p),o=!0)},o(p){h(t.$$.fragment,p),h(n.$$.fragment,p),o=!1},d(p){p&&s(i),g(t,p),g(n,p)}}}function $l(T){let t,i,n,o,p,r,w,c,J,x="Stable Diffusion 等文生图模型能够根据文本提示生成对应图像。",y,j,Ue='模型训练对硬件要求较高，但启用 <code>gradient_checkpointing</code> 和 <code>mixed_precision</code> 后，可在单块24GB显存GPU上完成训练。如需更大批次或更快训练速度，建议使用30GB以上显存的GPU设备。通过启用 <a href="../optimization/xformers">xFormers</a> 内存高效注意力机制可降低显存占用。JAX/Flax 训练方案也支持TPU/GPU高效训练，但不支持梯度检查点、梯度累积和xFormers。使用Flax训练时建议配备30GB以上显存GPU或TPU v3。',Te,B,dt='本指南将详解 <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py" rel="nofollow">train_text_to_image.py</a> 训练脚本，助您掌握其原理并适配自定义需求。',Je,V,_t="运行脚本前请确保已从源码安装库：",je,k,Ze,Y,bt="然后进入包含训练脚本的示例目录，安装对应依赖：",xe,R,We,C,Re,N,ht="初始化 🤗 Accelerate 环境：",Ce,H,Xe,F,gt="要创建默认配置环境（不进行交互式选择）：",Ge,L,ve,I,Ut="若环境不支持交互式shell（如notebook），可使用：",Be,E,Ve,S,yt='最后，如需在自定义数据集上训练，请参阅 <a href="create_dataset">创建训练数据集</a> 指南了解如何准备适配脚本的数据集。',ke,Q,Ye,X,Ne,z,wt='训练脚本提供丰富参数供自定义训练流程，所有参数及说明详见 <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L193" rel="nofollow"><code>parse_args()</code></a> 函数。该函数为每个参数提供默认值（如批次大小、学习率等），也可通过命令行参数覆盖。',He,A,Tt="例如使用fp16混合精度加速训练：",Fe,P,Le,q,Jt="基础重要参数包括：",Ie,D,jt="<li><code>--pretrained_model_name_or_path</code>: Hub模型名称或本地预训练模型路径</li> <li><code>--dataset_name</code>: Hub数据集名称或本地训练数据集路径</li> <li><code>--image_column</code>: 数据集中图像列名</li> <li><code>--caption_column</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>",Ee,O,Se,K,Zt='<a href="https://huggingface.co/papers/2303.09556" rel="nofollow">Min-SNR</a> 加权策略通过重新平衡损失函数加速模型收敛。训练脚本支持预测 <code>epsilon</code>（噪声）或 <code>v_prediction</code>，而Min-SNR兼容两种预测类型。该策略仅限PyTorch版本，Flax训练脚本不支持。',Qe,ee,xt="添加 <code>--snr_gamma</code> 参数并设为推荐值5.0：",ze,te,Ae,le,Wt='可通过此 <a href="https://wandb.ai/sayakpaul/text2image-finetune-minsnr" rel="nofollow">Weights and Biases</a> 报告比较不同 <code>snr_gamma</code> 值的损失曲面。小数据集上Min-SNR效果可能不如大数据集显著。',Pe,ne,qe,se,Rt='数据集预处理代码和训练循环位于 <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L490" rel="nofollow"><code>main()</code></a> 函数，自定义修改需在此处进行。',De,ae,Ct='<code>train_text_to_image</code> 脚本首先 <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L543" rel="nofollow">加载调度器</a> 和分词器，此处可替换其他调度器：',Oe,pe,Ke,ie,Xt='接着 <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L619" rel="nofollow">加载UNet模型</a>：',et,me,tt,fe,Gt='随后对数据集的文本和图像列进行预处理。<a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L724" rel="nofollow"><code>tokenize_captions</code></a> 函数处理文本分词，<a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L742" rel="nofollow"><code>train_transforms</code></a> 定义图像增强策略，二者集成于 <code>preprocess_train</code>：',lt,oe,nt,re,vt='最后，<a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L878" rel="nofollow">训练循环</a> 处理剩余流程：图像编码为潜空间、添加噪声、计算文本嵌入条件、更新模型参数、保存并推送模型至Hub。想深入了解训练循环原理，可参阅 <a href="../using-diffusers/write_own_pipeline">理解管道、模型与调度器</a> 教程，该教程解析了去噪过程的核心逻辑。',st,ce,at,ue,Bt="完成所有配置后，即可启动训练脚本！🚀",pt,G,it,$e,Vt="训练完成后，即可使用新模型进行推理：",mt,v,ft,Me,ot,de,kt="恭喜完成文生图模型训练！如需进一步使用模型，以下指南可能有所帮助：",rt,_e,Yt='<li>了解如何加载 <a href="../using-diffusers/loading_adapters#LoRA">LoRA权重</a> 进行推理（如果训练时使用了LoRA）</li> <li>在 <a href="../using-diffusers/conditional_image_generation">文生图</a> 任务指南中，了解引导尺度等参数或提示词加权等技术如何控制生成效果</li>',ct,be,ut,ye,$t;return p=new he({props:{title:"文生图",local:"文生图",headingTag:"h1"}}),w=new we({props:{warning:!0,$$slots:{default:[el]},$$scope:{ctx:T}}}),k=new Z({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}}),R=new Mt({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[nl]},$$scope:{ctx:T}}}),C=new we({props:{$$slots:{default:[sl]},$$scope:{ctx:T}}}),H=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),L=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),E=new Z({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}}),Q=new he({props:{title:"脚本参数",local:"脚本参数",headingTag:"h2"}}),X=new we({props:{$$slots:{default:[al]},$$scope:{ctx:T}}}),P=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3RleHRfdG9faW1hZ2UucHklMjAlNUMlMEElMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjI=",highlighted:`accelerate launch train_text_to_image.py \\
  --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span>`,wrap:!1}}),O=new he({props:{title:"Min-SNR加权策略",local:"min-snr加权策略",headingTag:"h3"}}),te=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3RleHRfdG9faW1hZ2UucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_text_to_image.py \\
  --snr_gamma=5.0`,wrap:!1}}),ne=new he({props:{title:"训练脚本解析",local:"训练脚本解析",headingTag:"h2"}}),pe=new Z({props:{code:"bm9pc2Vfc2NoZWR1bGVyJTIwJTNEJTIwRERQTVNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQoYXJncy5wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUyQyUyMHN1YmZvbGRlciUzRCUyMnNjaGVkdWxlciUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBDTElQVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBhcmdzLnByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIydG9rZW5pemVyJTIyJTJDJTIwcmV2aXNpb24lM0RhcmdzLnJldmlzaW9uJTBBKQ==",highlighted:`noise_scheduler = DDPMScheduler.from_pretrained(args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
tokenizer = CLIPTokenizer.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;tokenizer&quot;</span>, revision=args.revision
)`,wrap:!1}}),me=new Z({props:{code:"bG9hZF9tb2RlbCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZChpbnB1dF9kaXIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyKSUwQW1vZGVsLnJlZ2lzdGVyX3RvX2NvbmZpZygqKmxvYWRfbW9kZWwuY29uZmlnKSUwQSUwQW1vZGVsLmxvYWRfc3RhdGVfZGljdChsb2FkX21vZGVsLnN0YXRlX2RpY3QoKSk=",highlighted:`load_model = UNet2DConditionModel.from_pretrained(input_dir, subfolder=<span class="hljs-string">&quot;unet&quot;</span>)
model.register_to_config(**load_model.config)

model.load_state_dict(load_model.state_dict())`,wrap:!1}}),oe=new Z({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc190cmFpbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjAlNUJpbWFnZS5jb252ZXJ0KCUyMlJHQiUyMiklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZXMlNUJpbWFnZV9jb2x1bW4lNUQlNUQlMEElMjAlMjAlMjAlMjBleGFtcGxlcyU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1QnRyYWluX3RyYW5zZm9ybXMoaW1hZ2UpJTIwZm9yJTIwaW1hZ2UlMjBpbiUyMGltYWdlcyU1RCUwQSUyMCUyMCUyMCUyMGV4YW1wbGVzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTIwJTNEJTIwdG9rZW5pemVfY2FwdGlvbnMoZXhhbXBsZXMpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZXM=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_train</span>(<span class="hljs-params">examples</span>):
    images = [image.convert(<span class="hljs-string">&quot;RGB&quot;</span>) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> examples[image_column]]
    examples[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [train_transforms(image) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> images]
    examples[<span class="hljs-string">&quot;input_ids&quot;</span>] = tokenize_captions(examples)
    <span class="hljs-keyword">return</span> examples`,wrap:!1}}),ce=new he({props:{title:"启动脚本",local:"启动脚本",headingTag:"h2"}}),G=new Mt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[ol]},$$scope:{ctx:T}}}),v=new Mt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[ul]},$$scope:{ctx:T}}}),Me=new he({props:{title:"后续步骤",local:"后续步骤",headingTag:"h2"}}),be=new Kt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/training/text2image.md"}}),{c(){t=u("meta"),i=m(),n=u("p"),o=m(),M(p.$$.fragment),r=m(),M(w.$$.fragment),c=m(),J=u("p"),J.textContent=x,y=m(),j=u("p"),j.innerHTML=Ue,Te=m(),B=u("p"),B.innerHTML=dt,Je=m(),V=u("p"),V.textContent=_t,je=m(),M(k.$$.fragment),Ze=m(),Y=u("p"),Y.textContent=bt,xe=m(),M(R.$$.fragment),We=m(),M(C.$$.fragment),Re=m(),N=u("p"),N.textContent=ht,Ce=m(),M(H.$$.fragment),Xe=m(),F=u("p"),F.textContent=gt,Ge=m(),M(L.$$.fragment),ve=m(),I=u("p"),I.textContent=Ut,Be=m(),M(E.$$.fragment),Ve=m(),S=u("p"),S.innerHTML=yt,ke=m(),M(Q.$$.fragment),Ye=m(),M(X.$$.fragment),Ne=m(),z=u("p"),z.innerHTML=wt,He=m(),A=u("p"),A.textContent=Tt,Fe=m(),M(P.$$.fragment),Le=m(),q=u("p"),q.textContent=Jt,Ie=m(),D=u("ul"),D.innerHTML=jt,Ee=m(),M(O.$$.fragment),Se=m(),K=u("p"),K.innerHTML=Zt,Qe=m(),ee=u("p"),ee.innerHTML=xt,ze=m(),M(te.$$.fragment),Ae=m(),le=u("p"),le.innerHTML=Wt,Pe=m(),M(ne.$$.fragment),qe=m(),se=u("p"),se.innerHTML=Rt,De=m(),ae=u("p"),ae.innerHTML=Ct,Oe=m(),M(pe.$$.fragment),Ke=m(),ie=u("p"),ie.innerHTML=Xt,et=m(),M(me.$$.fragment),tt=m(),fe=u("p"),fe.innerHTML=Gt,lt=m(),M(oe.$$.fragment),nt=m(),re=u("p"),re.innerHTML=vt,st=m(),M(ce.$$.fragment),at=m(),ue=u("p"),ue.textContent=Bt,pt=m(),M(G.$$.fragment),it=m(),$e=u("p"),$e.textContent=Vt,mt=m(),M(v.$$.fragment),ft=m(),M(Me.$$.fragment),ot=m(),de=u("p"),de.textContent=kt,rt=m(),_e=u("ul"),_e.innerHTML=Yt,ct=m(),M(be.$$.fragment),ut=m(),ye=u("p"),this.h()},l(e){const l=Dt("svelte-u9bgzb",document.head);t=$(l,"META",{name:!0,content:!0}),l.forEach(s),i=f(e),n=$(e,"P",{}),St(n).forEach(s),o=f(e),d(p.$$.fragment,e),r=f(e),d(w.$$.fragment,e),c=f(e),J=$(e,"P",{"data-svelte-h":!0}),U(J)!=="svelte-1c3ggng"&&(J.textContent=x),y=f(e),j=$(e,"P",{"data-svelte-h":!0}),U(j)!=="svelte-tf4mti"&&(j.innerHTML=Ue),Te=f(e),B=$(e,"P",{"data-svelte-h":!0}),U(B)!=="svelte-mmr0em"&&(B.innerHTML=dt),Je=f(e),V=$(e,"P",{"data-svelte-h":!0}),U(V)!=="svelte-mwjd95"&&(V.textContent=_t),je=f(e),d(k.$$.fragment,e),Ze=f(e),Y=$(e,"P",{"data-svelte-h":!0}),U(Y)!=="svelte-ie0m52"&&(Y.textContent=bt),xe=f(e),d(R.$$.fragment,e),We=f(e),d(C.$$.fragment,e),Re=f(e),N=$(e,"P",{"data-svelte-h":!0}),U(N)!=="svelte-2mxnyi"&&(N.textContent=ht),Ce=f(e),d(H.$$.fragment,e),Xe=f(e),F=$(e,"P",{"data-svelte-h":!0}),U(F)!=="svelte-8qo0b1"&&(F.textContent=gt),Ge=f(e),d(L.$$.fragment,e),ve=f(e),I=$(e,"P",{"data-svelte-h":!0}),U(I)!=="svelte-1hg4sov"&&(I.textContent=Ut),Be=f(e),d(E.$$.fragment,e),Ve=f(e),S=$(e,"P",{"data-svelte-h":!0}),U(S)!=="svelte-1g3ykjk"&&(S.innerHTML=yt),ke=f(e),d(Q.$$.fragment,e),Ye=f(e),d(X.$$.fragment,e),Ne=f(e),z=$(e,"P",{"data-svelte-h":!0}),U(z)!=="svelte-1fyn80r"&&(z.innerHTML=wt),He=f(e),A=$(e,"P",{"data-svelte-h":!0}),U(A)!=="svelte-je3eqx"&&(A.textContent=Tt),Fe=f(e),d(P.$$.fragment,e),Le=f(e),q=$(e,"P",{"data-svelte-h":!0}),U(q)!=="svelte-urfoa3"&&(q.textContent=Jt),Ie=f(e),D=$(e,"UL",{"data-svelte-h":!0}),U(D)!=="svelte-vs9gl3"&&(D.innerHTML=jt),Ee=f(e),d(O.$$.fragment,e),Se=f(e),K=$(e,"P",{"data-svelte-h":!0}),U(K)!=="svelte-1kealoa"&&(K.innerHTML=Zt),Qe=f(e),ee=$(e,"P",{"data-svelte-h":!0}),U(ee)!=="svelte-13rrc02"&&(ee.innerHTML=xt),ze=f(e),d(te.$$.fragment,e),Ae=f(e),le=$(e,"P",{"data-svelte-h":!0}),U(le)!=="svelte-p650kw"&&(le.innerHTML=Wt),Pe=f(e),d(ne.$$.fragment,e),qe=f(e),se=$(e,"P",{"data-svelte-h":!0}),U(se)!=="svelte-wh0i5"&&(se.innerHTML=Rt),De=f(e),ae=$(e,"P",{"data-svelte-h":!0}),U(ae)!=="svelte-1nlf1uu"&&(ae.innerHTML=Ct),Oe=f(e),d(pe.$$.fragment,e),Ke=f(e),ie=$(e,"P",{"data-svelte-h":!0}),U(ie)!=="svelte-18tiko3"&&(ie.innerHTML=Xt),et=f(e),d(me.$$.fragment,e),tt=f(e),fe=$(e,"P",{"data-svelte-h":!0}),U(fe)!=="svelte-cpfd0u"&&(fe.innerHTML=Gt),lt=f(e),d(oe.$$.fragment,e),nt=f(e),re=$(e,"P",{"data-svelte-h":!0}),U(re)!=="svelte-2hmlty"&&(re.innerHTML=vt),st=f(e),d(ce.$$.fragment,e),at=f(e),ue=$(e,"P",{"data-svelte-h":!0}),U(ue)!=="svelte-mxmxgt"&&(ue.textContent=Bt),pt=f(e),d(G.$$.fragment,e),it=f(e),$e=$(e,"P",{"data-svelte-h":!0}),U($e)!=="svelte-hxct76"&&($e.textContent=Vt),mt=f(e),d(v.$$.fragment,e),ft=f(e),d(Me.$$.fragment,e),ot=f(e),de=$(e,"P",{"data-svelte-h":!0}),U(de)!=="svelte-19kknl"&&(de.textContent=kt),rt=f(e),_e=$(e,"UL",{"data-svelte-h":!0}),U(_e)!=="svelte-1tmdo3u"&&(_e.innerHTML=Yt),ct=f(e),d(be.$$.fragment,e),ut=f(e),ye=$(e,"P",{}),St(ye).forEach(s),this.h()},h(){Qt(t,"name","hf:doc:metadata"),Qt(t,"content",Ml)},m(e,l){Ot(document.head,t),a(e,i,l),a(e,n,l),a(e,o,l),_(p,e,l),a(e,r,l),_(w,e,l),a(e,c,l),a(e,J,l),a(e,y,l),a(e,j,l),a(e,Te,l),a(e,B,l),a(e,Je,l),a(e,V,l),a(e,je,l),_(k,e,l),a(e,Ze,l),a(e,Y,l),a(e,xe,l),_(R,e,l),a(e,We,l),_(C,e,l),a(e,Re,l),a(e,N,l),a(e,Ce,l),_(H,e,l),a(e,Xe,l),a(e,F,l),a(e,Ge,l),_(L,e,l),a(e,ve,l),a(e,I,l),a(e,Be,l),_(E,e,l),a(e,Ve,l),a(e,S,l),a(e,ke,l),_(Q,e,l),a(e,Ye,l),_(X,e,l),a(e,Ne,l),a(e,z,l),a(e,He,l),a(e,A,l),a(e,Fe,l),_(P,e,l),a(e,Le,l),a(e,q,l),a(e,Ie,l),a(e,D,l),a(e,Ee,l),_(O,e,l),a(e,Se,l),a(e,K,l),a(e,Qe,l),a(e,ee,l),a(e,ze,l),_(te,e,l),a(e,Ae,l),a(e,le,l),a(e,Pe,l),_(ne,e,l),a(e,qe,l),a(e,se,l),a(e,De,l),a(e,ae,l),a(e,Oe,l),_(pe,e,l),a(e,Ke,l),a(e,ie,l),a(e,et,l),_(me,e,l),a(e,tt,l),a(e,fe,l),a(e,lt,l),_(oe,e,l),a(e,nt,l),a(e,re,l),a(e,st,l),_(ce,e,l),a(e,at,l),a(e,ue,l),a(e,pt,l),_(G,e,l),a(e,it,l),a(e,$e,l),a(e,mt,l),_(v,e,l),a(e,ft,l),_(Me,e,l),a(e,ot,l),a(e,de,l),a(e,rt,l),a(e,_e,l),a(e,ct,l),_(be,e,l),a(e,ut,l),a(e,ye,l),$t=!0},p(e,[l]){const Nt={};l&2&&(Nt.$$scope={dirty:l,ctx:e}),w.$set(Nt);const Ht={};l&2&&(Ht.$$scope={dirty:l,ctx:e}),R.$set(Ht);const Ft={};l&2&&(Ft.$$scope={dirty:l,ctx:e}),C.$set(Ft);const Lt={};l&2&&(Lt.$$scope={dirty:l,ctx:e}),X.$set(Lt);const It={};l&2&&(It.$$scope={dirty:l,ctx:e}),G.$set(It);const Et={};l&2&&(Et.$$scope={dirty:l,ctx:e}),v.$set(Et)},i(e){$t||(b(p.$$.fragment,e),b(w.$$.fragment,e),b(k.$$.fragment,e),b(R.$$.fragment,e),b(C.$$.fragment,e),b(H.$$.fragment,e),b(L.$$.fragment,e),b(E.$$.fragment,e),b(Q.$$.fragment,e),b(X.$$.fragment,e),b(P.$$.fragment,e),b(O.$$.fragment,e),b(te.$$.fragment,e),b(ne.$$.fragment,e),b(pe.$$.fragment,e),b(me.$$.fragment,e),b(oe.$$.fragment,e),b(ce.$$.fragment,e),b(G.$$.fragment,e),b(v.$$.fragment,e),b(Me.$$.fragment,e),b(be.$$.fragment,e),$t=!0)},o(e){h(p.$$.fragment,e),h(w.$$.fragment,e),h(k.$$.fragment,e),h(R.$$.fragment,e),h(C.$$.fragment,e),h(H.$$.fragment,e),h(L.$$.fragment,e),h(E.$$.fragment,e),h(Q.$$.fragment,e),h(X.$$.fragment,e),h(P.$$.fragment,e),h(O.$$.fragment,e),h(te.$$.fragment,e),h(ne.$$.fragment,e),h(pe.$$.fragment,e),h(me.$$.fragment,e),h(oe.$$.fragment,e),h(ce.$$.fragment,e),h(G.$$.fragment,e),h(v.$$.fragment,e),h(Me.$$.fragment,e),h(be.$$.fragment,e),$t=!1},d(e){e&&(s(i),s(n),s(o),s(r),s(c),s(J),s(y),s(j),s(Te),s(B),s(Je),s(V),s(je),s(Ze),s(Y),s(xe),s(We),s(Re),s(N),s(Ce),s(Xe),s(F),s(Ge),s(ve),s(I),s(Be),s(Ve),s(S),s(ke),s(Ye),s(Ne),s(z),s(He),s(A),s(Fe),s(Le),s(q),s(Ie),s(D),s(Ee),s(Se),s(K),s(Qe),s(ee),s(ze),s(Ae),s(le),s(Pe),s(qe),s(se),s(De),s(ae),s(Oe),s(Ke),s(ie),s(et),s(tt),s(fe),s(lt),s(nt),s(re),s(st),s(at),s(ue),s(pt),s(it),s($e),s(mt),s(ft),s(ot),s(de),s(rt),s(_e),s(ct),s(ut),s(ye)),s(t),g(p,e),g(w,e),g(k,e),g(R,e),g(C,e),g(H,e),g(L,e),g(E,e),g(Q,e),g(X,e),g(P,e),g(O,e),g(te,e),g(ne,e),g(pe,e),g(me,e),g(oe,e),g(ce,e),g(G,e),g(v,e),g(Me,e),g(be,e)}}}const Ml='{"title":"文生图","local":"文生图","sections":[{"title":"脚本参数","local":"脚本参数","sections":[{"title":"Min-SNR加权策略","local":"min-snr加权策略","sections":[],"depth":3}],"depth":2},{"title":"训练脚本解析","local":"训练脚本解析","sections":[],"depth":2},{"title":"启动脚本","local":"启动脚本","sections":[],"depth":2},{"title":"后续步骤","local":"后续步骤","sections":[],"depth":2}],"depth":1}';function dl(T){return At(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wl extends Pt{constructor(t){super(),qt(this,t,dl,$l,zt,{})}}export{wl as component};
