import{s as At,o as Qt,n as j}from"../chunks/scheduler.8c3d61f6.js";import{S as Pt,i as qt,g as u,s as r,r as h,A as Dt,h as d,f as l,c as p,j as St,u as $,x as _,k as zt,y as Kt,a as s,v as g,d as b,t as y,w as M}from"../chunks/index.589a98e8.js";import{T as Te}from"../chunks/Tip.42aa8582.js";import{C as Z}from"../chunks/CodeBlock.36627b28.js";import{H as ye,E as Ot}from"../chunks/EditOnGithub.e5a8d9cb.js";import{H as ht,a as Me}from"../chunks/HfOption.9804ab8b.js";function en(J){let t,o="The text-to-image script is experimental, and it’s easy to overfit and run into issues like catastrophic forgetting. Try exploring different hyperparameters to get the best results on your dataset.";return{c(){t=u("p"),t.textContent=o},l(a){t=d(a,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1we1bp2"&&(t.textContent=o)},m(a,m){s(a,t,m)},p:j,d(a){a&&l(t)}}}function tn(J){let t,o;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(){h(t.$$.fragment)},l(a){$(t.$$.fragment,a)},m(a,m){g(t,a,m),o=!0},p:j,i(a){o||(b(t.$$.fragment,a),o=!0)},o(a){y(t.$$.fragment,a),o=!1},d(a){M(t,a)}}}function nn(J){let t,o;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(){h(t.$$.fragment)},l(a){$(t.$$.fragment,a)},m(a,m){g(t,a,m),o=!0},p:j,i(a){o||(b(t.$$.fragment,a),o=!0)},o(a){y(t.$$.fragment,a),o=!1},d(a){M(t,a)}}}function an(J){let t,o,a,m;return t=new Me({props:{id:"installation",option:"PyTorch",$$slots:{default:[tn]},$$scope:{ctx:J}}}),a=new Me({props:{id:"installation",option:"Flax",$$slots:{default:[nn]},$$scope:{ctx:J}}}),{c(){h(t.$$.fragment),o=r(),h(a.$$.fragment)},l(i){$(t.$$.fragment,i),o=p(i),$(a.$$.fragment,i)},m(i,f){g(t,i,f),s(i,o,f),g(a,i,f),m=!0},p(i,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:i}),t.$set(T);const c={};f&2&&(c.$$scope={dirty:f,ctx:i}),a.$set(c)},i(i){m||(b(t.$$.fragment,i),b(a.$$.fragment,i),m=!0)},o(i){y(t.$$.fragment,i),y(a.$$.fragment,i),m=!1},d(i){i&&l(o),M(t,i),M(a,i)}}}function ln(J){let t,o='🤗 Accelerate is a library for helping you train on multiple GPUs/TPUs or with mixed-precision. It’ll automatically configure your training setup based on your hardware and environment. Take a look at the 🤗 Accelerate <a href="https://huggingface.co/docs/accelerate/quicktour" rel="nofollow">Quick tour</a> to learn more.';return{c(){t=u("p"),t.innerHTML=o},l(a){t=d(a,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1qbiqsn"&&(t.innerHTML=o)},m(a,m){s(a,t,m)},p:j,d(a){a&&l(t)}}}function sn(J){let t,o='The following sections highlight parts of the training script that are important for understanding how to modify it, but it doesn’t cover every aspect of the script in detail. If you’re interested in learning more, feel free to read through the <a href="https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py" rel="nofollow">script</a> and let us know if you have any questions or concerns.';return{c(){t=u("p"),t.innerHTML=o},l(a){t=d(a,"P",{"data-svelte-h":!0}),_(t)!=="svelte-5wvv6y"&&(t.innerHTML=o)},m(a,m){s(a,t,m)},p:j,d(a){a&&l(t)}}}function on(J){let t,o="To train on a local dataset, set the <code>TRAIN_DIR</code> and <code>OUTPUT_DIR</code> environment variables to the path of the dataset and where to save the model to.";return{c(){t=u("p"),t.innerHTML=o},l(a){t=d(a,"P",{"data-svelte-h":!0}),_(t)!=="svelte-21tcs5"&&(t.innerHTML=o)},m(a,m){s(a,t,m)},p:j,d(a){a&&l(t)}}}function rn(J){let t,o='Let’s train on the <a href="https://huggingface.co/datasets/lambdalabs/naruto-blip-captions" rel="nofollow">Naruto BLIP captions</a> dataset to generate your own Naruto characters. Set the environment variables <code>MODEL_NAME</code> and <code>dataset_name</code> to the model and the dataset (either from the Hub or a local path). If you’re training on more than one GPU, add the <code>--multi_gpu</code> parameter to the <code>accelerate launch</code> command.',a,m,i,f,T;return m=new Te({props:{$$slots:{default:[on]},$$scope:{ctx:J}}}),f=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwZGF0YXNldF9uYW1lJTNEJTIybGFtYmRhbGFicyUyRm5hcnV0by1ibGlwLWNhcHRpb25zJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMCUyMHRyYWluX3RleHRfdG9faW1hZ2UucHklMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCU1QyUwQSUyMCUyMC0tZGF0YXNldF9uYW1lJTNEJTI0ZGF0YXNldF9uYW1lJTIwJTVDJTBBJTIwJTIwLS11c2VfZW1hJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwLS1jZW50ZXJfY3JvcCUyMC0tcmFuZG9tX2ZsaXAlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9jaGVja3BvaW50aW5nJTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0QxNTAwMCUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTA1JTIwJTVDJTBBJTIwJTIwLS1tYXhfZ3JhZF9ub3JtJTNEMSUyMCU1QyUwQSUyMCUyMC0tZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uJTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyMnNkLW5hcnV0by1tb2RlbCUyMiUyMCU1QyUwQSUyMCUyMC0tcHVzaF90b19odWI=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;runwayml/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=o,a=r(),h(m.$$.fragment),i=r(),h(f.$$.fragment)},l(c){t=d(c,"P",{"data-svelte-h":!0}),_(t)!=="svelte-9diks3"&&(t.innerHTML=o),a=p(c),$(m.$$.fragment,c),i=p(c),$(f.$$.fragment,c)},m(c,U){s(c,t,U),s(c,a,U),g(m,c,U),s(c,i,U),g(f,c,U),T=!0},p(c,U){const v={};U&2&&(v.$$scope={dirty:U,ctx:c}),m.$set(v)},i(c){T||(b(m.$$.fragment,c),b(f.$$.fragment,c),T=!0)},o(c){y(m.$$.fragment,c),y(f.$$.fragment,c),T=!1},d(c){c&&(l(t),l(a),l(i)),M(m,c),M(f,c)}}}function pn(J){let t,o="To train on a local dataset, set the <code>TRAIN_DIR</code> and <code>OUTPUT_DIR</code> environment variables to the path of the dataset and where to save the model to.";return{c(){t=u("p"),t.innerHTML=o},l(a){t=d(a,"P",{"data-svelte-h":!0}),_(t)!=="svelte-21tcs5"&&(t.innerHTML=o)},m(a,m){s(a,t,m)},p:j,d(a){a&&l(t)}}}function mn(J){let t,o='Training with Flax can be faster on TPUs and GPUs thanks to <a href="https://github.com/duongna21" rel="nofollow">@duongna211</a>. Flax is more efficient on a TPU, but GPU performance is also great.',a,m,i="Set the environment variables <code>MODEL_NAME</code> and <code>dataset_name</code> to the model and the dataset (either from the Hub or a local path).",f,T,c,U,v;return T=new Te({props:{$$slots:{default:[pn]},$$scope:{ctx:J}}}),U=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwZGF0YXNldF9uYW1lJTNEJTIybGFtYmRhbGFicyUyRm5hcnV0by1ibGlwLWNhcHRpb25zJTIyJTBBJTBBcHl0aG9uJTIwdHJhaW5fdGV4dF90b19pbWFnZV9mbGF4LnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlNUMlMEElMjAlMjAtLWRhdGFzZXRfbmFtZSUzRCUyNGRhdGFzZXRfbmFtZSUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMC0tY2VudGVyX2Nyb3AlMjAtLXJhbmRvbV9mbGlwJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEMTUwMDAlMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0QxZS0wNSUyMCU1QyUwQSUyMCUyMC0tbWF4X2dyYWRfbm9ybSUzRDElMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjJzZC1uYXJ1dG8tbW9kZWwlMjIlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;runwayml/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=o,a=r(),m=u("p"),m.innerHTML=i,f=r(),h(T.$$.fragment),c=r(),h(U.$$.fragment)},l(w){t=d(w,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1sxlda3"&&(t.innerHTML=o),a=p(w),m=d(w,"P",{"data-svelte-h":!0}),_(m)!=="svelte-1shpxr8"&&(m.innerHTML=i),f=p(w),$(T.$$.fragment,w),c=p(w),$(U.$$.fragment,w)},m(w,x){s(w,t,x),s(w,a,x),s(w,m,x),s(w,f,x),g(T,w,x),s(w,c,x),g(U,w,x),v=!0},p(w,x){const _e={};x&2&&(_e.$$scope={dirty:x,ctx:w}),T.$set(_e)},i(w){v||(b(T.$$.fragment,w),b(U.$$.fragment,w),v=!0)},o(w){y(T.$$.fragment,w),y(U.$$.fragment,w),v=!1},d(w){w&&(l(t),l(a),l(m),l(f),l(c)),M(T,w),M(U,w)}}}function fn(J){let t,o,a,m;return t=new Me({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[rn]},$$scope:{ctx:J}}}),a=new Me({props:{id:"training-inference",option:"Flax",$$slots:{default:[mn]},$$scope:{ctx:J}}}),{c(){h(t.$$.fragment),o=r(),h(a.$$.fragment)},l(i){$(t.$$.fragment,i),o=p(i),$(a.$$.fragment,i)},m(i,f){g(t,i,f),s(i,o,f),g(a,i,f),m=!0},p(i,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:i}),t.$set(T);const c={};f&2&&(c.$$scope={dirty:f,ctx:i}),a.$set(c)},i(i){m||(b(t.$$.fragment,i),b(a.$$.fragment,i),m=!0)},o(i){y(t.$$.fragment,i),y(a.$$.fragment,i),m=!1},d(i){i&&l(o),M(t,i),M(a,i)}}}function cn(J){let t,o;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(){h(t.$$.fragment)},l(a){$(t.$$.fragment,a)},m(a,m){g(t,a,m),o=!0},p:j,i(a){o||(b(t.$$.fragment,a),o=!0)},o(a){y(t.$$.fragment,a),o=!1},d(a){M(t,a)}}}function un(J){let t,o;return t=new Z({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsYXgudHJhaW5pbmcuY29tbW9uX3V0aWxzJTIwaW1wb3J0JTIwc2hhcmQlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmxheFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4U3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdGglMkZ0byUyRnNhdmVkX21vZGVsJTIyJTJDJTIwZHR5cGUlM0RqYXgubnVtcHkuYmZsb2F0MTYpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyeW9kYSUyMG5hcnV0byUyMiUwQXBybmdfc2VlZCUyMCUzRCUyMGpheC5yYW5kb20uUFJOR0tleSgwKSUwQW51bV9pbmZlcmVuY2Vfc3RlcHMlMjAlM0QlMjA1MCUwQSUwQW51bV9zYW1wbGVzJTIwJTNEJTIwamF4LmRldmljZV9jb3VudCgpJTBBcHJvbXB0JTIwJTNEJTIwbnVtX3NhbXBsZXMlMjAqJTIwJTVCcHJvbXB0JTVEJTBBcHJvbXB0X2lkcyUyMCUzRCUyMHBpcGVsaW5lLnByZXBhcmVfaW5wdXRzKHByb21wdCklMEElMEElMjMlMjBzaGFyZCUyMGlucHV0cyUyMGFuZCUyMHJuZyUwQXBhcmFtcyUyMCUzRCUyMHJlcGxpY2F0ZShwYXJhbXMpJTBBcHJuZ19zZWVkJTIwJTNEJTIwamF4LnJhbmRvbS5zcGxpdChwcm5nX3NlZWQlMkMlMjBqYXguZGV2aWNlX2NvdW50KCkpJTBBcHJvbXB0X2lkcyUyMCUzRCUyMHNoYXJkKHByb21wdF9pZHMpJTBBJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0X2lkcyUyQyUyMHBhcmFtcyUyQyUyMHBybmdfc2VlZCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlMkMlMjBqaXQlM0RUcnVlKS5pbWFnZXMlMEFpbWFnZXMlMjAlM0QlMjBwaXBlbGluZS5udW1weV90b19waWwobnAuYXNhcnJheShpbWFnZXMucmVzaGFwZSgobnVtX3NhbXBsZXMlMkMpJTIwJTJCJTIwaW1hZ2VzLnNoYXBlJTVCLTMlM0ElNUQpKSklMEFpbWFnZS5zYXZlKCUyMnlvZGEtbmFydXRvLnBuZyUyMik=",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"># shard inputs and rng</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(){h(t.$$.fragment)},l(a){$(t.$$.fragment,a)},m(a,m){g(t,a,m),o=!0},p:j,i(a){o||(b(t.$$.fragment,a),o=!0)},o(a){y(t.$$.fragment,a),o=!1},d(a){M(t,a)}}}function dn(J){let t,o,a,m;return t=new Me({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[cn]},$$scope:{ctx:J}}}),a=new Me({props:{id:"training-inference",option:"Flax",$$slots:{default:[un]},$$scope:{ctx:J}}}),{c(){h(t.$$.fragment),o=r(),h(a.$$.fragment)},l(i){$(t.$$.fragment,i),o=p(i),$(a.$$.fragment,i)},m(i,f){g(t,i,f),s(i,o,f),g(a,i,f),m=!0},p(i,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:i}),t.$set(T);const c={};f&2&&(c.$$scope={dirty:f,ctx:i}),a.$set(c)},i(i){m||(b(t.$$.fragment,i),b(a.$$.fragment,i),m=!0)},o(i){y(t.$$.fragment,i),y(a.$$.fragment,i),m=!1},d(i){i&&l(o),M(t,i),M(a,i)}}}function hn(J){let t,o,a,m,i,f,T,c,U,v="Text-to-image models like Stable Diffusion are conditioned to generate images given a text prompt.",w,x,_e='Training a model can be taxing on your hardware, but if you enable <code>gradient_checkpointing</code> and <code>mixed_precision</code>, it is possible to train a model on a single 24GB GPU. If you’re training with larger batch sizes or want to train faster, it’s better to use GPUs with more than 30GB of memory. You can reduce your memory footprint by enabling memory-efficient attention with <a href="../optimization/xformers">xFormers</a>. JAX/Flax training is also supported for efficient training on TPUs and GPUs, but it doesn’t support gradient checkpointing, gradient accumulation or xFormers. A GPU with at least 30GB of memory or a TPU v3 is recommended for training with Flax.',Je,G,$t='This guide will explore the <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> training script to help you become familiar with it, and how you can adapt it for your own use-case.',Ue,k,gt="Before running the script, make sure you install the library from source:",xe,V,Ze,H,bt="Then navigate to the example folder containing the training script and install the required dependencies for the script you’re using:",ve,W,je,C,We,I,yt="Initialize an 🤗 Accelerate environment:",Ce,F,Xe,L,Mt="To setup a default 🤗 Accelerate environment without choosing any configurations:",Be,N,Re,Y,_t="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",Ge,E,ke,S,wt='Lastly, if you want to train a model on your own dataset, take a look at the <a href="create_dataset">Create a dataset for training</a> guide to learn how to create a dataset that works with the training script.',Ve,z,He,X,Ie,A,Tt='The training script provides many parameters to help you customize your training run. All of the parameters and their descriptions are found in the <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> function. This function provides default values for each parameter, such as the training batch size and learning rate, but you can also set your own values in the training command if you’d like.',Fe,Q,Jt="For example, to speedup training with mixed precision using the fp16 format, add the <code>--mixed_precision</code> parameter to the training command:",Le,P,Ne,q,Ut="Some basic and important parameters include:",Ye,D,xt="<li><code>--pretrained_model_name_or_path</code>: the name of the model on the Hub or a local path to the pretrained model</li> <li><code>--dataset_name</code>: the name of the dataset on the Hub or a local path to the dataset to train on</li> <li><code>--image_column</code>: the name of the image column in the dataset to train on</li> <li><code>--caption_column</code>: the name of the text column in the dataset to train on</li> <li><code>--output_dir</code>: where to save the trained model</li> <li><code>--push_to_hub</code>: whether to push the trained model to the Hub</li> <li><code>--checkpointing_steps</code>: frequency of saving a checkpoint as the model trains; this is useful if for some reason training is interrupted, you can continue training from that checkpoint by adding <code>--resume_from_checkpoint</code> to your training command</li>",Ee,K,Se,O,Zt='The <a href="https://huggingface.co/papers/2303.09556" rel="nofollow">Min-SNR</a> weighting strategy can help with training by rebalancing the loss to achieve faster convergence. The training script supports predicting <code>epsilon</code> (noise) or <code>v_prediction</code>, but Min-SNR is compatible with both prediction types. This weighting strategy is only supported by PyTorch and is unavailable in the Flax training script.',ze,ee,vt="Add the <code>--snr_gamma</code> parameter and set it to the recommended value of 5.0:",Ae,te,Qe,ne,jt='You can compare the loss surfaces for different <code>snr_gamma</code> values in this <a href="https://wandb.ai/sayakpaul/text2image-finetune-minsnr" rel="nofollow">Weights and Biases</a> report. For smaller datasets, the effects of Min-SNR may not be as obvious compared to larger datasets.',Pe,ae,qe,le,Wt='The dataset preprocessing code and training loop are found in the <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> function. If you need to adapt the training script, this is where you’ll need to make your changes.',De,se,Ct='The <code>train_text_to_image</code> script starts by <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L543" rel="nofollow">loading a scheduler</a> and tokenizer. You can choose to use a different scheduler here if you want:',Ke,ie,Oe,oe,Xt='Then the script <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L619" rel="nofollow">loads the UNet</a> model:',et,re,tt,pe,Bt='Next, the text and image columns of the dataset need to be preprocessed. The <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> function handles tokenizing the inputs, and the <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> function specifies the type of transforms to apply to the image. Both of these functions are bundled into <code>preprocess_train</code>:',nt,me,at,fe,Rt='Lastly, the <a href="https://github.com/huggingface/diffusers/blob/8959c5b9dec1c94d6ba482c94a58d2215c5fd026/examples/text_to_image/train_text_to_image.py#L878" rel="nofollow">training loop</a> handles everything else. It encodes images into latent space, adds noise to the latents, computes the text embeddings to condition on, updates the model parameters, and saves and pushes the model to the Hub. If you want to learn more about how the training loop works, check out the <a href="../using-diffusers/write_own_pipeline">Understanding pipelines, models and schedulers</a> tutorial which breaks down the basic pattern of the denoising process.',lt,ce,st,ue,Gt="Once you’ve made all your changes or you’re okay with the default configuration, you’re ready to launch the training script! 🚀",it,B,ot,de,kt="Once training is complete, you can use your newly trained model for inference:",rt,R,pt,he,mt,$e,Vt="Congratulations on training your own text-to-image model! To learn more about how to use your new model, the following guides may be helpful:",ft,ge,Ht='<li>Learn how to <a href="../using-diffusers/loading_adapters#LoRA">load LoRA weights</a> for inference if you trained your model with LoRA.</li> <li>Learn more about how certain parameters like guidance scale or techniques such as prompt weighting can help you control inference in the <a href="../using-diffusers/conditional_image_generation">Text-to-image</a> task guide.</li>',ct,be,ut,we,dt;return i=new ye({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h1"}}),T=new Te({props:{warning:!0,$$slots:{default:[en]},$$scope:{ctx:J}}}),V=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}}),W=new ht({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[an]},$$scope:{ctx:J}}}),C=new Te({props:{$$slots:{default:[ln]},$$scope:{ctx:J}}}),F=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),N=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}}),z=new ye({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),X=new Te({props:{$$slots:{default:[sn]},$$scope:{ctx:J}}}),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}}),K=new ye({props:{title:"Min-SNR weighting",local:"min-snr-weighting",headingTag:"h3"}}),te=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3RleHRfdG9faW1hZ2UucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_text_to_image.py \\
  --snr_gamma=5.0`,wrap:!1}}),ae=new ye({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),ie=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}}),re=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}}),me=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 ye({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),B=new ht({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[fn]},$$scope:{ctx:J}}}),R=new ht({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[dn]},$$scope:{ctx:J}}}),he=new ye({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),be=new Ot({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/training/text2image.md"}}),{c(){t=u("meta"),o=r(),a=u("p"),m=r(),h(i.$$.fragment),f=r(),h(T.$$.fragment),c=r(),U=u("p"),U.textContent=v,w=r(),x=u("p"),x.innerHTML=_e,Je=r(),G=u("p"),G.innerHTML=$t,Ue=r(),k=u("p"),k.textContent=gt,xe=r(),h(V.$$.fragment),Ze=r(),H=u("p"),H.textContent=bt,ve=r(),h(W.$$.fragment),je=r(),h(C.$$.fragment),We=r(),I=u("p"),I.textContent=yt,Ce=r(),h(F.$$.fragment),Xe=r(),L=u("p"),L.textContent=Mt,Be=r(),h(N.$$.fragment),Re=r(),Y=u("p"),Y.textContent=_t,Ge=r(),h(E.$$.fragment),ke=r(),S=u("p"),S.innerHTML=wt,Ve=r(),h(z.$$.fragment),He=r(),h(X.$$.fragment),Ie=r(),A=u("p"),A.innerHTML=Tt,Fe=r(),Q=u("p"),Q.innerHTML=Jt,Le=r(),h(P.$$.fragment),Ne=r(),q=u("p"),q.textContent=Ut,Ye=r(),D=u("ul"),D.innerHTML=xt,Ee=r(),h(K.$$.fragment),Se=r(),O=u("p"),O.innerHTML=Zt,ze=r(),ee=u("p"),ee.innerHTML=vt,Ae=r(),h(te.$$.fragment),Qe=r(),ne=u("p"),ne.innerHTML=jt,Pe=r(),h(ae.$$.fragment),qe=r(),le=u("p"),le.innerHTML=Wt,De=r(),se=u("p"),se.innerHTML=Ct,Ke=r(),h(ie.$$.fragment),Oe=r(),oe=u("p"),oe.innerHTML=Xt,et=r(),h(re.$$.fragment),tt=r(),pe=u("p"),pe.innerHTML=Bt,nt=r(),h(me.$$.fragment),at=r(),fe=u("p"),fe.innerHTML=Rt,lt=r(),h(ce.$$.fragment),st=r(),ue=u("p"),ue.textContent=Gt,it=r(),h(B.$$.fragment),ot=r(),de=u("p"),de.textContent=kt,rt=r(),h(R.$$.fragment),pt=r(),h(he.$$.fragment),mt=r(),$e=u("p"),$e.textContent=Vt,ft=r(),ge=u("ul"),ge.innerHTML=Ht,ct=r(),h(be.$$.fragment),ut=r(),we=u("p"),this.h()},l(e){const n=Dt("svelte-u9bgzb",document.head);t=d(n,"META",{name:!0,content:!0}),n.forEach(l),o=p(e),a=d(e,"P",{}),St(a).forEach(l),m=p(e),$(i.$$.fragment,e),f=p(e),$(T.$$.fragment,e),c=p(e),U=d(e,"P",{"data-svelte-h":!0}),_(U)!=="svelte-1y4tuwx"&&(U.textContent=v),w=p(e),x=d(e,"P",{"data-svelte-h":!0}),_(x)!=="svelte-1aeplm2"&&(x.innerHTML=_e),Je=p(e),G=d(e,"P",{"data-svelte-h":!0}),_(G)!=="svelte-1n3skb8"&&(G.innerHTML=$t),Ue=p(e),k=d(e,"P",{"data-svelte-h":!0}),_(k)!=="svelte-l7dm2q"&&(k.textContent=gt),xe=p(e),$(V.$$.fragment,e),Ze=p(e),H=d(e,"P",{"data-svelte-h":!0}),_(H)!=="svelte-z4z0b9"&&(H.textContent=bt),ve=p(e),$(W.$$.fragment,e),je=p(e),$(C.$$.fragment,e),We=p(e),I=d(e,"P",{"data-svelte-h":!0}),_(I)!=="svelte-60q53m"&&(I.textContent=yt),Ce=p(e),$(F.$$.fragment,e),Xe=p(e),L=d(e,"P",{"data-svelte-h":!0}),_(L)!=="svelte-di6juu"&&(L.textContent=Mt),Be=p(e),$(N.$$.fragment,e),Re=p(e),Y=d(e,"P",{"data-svelte-h":!0}),_(Y)!=="svelte-tsz4qp"&&(Y.textContent=_t),Ge=p(e),$(E.$$.fragment,e),ke=p(e),S=d(e,"P",{"data-svelte-h":!0}),_(S)!=="svelte-1fkfdql"&&(S.innerHTML=wt),Ve=p(e),$(z.$$.fragment,e),He=p(e),$(X.$$.fragment,e),Ie=p(e),A=d(e,"P",{"data-svelte-h":!0}),_(A)!=="svelte-1rkoo94"&&(A.innerHTML=Tt),Fe=p(e),Q=d(e,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-1r0bv1x"&&(Q.innerHTML=Jt),Le=p(e),$(P.$$.fragment,e),Ne=p(e),q=d(e,"P",{"data-svelte-h":!0}),_(q)!=="svelte-1mzaa4h"&&(q.textContent=Ut),Ye=p(e),D=d(e,"UL",{"data-svelte-h":!0}),_(D)!=="svelte-l4ycdy"&&(D.innerHTML=xt),Ee=p(e),$(K.$$.fragment,e),Se=p(e),O=d(e,"P",{"data-svelte-h":!0}),_(O)!=="svelte-isitbv"&&(O.innerHTML=Zt),ze=p(e),ee=d(e,"P",{"data-svelte-h":!0}),_(ee)!=="svelte-tp3kp"&&(ee.innerHTML=vt),Ae=p(e),$(te.$$.fragment,e),Qe=p(e),ne=d(e,"P",{"data-svelte-h":!0}),_(ne)!=="svelte-1kq6d2e"&&(ne.innerHTML=jt),Pe=p(e),$(ae.$$.fragment,e),qe=p(e),le=d(e,"P",{"data-svelte-h":!0}),_(le)!=="svelte-1ibfk21"&&(le.innerHTML=Wt),De=p(e),se=d(e,"P",{"data-svelte-h":!0}),_(se)!=="svelte-1yog97t"&&(se.innerHTML=Ct),Ke=p(e),$(ie.$$.fragment,e),Oe=p(e),oe=d(e,"P",{"data-svelte-h":!0}),_(oe)!=="svelte-1au88ib"&&(oe.innerHTML=Xt),et=p(e),$(re.$$.fragment,e),tt=p(e),pe=d(e,"P",{"data-svelte-h":!0}),_(pe)!=="svelte-1e0707i"&&(pe.innerHTML=Bt),nt=p(e),$(me.$$.fragment,e),at=p(e),fe=d(e,"P",{"data-svelte-h":!0}),_(fe)!=="svelte-13vuqhc"&&(fe.innerHTML=Rt),lt=p(e),$(ce.$$.fragment,e),st=p(e),ue=d(e,"P",{"data-svelte-h":!0}),_(ue)!=="svelte-9dei1q"&&(ue.textContent=Gt),it=p(e),$(B.$$.fragment,e),ot=p(e),de=d(e,"P",{"data-svelte-h":!0}),_(de)!=="svelte-1jtuc6"&&(de.textContent=kt),rt=p(e),$(R.$$.fragment,e),pt=p(e),$(he.$$.fragment,e),mt=p(e),$e=d(e,"P",{"data-svelte-h":!0}),_($e)!=="svelte-127gxsw"&&($e.textContent=Vt),ft=p(e),ge=d(e,"UL",{"data-svelte-h":!0}),_(ge)!=="svelte-10nfhag"&&(ge.innerHTML=Ht),ct=p(e),$(be.$$.fragment,e),ut=p(e),we=d(e,"P",{}),St(we).forEach(l),this.h()},h(){zt(t,"name","hf:doc:metadata"),zt(t,"content",$n)},m(e,n){Kt(document.head,t),s(e,o,n),s(e,a,n),s(e,m,n),g(i,e,n),s(e,f,n),g(T,e,n),s(e,c,n),s(e,U,n),s(e,w,n),s(e,x,n),s(e,Je,n),s(e,G,n),s(e,Ue,n),s(e,k,n),s(e,xe,n),g(V,e,n),s(e,Ze,n),s(e,H,n),s(e,ve,n),g(W,e,n),s(e,je,n),g(C,e,n),s(e,We,n),s(e,I,n),s(e,Ce,n),g(F,e,n),s(e,Xe,n),s(e,L,n),s(e,Be,n),g(N,e,n),s(e,Re,n),s(e,Y,n),s(e,Ge,n),g(E,e,n),s(e,ke,n),s(e,S,n),s(e,Ve,n),g(z,e,n),s(e,He,n),g(X,e,n),s(e,Ie,n),s(e,A,n),s(e,Fe,n),s(e,Q,n),s(e,Le,n),g(P,e,n),s(e,Ne,n),s(e,q,n),s(e,Ye,n),s(e,D,n),s(e,Ee,n),g(K,e,n),s(e,Se,n),s(e,O,n),s(e,ze,n),s(e,ee,n),s(e,Ae,n),g(te,e,n),s(e,Qe,n),s(e,ne,n),s(e,Pe,n),g(ae,e,n),s(e,qe,n),s(e,le,n),s(e,De,n),s(e,se,n),s(e,Ke,n),g(ie,e,n),s(e,Oe,n),s(e,oe,n),s(e,et,n),g(re,e,n),s(e,tt,n),s(e,pe,n),s(e,nt,n),g(me,e,n),s(e,at,n),s(e,fe,n),s(e,lt,n),g(ce,e,n),s(e,st,n),s(e,ue,n),s(e,it,n),g(B,e,n),s(e,ot,n),s(e,de,n),s(e,rt,n),g(R,e,n),s(e,pt,n),g(he,e,n),s(e,mt,n),s(e,$e,n),s(e,ft,n),s(e,ge,n),s(e,ct,n),g(be,e,n),s(e,ut,n),s(e,we,n),dt=!0},p(e,[n]){const It={};n&2&&(It.$$scope={dirty:n,ctx:e}),T.$set(It);const Ft={};n&2&&(Ft.$$scope={dirty:n,ctx:e}),W.$set(Ft);const Lt={};n&2&&(Lt.$$scope={dirty:n,ctx:e}),C.$set(Lt);const Nt={};n&2&&(Nt.$$scope={dirty:n,ctx:e}),X.$set(Nt);const Yt={};n&2&&(Yt.$$scope={dirty:n,ctx:e}),B.$set(Yt);const Et={};n&2&&(Et.$$scope={dirty:n,ctx:e}),R.$set(Et)},i(e){dt||(b(i.$$.fragment,e),b(T.$$.fragment,e),b(V.$$.fragment,e),b(W.$$.fragment,e),b(C.$$.fragment,e),b(F.$$.fragment,e),b(N.$$.fragment,e),b(E.$$.fragment,e),b(z.$$.fragment,e),b(X.$$.fragment,e),b(P.$$.fragment,e),b(K.$$.fragment,e),b(te.$$.fragment,e),b(ae.$$.fragment,e),b(ie.$$.fragment,e),b(re.$$.fragment,e),b(me.$$.fragment,e),b(ce.$$.fragment,e),b(B.$$.fragment,e),b(R.$$.fragment,e),b(he.$$.fragment,e),b(be.$$.fragment,e),dt=!0)},o(e){y(i.$$.fragment,e),y(T.$$.fragment,e),y(V.$$.fragment,e),y(W.$$.fragment,e),y(C.$$.fragment,e),y(F.$$.fragment,e),y(N.$$.fragment,e),y(E.$$.fragment,e),y(z.$$.fragment,e),y(X.$$.fragment,e),y(P.$$.fragment,e),y(K.$$.fragment,e),y(te.$$.fragment,e),y(ae.$$.fragment,e),y(ie.$$.fragment,e),y(re.$$.fragment,e),y(me.$$.fragment,e),y(ce.$$.fragment,e),y(B.$$.fragment,e),y(R.$$.fragment,e),y(he.$$.fragment,e),y(be.$$.fragment,e),dt=!1},d(e){e&&(l(o),l(a),l(m),l(f),l(c),l(U),l(w),l(x),l(Je),l(G),l(Ue),l(k),l(xe),l(Ze),l(H),l(ve),l(je),l(We),l(I),l(Ce),l(Xe),l(L),l(Be),l(Re),l(Y),l(Ge),l(ke),l(S),l(Ve),l(He),l(Ie),l(A),l(Fe),l(Q),l(Le),l(Ne),l(q),l(Ye),l(D),l(Ee),l(Se),l(O),l(ze),l(ee),l(Ae),l(Qe),l(ne),l(Pe),l(qe),l(le),l(De),l(se),l(Ke),l(Oe),l(oe),l(et),l(tt),l(pe),l(nt),l(at),l(fe),l(lt),l(st),l(ue),l(it),l(ot),l(de),l(rt),l(pt),l(mt),l($e),l(ft),l(ge),l(ct),l(ut),l(we)),l(t),M(i,e),M(T,e),M(V,e),M(W,e),M(C,e),M(F,e),M(N,e),M(E,e),M(z,e),M(X,e),M(P,e),M(K,e),M(te,e),M(ae,e),M(ie,e),M(re,e),M(me,e),M(ce,e),M(B,e),M(R,e),M(he,e),M(be,e)}}}const $n='{"title":"Text-to-image","local":"text-to-image","sections":[{"title":"Script parameters","local":"script-parameters","sections":[{"title":"Min-SNR weighting","local":"min-snr-weighting","sections":[],"depth":3}],"depth":2},{"title":"Training script","local":"training-script","sections":[],"depth":2},{"title":"Launch the script","local":"launch-the-script","sections":[],"depth":2},{"title":"Next steps","local":"next-steps","sections":[],"depth":2}],"depth":1}';function gn(J){return Qt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Jn extends Pt{constructor(t){super(),qt(this,t,gn,hn,At,{})}}export{Jn as component};
