import{s as zt,o as Et,n as v}from"../chunks/scheduler.182ea377.js";import{S as St,i as At,g as u,s as r,r as h,A as Pt,h as d,f as l,c as p,j as Nt,u as $,x as _,k as Qt,y as qt,a as s,v as g,d as M,t as b,w as y}from"../chunks/index.abf12888.js";import{T as we}from"../chunks/Tip.230e2334.js";import{C as Z}from"../chunks/CodeBlock.57fe6e13.js";import{H as Me}from"../chunks/Heading.16916d63.js";import{H as ut,a as be}from"../chunks/HfOption.fc88c804.js";function Dt(U){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(n){t=d(n,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1we1bp2"&&(t.textContent=o)},m(n,m){s(n,t,m)},p:v,d(n){n&&l(t)}}}function Kt(U){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(n){$(t.$$.fragment,n)},m(n,m){g(t,n,m),o=!0},p:v,i(n){o||(M(t.$$.fragment,n),o=!0)},o(n){b(t.$$.fragment,n),o=!1},d(n){y(t,n)}}}function Ot(U){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(n){$(t.$$.fragment,n)},m(n,m){g(t,n,m),o=!0},p:v,i(n){o||(M(t.$$.fragment,n),o=!0)},o(n){b(t.$$.fragment,n),o=!1},d(n){y(t,n)}}}function en(U){let t,o,n,m;return t=new be({props:{id:"installation",option:"PyTorch",$$slots:{default:[Kt]},$$scope:{ctx:U}}}),n=new be({props:{id:"installation",option:"Flax",$$slots:{default:[Ot]},$$scope:{ctx:U}}}),{c(){h(t.$$.fragment),o=r(),h(n.$$.fragment)},l(i){$(t.$$.fragment,i),o=p(i),$(n.$$.fragment,i)},m(i,c){g(t,i,c),s(i,o,c),g(n,i,c),m=!0},p(i,c){const T={};c&2&&(T.$$scope={dirty:c,ctx:i}),t.$set(T);const f={};c&2&&(f.$$scope={dirty:c,ctx:i}),n.$set(f)},i(i){m||(M(t.$$.fragment,i),M(n.$$.fragment,i),m=!0)},o(i){b(t.$$.fragment,i),b(n.$$.fragment,i),m=!1},d(i){i&&l(o),y(t,i),y(n,i)}}}function tn(U){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(n){t=d(n,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1qbiqsn"&&(t.innerHTML=o)},m(n,m){s(n,t,m)},p:v,d(n){n&&l(t)}}}function nn(U){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(n){t=d(n,"P",{"data-svelte-h":!0}),_(t)!=="svelte-5wvv6y"&&(t.innerHTML=o)},m(n,m){s(n,t,m)},p:v,d(n){n&&l(t)}}}function an(U){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(n){t=d(n,"P",{"data-svelte-h":!0}),_(t)!=="svelte-21tcs5"&&(t.innerHTML=o)},m(n,m){s(n,t,m)},p:v,d(n){n&&l(t)}}}function ln(U){let t,o='Let’s train on the <a href="https://huggingface.co/datasets/lambdalabs/pokemon-blip-captions" rel="nofollow">Pokémon BLIP captions</a> dataset to generate your own Pokémon. 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.',n,m,i,c,T;return m=new we({props:{$$slots:{default:[an]},$$scope:{ctx:U}}}),c=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwZGF0YXNldF9uYW1lJTNEJTIybGFtYmRhbGFicyUyRnBva2Vtb24tYmxpcC1jYXB0aW9ucyUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjIlMjAlMjB0cmFpbl90ZXh0X3RvX2ltYWdlLnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlNUMlMEElMjAlMjAtLWRhdGFzZXRfbmFtZSUzRCUyNGRhdGFzZXRfbmFtZSUyMCU1QyUwQSUyMCUyMC0tdXNlX2VtYSUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMC0tY2VudGVyX2Nyb3AlMjAtLXJhbmRvbV9mbGlwJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNENCUyMCU1QyUwQSUyMCUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEMTUwMDAlMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0QxZS0wNSUyMCU1QyUwQSUyMCUyMC0tbWF4X2dyYWRfbm9ybSUzRDElMjAlNUMlMEElMjAlMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUwQSUyMCUyMC0tbHJfc2NoZWR1bGVyJTNEJTIyY29uc3RhbnQlMjIlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDAlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjJzZC1wb2tlbW9uLW1vZGVsJTIyJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",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/pokemon-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-pokemon-model&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){t=u("p"),t.innerHTML=o,n=r(),h(m.$$.fragment),i=r(),h(c.$$.fragment)},l(f){t=d(f,"P",{"data-svelte-h":!0}),_(t)!=="svelte-5nmnoj"&&(t.innerHTML=o),n=p(f),$(m.$$.fragment,f),i=p(f),$(c.$$.fragment,f)},m(f,J){s(f,t,J),s(f,n,J),g(m,f,J),s(f,i,J),g(c,f,J),T=!0},p(f,J){const j={};J&2&&(j.$$scope={dirty:J,ctx:f}),m.$set(j)},i(f){T||(M(m.$$.fragment,f),M(c.$$.fragment,f),T=!0)},o(f){b(m.$$.fragment,f),b(c.$$.fragment,f),T=!1},d(f){f&&(l(t),l(n),l(i)),y(m,f),y(c,f)}}}function sn(U){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(n){t=d(n,"P",{"data-svelte-h":!0}),_(t)!=="svelte-21tcs5"&&(t.innerHTML=o)},m(n,m){s(n,t,m)},p:v,d(n){n&&l(t)}}}function on(U){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.',n,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).",c,T,f,J,j;return T=new we({props:{$$slots:{default:[sn]},$$scope:{ctx:U}}}),J=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwZGF0YXNldF9uYW1lJTNEJTIybGFtYmRhbGFicyUyRnBva2Vtb24tYmxpcC1jYXB0aW9ucyUyMiUwQSUwQXB5dGhvbiUyMHRyYWluX3RleHRfdG9faW1hZ2VfZmxheC5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTVDJTBBJTIwJTIwLS1kYXRhc2V0X25hbWUlM0QlMjRkYXRhc2V0X25hbWUlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAtLWNlbnRlcl9jcm9wJTIwLS1yYW5kb21fZmxpcCUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDE1MDAwJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNEMWUtMDUlMjAlNUMlMEElMjAlMjAtLW1heF9ncmFkX25vcm0lM0QxJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTIyc2QtcG9rZW1vbi1tb2RlbCUyMiUyMCU1QyUwQSUyMCUyMC0tcHVzaF90b19odWI=",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/pokemon-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-pokemon-model&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){t=u("p"),t.innerHTML=o,n=r(),m=u("p"),m.innerHTML=i,c=r(),h(T.$$.fragment),f=r(),h(J.$$.fragment)},l(w){t=d(w,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1sxlda3"&&(t.innerHTML=o),n=p(w),m=d(w,"P",{"data-svelte-h":!0}),_(m)!=="svelte-1shpxr8"&&(m.innerHTML=i),c=p(w),$(T.$$.fragment,w),f=p(w),$(J.$$.fragment,w)},m(w,x){s(w,t,x),s(w,n,x),s(w,m,x),s(w,c,x),g(T,w,x),s(w,f,x),g(J,w,x),j=!0},p(w,x){const ye={};x&2&&(ye.$$scope={dirty:x,ctx:w}),T.$set(ye)},i(w){j||(M(T.$$.fragment,w),M(J.$$.fragment,w),j=!0)},o(w){b(T.$$.fragment,w),b(J.$$.fragment,w),j=!1},d(w){w&&(l(t),l(n),l(m),l(c),l(f)),y(T,w),y(J,w)}}}function rn(U){let t,o,n,m;return t=new be({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[ln]},$$scope:{ctx:U}}}),n=new be({props:{id:"training-inference",option:"Flax",$$slots:{default:[on]},$$scope:{ctx:U}}}),{c(){h(t.$$.fragment),o=r(),h(n.$$.fragment)},l(i){$(t.$$.fragment,i),o=p(i),$(n.$$.fragment,i)},m(i,c){g(t,i,c),s(i,o,c),g(n,i,c),m=!0},p(i,c){const T={};c&2&&(T.$$scope={dirty:c,ctx:i}),t.$set(T);const f={};c&2&&(f.$$scope={dirty:c,ctx:i}),n.$set(f)},i(i){m||(M(t.$$.fragment,i),M(n.$$.fragment,i),m=!0)},o(i){b(t.$$.fragment,i),b(n.$$.fragment,i),m=!1},d(i){i&&l(o),y(t,i),y(n,i)}}}function pn(U){let t,o;return t=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJwYXRoJTJGdG8lMkZzYXZlZF9tb2RlbCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0QlMjJ5b2RhJTIyKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJ5b2RhLXBva2Vtb24ucG5nJTIyKQ==",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-pokemon.png&quot;</span>)`,wrap:!1}}),{c(){h(t.$$.fragment)},l(n){$(t.$$.fragment,n)},m(n,m){g(t,n,m),o=!0},p:v,i(n){o||(M(t.$$.fragment,n),o=!0)},o(n){b(t.$$.fragment,n),o=!1},d(n){y(t,n)}}}function mn(U){let t,o;return t=new Z({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsYXgudHJhaW5pbmcuY29tbW9uX3V0aWxzJTIwaW1wb3J0JTIwc2hhcmQlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmxheFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4U3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdGglMkZ0byUyRnNhdmVkX21vZGVsJTIyJTJDJTIwZHR5cGUlM0RqYXgubnVtcHkuYmZsb2F0MTYpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyeW9kYSUyMHBva2Vtb24lMjIlMEFwcm5nX3NlZWQlMjAlM0QlMjBqYXgucmFuZG9tLlBSTkdLZXkoMCklMEFudW1faW5mZXJlbmNlX3N0ZXBzJTIwJTNEJTIwNTAlMEElMEFudW1fc2FtcGxlcyUyMCUzRCUyMGpheC5kZXZpY2VfY291bnQoKSUwQXByb21wdCUyMCUzRCUyMG51bV9zYW1wbGVzJTIwKiUyMCU1QnByb21wdCU1RCUwQXByb21wdF9pZHMlMjAlM0QlMjBwaXBlbGluZS5wcmVwYXJlX2lucHV0cyhwcm9tcHQpJTBBJTBBJTIzJTIwc2hhcmQlMjBpbnB1dHMlMjBhbmQlMjBybmclMEFwYXJhbXMlMjAlM0QlMjByZXBsaWNhdGUocGFyYW1zKSUwQXBybmdfc2VlZCUyMCUzRCUyMGpheC5yYW5kb20uc3BsaXQocHJuZ19zZWVkJTJDJTIwamF4LmRldmljZV9jb3VudCgpKSUwQXByb21wdF9pZHMlMjAlM0QlMjBzaGFyZChwcm9tcHRfaWRzKSUwQSUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lKHByb21wdF9pZHMlMkMlMjBwYXJhbXMlMkMlMjBwcm5nX3NlZWQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTJDJTIwaml0JTNEVHJ1ZSkuaW1hZ2VzJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUubnVtcHlfdG9fcGlsKG5wLmFzYXJyYXkoaW1hZ2VzLnJlc2hhcGUoKG51bV9zYW1wbGVzJTJDKSUyMCUyQiUyMGltYWdlcy5zaGFwZSU1Qi0zJTNBJTVEKSkpJTBBaW1hZ2Uuc2F2ZSglMjJ5b2RhLXBva2Vtb24ucG5nJTIyKQ==",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 pokemon&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-pokemon.png&quot;</span>)`,wrap:!1}}),{c(){h(t.$$.fragment)},l(n){$(t.$$.fragment,n)},m(n,m){g(t,n,m),o=!0},p:v,i(n){o||(M(t.$$.fragment,n),o=!0)},o(n){b(t.$$.fragment,n),o=!1},d(n){y(t,n)}}}function cn(U){let t,o,n,m;return t=new be({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[pn]},$$scope:{ctx:U}}}),n=new be({props:{id:"training-inference",option:"Flax",$$slots:{default:[mn]},$$scope:{ctx:U}}}),{c(){h(t.$$.fragment),o=r(),h(n.$$.fragment)},l(i){$(t.$$.fragment,i),o=p(i),$(n.$$.fragment,i)},m(i,c){g(t,i,c),s(i,o,c),g(n,i,c),m=!0},p(i,c){const T={};c&2&&(T.$$scope={dirty:c,ctx:i}),t.$set(T);const f={};c&2&&(f.$$scope={dirty:c,ctx:i}),n.$set(f)},i(i){m||(M(t.$$.fragment,i),M(n.$$.fragment,i),m=!0)},o(i){b(t.$$.fragment,i),b(n.$$.fragment,i),m=!1},d(i){i&&l(o),y(t,i),y(n,i)}}}function fn(U){let t,o,n,m,i,c,T,f,J,j="Text-to-image models like Stable Diffusion are conditioned to generate images given a text prompt.",w,x,ye='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.',Te,B,dt='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,ht="Before running the script, make sure you install the library from source:",Je,V,xe,F,$t="Then navigate to the example folder containing the training script and install the required dependencies for the script you’re using:",Ze,W,je,C,ve,L,gt="Initialize an 🤗 Accelerate environment:",We,I,Ce,H,Mt="To setup a default 🤗 Accelerate environment without choosing any configurations:",Xe,Y,Re,N,bt="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",Ge,Q,Be,z,yt='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.',ke,E,Ve,X,Fe,S,_t='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.',Le,A,wt="For example, to speedup training with mixed precision using the fp16 format, add the <code>--mixed_precision</code> parameter to the training command:",Ie,P,He,q,Tt="Some basic and important parameters include:",Ye,D,Ut="<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>",Ne,K,Qe,O,Jt='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,xt="Add the <code>--snr_gamma</code> parameter and set it to the recommended value of 5.0:",Ee,te,Se,ne,Zt='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.',Ae,ae,Pe,le,jt='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.',qe,se,vt='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:',De,ie,Ke,oe,Wt='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:',Oe,re,et,pe,Ct='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>:',tt,me,nt,ce,Xt='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.',at,fe,lt,ue,Rt="Once you’ve made all your changes or you’re okay with the default configuration, you’re ready to launch the training script! 🚀",st,R,it,de,Gt="Once training is complete, you can use your newly trained model for inference:",ot,G,rt,he,pt,$e,Bt="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:",mt,ge,kt='<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,_e,ft;return i=new Me({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h1"}}),T=new we({props:{warning:!0,$$slots:{default:[Dt]},$$scope:{ctx:U}}}),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 ut({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[en]},$$scope:{ctx:U}}}),C=new we({props:{$$slots:{default:[tn]},$$scope:{ctx:U}}}),I=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Y=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),Q=new Z({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`from accelerate.utils import write_basic_config

write_basic_config()`,wrap:!1}}),E=new Me({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),X=new we({props:{$$slots:{default:[nn]},$$scope:{ctx:U}}}),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 Me({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 Me({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}}),fe=new Me({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),R=new ut({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[rn]},$$scope:{ctx:U}}}),G=new ut({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[cn]},$$scope:{ctx:U}}}),he=new Me({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),{c(){t=u("meta"),o=r(),n=u("p"),m=r(),h(i.$$.fragment),c=r(),h(T.$$.fragment),f=r(),J=u("p"),J.textContent=j,w=r(),x=u("p"),x.innerHTML=ye,Te=r(),B=u("p"),B.innerHTML=dt,Ue=r(),k=u("p"),k.textContent=ht,Je=r(),h(V.$$.fragment),xe=r(),F=u("p"),F.textContent=$t,Ze=r(),h(W.$$.fragment),je=r(),h(C.$$.fragment),ve=r(),L=u("p"),L.textContent=gt,We=r(),h(I.$$.fragment),Ce=r(),H=u("p"),H.textContent=Mt,Xe=r(),h(Y.$$.fragment),Re=r(),N=u("p"),N.textContent=bt,Ge=r(),h(Q.$$.fragment),Be=r(),z=u("p"),z.innerHTML=yt,ke=r(),h(E.$$.fragment),Ve=r(),h(X.$$.fragment),Fe=r(),S=u("p"),S.innerHTML=_t,Le=r(),A=u("p"),A.innerHTML=wt,Ie=r(),h(P.$$.fragment),He=r(),q=u("p"),q.textContent=Tt,Ye=r(),D=u("ul"),D.innerHTML=Ut,Ne=r(),h(K.$$.fragment),Qe=r(),O=u("p"),O.innerHTML=Jt,ze=r(),ee=u("p"),ee.innerHTML=xt,Ee=r(),h(te.$$.fragment),Se=r(),ne=u("p"),ne.innerHTML=Zt,Ae=r(),h(ae.$$.fragment),Pe=r(),le=u("p"),le.innerHTML=jt,qe=r(),se=u("p"),se.innerHTML=vt,De=r(),h(ie.$$.fragment),Ke=r(),oe=u("p"),oe.innerHTML=Wt,Oe=r(),h(re.$$.fragment),et=r(),pe=u("p"),pe.innerHTML=Ct,tt=r(),h(me.$$.fragment),nt=r(),ce=u("p"),ce.innerHTML=Xt,at=r(),h(fe.$$.fragment),lt=r(),ue=u("p"),ue.textContent=Rt,st=r(),h(R.$$.fragment),it=r(),de=u("p"),de.textContent=Gt,ot=r(),h(G.$$.fragment),rt=r(),h(he.$$.fragment),pt=r(),$e=u("p"),$e.textContent=Bt,mt=r(),ge=u("ul"),ge.innerHTML=kt,ct=r(),_e=u("p"),this.h()},l(e){const a=Pt("svelte-u9bgzb",document.head);t=d(a,"META",{name:!0,content:!0}),a.forEach(l),o=p(e),n=d(e,"P",{}),Nt(n).forEach(l),m=p(e),$(i.$$.fragment,e),c=p(e),$(T.$$.fragment,e),f=p(e),J=d(e,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1y4tuwx"&&(J.textContent=j),w=p(e),x=d(e,"P",{"data-svelte-h":!0}),_(x)!=="svelte-1aeplm2"&&(x.innerHTML=ye),Te=p(e),B=d(e,"P",{"data-svelte-h":!0}),_(B)!=="svelte-1n3skb8"&&(B.innerHTML=dt),Ue=p(e),k=d(e,"P",{"data-svelte-h":!0}),_(k)!=="svelte-l7dm2q"&&(k.textContent=ht),Je=p(e),$(V.$$.fragment,e),xe=p(e),F=d(e,"P",{"data-svelte-h":!0}),_(F)!=="svelte-z4z0b9"&&(F.textContent=$t),Ze=p(e),$(W.$$.fragment,e),je=p(e),$(C.$$.fragment,e),ve=p(e),L=d(e,"P",{"data-svelte-h":!0}),_(L)!=="svelte-60q53m"&&(L.textContent=gt),We=p(e),$(I.$$.fragment,e),Ce=p(e),H=d(e,"P",{"data-svelte-h":!0}),_(H)!=="svelte-di6juu"&&(H.textContent=Mt),Xe=p(e),$(Y.$$.fragment,e),Re=p(e),N=d(e,"P",{"data-svelte-h":!0}),_(N)!=="svelte-tsz4qp"&&(N.textContent=bt),Ge=p(e),$(Q.$$.fragment,e),Be=p(e),z=d(e,"P",{"data-svelte-h":!0}),_(z)!=="svelte-1fkfdql"&&(z.innerHTML=yt),ke=p(e),$(E.$$.fragment,e),Ve=p(e),$(X.$$.fragment,e),Fe=p(e),S=d(e,"P",{"data-svelte-h":!0}),_(S)!=="svelte-1rkoo94"&&(S.innerHTML=_t),Le=p(e),A=d(e,"P",{"data-svelte-h":!0}),_(A)!=="svelte-1r0bv1x"&&(A.innerHTML=wt),Ie=p(e),$(P.$$.fragment,e),He=p(e),q=d(e,"P",{"data-svelte-h":!0}),_(q)!=="svelte-1mzaa4h"&&(q.textContent=Tt),Ye=p(e),D=d(e,"UL",{"data-svelte-h":!0}),_(D)!=="svelte-l4ycdy"&&(D.innerHTML=Ut),Ne=p(e),$(K.$$.fragment,e),Qe=p(e),O=d(e,"P",{"data-svelte-h":!0}),_(O)!=="svelte-isitbv"&&(O.innerHTML=Jt),ze=p(e),ee=d(e,"P",{"data-svelte-h":!0}),_(ee)!=="svelte-tp3kp"&&(ee.innerHTML=xt),Ee=p(e),$(te.$$.fragment,e),Se=p(e),ne=d(e,"P",{"data-svelte-h":!0}),_(ne)!=="svelte-1kq6d2e"&&(ne.innerHTML=Zt),Ae=p(e),$(ae.$$.fragment,e),Pe=p(e),le=d(e,"P",{"data-svelte-h":!0}),_(le)!=="svelte-1ibfk21"&&(le.innerHTML=jt),qe=p(e),se=d(e,"P",{"data-svelte-h":!0}),_(se)!=="svelte-1yog97t"&&(se.innerHTML=vt),De=p(e),$(ie.$$.fragment,e),Ke=p(e),oe=d(e,"P",{"data-svelte-h":!0}),_(oe)!=="svelte-1au88ib"&&(oe.innerHTML=Wt),Oe=p(e),$(re.$$.fragment,e),et=p(e),pe=d(e,"P",{"data-svelte-h":!0}),_(pe)!=="svelte-1e0707i"&&(pe.innerHTML=Ct),tt=p(e),$(me.$$.fragment,e),nt=p(e),ce=d(e,"P",{"data-svelte-h":!0}),_(ce)!=="svelte-13vuqhc"&&(ce.innerHTML=Xt),at=p(e),$(fe.$$.fragment,e),lt=p(e),ue=d(e,"P",{"data-svelte-h":!0}),_(ue)!=="svelte-9dei1q"&&(ue.textContent=Rt),st=p(e),$(R.$$.fragment,e),it=p(e),de=d(e,"P",{"data-svelte-h":!0}),_(de)!=="svelte-1jtuc6"&&(de.textContent=Gt),ot=p(e),$(G.$$.fragment,e),rt=p(e),$(he.$$.fragment,e),pt=p(e),$e=d(e,"P",{"data-svelte-h":!0}),_($e)!=="svelte-127gxsw"&&($e.textContent=Bt),mt=p(e),ge=d(e,"UL",{"data-svelte-h":!0}),_(ge)!=="svelte-10nfhag"&&(ge.innerHTML=kt),ct=p(e),_e=d(e,"P",{}),Nt(_e).forEach(l),this.h()},h(){Qt(t,"name","hf:doc:metadata"),Qt(t,"content",un)},m(e,a){qt(document.head,t),s(e,o,a),s(e,n,a),s(e,m,a),g(i,e,a),s(e,c,a),g(T,e,a),s(e,f,a),s(e,J,a),s(e,w,a),s(e,x,a),s(e,Te,a),s(e,B,a),s(e,Ue,a),s(e,k,a),s(e,Je,a),g(V,e,a),s(e,xe,a),s(e,F,a),s(e,Ze,a),g(W,e,a),s(e,je,a),g(C,e,a),s(e,ve,a),s(e,L,a),s(e,We,a),g(I,e,a),s(e,Ce,a),s(e,H,a),s(e,Xe,a),g(Y,e,a),s(e,Re,a),s(e,N,a),s(e,Ge,a),g(Q,e,a),s(e,Be,a),s(e,z,a),s(e,ke,a),g(E,e,a),s(e,Ve,a),g(X,e,a),s(e,Fe,a),s(e,S,a),s(e,Le,a),s(e,A,a),s(e,Ie,a),g(P,e,a),s(e,He,a),s(e,q,a),s(e,Ye,a),s(e,D,a),s(e,Ne,a),g(K,e,a),s(e,Qe,a),s(e,O,a),s(e,ze,a),s(e,ee,a),s(e,Ee,a),g(te,e,a),s(e,Se,a),s(e,ne,a),s(e,Ae,a),g(ae,e,a),s(e,Pe,a),s(e,le,a),s(e,qe,a),s(e,se,a),s(e,De,a),g(ie,e,a),s(e,Ke,a),s(e,oe,a),s(e,Oe,a),g(re,e,a),s(e,et,a),s(e,pe,a),s(e,tt,a),g(me,e,a),s(e,nt,a),s(e,ce,a),s(e,at,a),g(fe,e,a),s(e,lt,a),s(e,ue,a),s(e,st,a),g(R,e,a),s(e,it,a),s(e,de,a),s(e,ot,a),g(G,e,a),s(e,rt,a),g(he,e,a),s(e,pt,a),s(e,$e,a),s(e,mt,a),s(e,ge,a),s(e,ct,a),s(e,_e,a),ft=!0},p(e,[a]){const Vt={};a&2&&(Vt.$$scope={dirty:a,ctx:e}),T.$set(Vt);const Ft={};a&2&&(Ft.$$scope={dirty:a,ctx:e}),W.$set(Ft);const Lt={};a&2&&(Lt.$$scope={dirty:a,ctx:e}),C.$set(Lt);const It={};a&2&&(It.$$scope={dirty:a,ctx:e}),X.$set(It);const Ht={};a&2&&(Ht.$$scope={dirty:a,ctx:e}),R.$set(Ht);const Yt={};a&2&&(Yt.$$scope={dirty:a,ctx:e}),G.$set(Yt)},i(e){ft||(M(i.$$.fragment,e),M(T.$$.fragment,e),M(V.$$.fragment,e),M(W.$$.fragment,e),M(C.$$.fragment,e),M(I.$$.fragment,e),M(Y.$$.fragment,e),M(Q.$$.fragment,e),M(E.$$.fragment,e),M(X.$$.fragment,e),M(P.$$.fragment,e),M(K.$$.fragment,e),M(te.$$.fragment,e),M(ae.$$.fragment,e),M(ie.$$.fragment,e),M(re.$$.fragment,e),M(me.$$.fragment,e),M(fe.$$.fragment,e),M(R.$$.fragment,e),M(G.$$.fragment,e),M(he.$$.fragment,e),ft=!0)},o(e){b(i.$$.fragment,e),b(T.$$.fragment,e),b(V.$$.fragment,e),b(W.$$.fragment,e),b(C.$$.fragment,e),b(I.$$.fragment,e),b(Y.$$.fragment,e),b(Q.$$.fragment,e),b(E.$$.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(fe.$$.fragment,e),b(R.$$.fragment,e),b(G.$$.fragment,e),b(he.$$.fragment,e),ft=!1},d(e){e&&(l(o),l(n),l(m),l(c),l(f),l(J),l(w),l(x),l(Te),l(B),l(Ue),l(k),l(Je),l(xe),l(F),l(Ze),l(je),l(ve),l(L),l(We),l(Ce),l(H),l(Xe),l(Re),l(N),l(Ge),l(Be),l(z),l(ke),l(Ve),l(Fe),l(S),l(Le),l(A),l(Ie),l(He),l(q),l(Ye),l(D),l(Ne),l(Qe),l(O),l(ze),l(ee),l(Ee),l(Se),l(ne),l(Ae),l(Pe),l(le),l(qe),l(se),l(De),l(Ke),l(oe),l(Oe),l(et),l(pe),l(tt),l(nt),l(ce),l(at),l(lt),l(ue),l(st),l(it),l(de),l(ot),l(rt),l(pt),l($e),l(mt),l(ge),l(ct),l(_e)),l(t),y(i,e),y(T,e),y(V,e),y(W,e),y(C,e),y(I,e),y(Y,e),y(Q,e),y(E,e),y(X,e),y(P,e),y(K,e),y(te,e),y(ae,e),y(ie,e),y(re,e),y(me,e),y(fe,e),y(R,e),y(G,e),y(he,e)}}}const un='{"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 dn(U){return Et(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _n extends St{constructor(t){super(),At(this,t,dn,fn,zt,{})}}export{_n as component};
