import{s as el,o as tl,n as U}from"../chunks/scheduler.8c3d61f6.js";import{S as ll,i as nl,g as f,s as o,r as d,A as al,h as m,f as a,c as p,j as Kt,u as h,x as w,k as Ot,y as sl,a as s,v as y,d as M,t as b,w as g}from"../chunks/index.da70eac4.js";import{T as Mt}from"../chunks/Tip.1d9b8c37.js";import{C as T}from"../chunks/CodeBlock.00a903b3.js";import{H as $e,E as il}from"../chunks/EditOnGithub.1e64e623.js";import{H as bt,a as ge}from"../chunks/HfOption.c1483eb1.js";function rl($){let l,r;return l=new T({props:{code:"Y2QlMjBleGFtcGxlcyUyRnRleHR1YWxfaW52ZXJzaW9uJTBBcGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:`<span class="hljs-built_in">cd</span> examples/textual_inversion
pip install -r requirements.txt`,wrap:!1}}),{c(){d(l.$$.fragment)},l(n){h(l.$$.fragment,n)},m(n,u){y(l,n,u),r=!0},p:U,i(n){r||(M(l.$$.fragment,n),r=!0)},o(n){b(l.$$.fragment,n),r=!1},d(n){g(l,n)}}}function ol($){let l,r;return l=new T({props:{code:"Y2QlMjBleGFtcGxlcyUyRnRleHR1YWxfaW52ZXJzaW9uJTBBcGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzX2ZsYXgudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/textual_inversion
pip install -r requirements_flax.txt`,wrap:!1}}),{c(){d(l.$$.fragment)},l(n){h(l.$$.fragment,n)},m(n,u){y(l,n,u),r=!0},p:U,i(n){r||(M(l.$$.fragment,n),r=!0)},o(n){b(l.$$.fragment,n),r=!1},d(n){g(l,n)}}}function pl($){let l,r,n,u;return l=new ge({props:{id:"installation",option:"PyTorch",$$slots:{default:[rl]},$$scope:{ctx:$}}}),n=new ge({props:{id:"installation",option:"Flax",$$slots:{default:[ol]},$$scope:{ctx:$}}}),{c(){d(l.$$.fragment),r=o(),d(n.$$.fragment)},l(i){h(l.$$.fragment,i),r=p(i),h(n.$$.fragment,i)},m(i,c){y(l,i,c),s(i,r,c),y(n,i,c),u=!0},p(i,c){const _={};c&2&&(_.$$scope={dirty:c,ctx:i}),l.$set(_);const J={};c&2&&(J.$$scope={dirty:c,ctx:i}),n.$set(J)},i(i){u||(M(l.$$.fragment,i),M(n.$$.fragment,i),u=!0)},o(i){b(l.$$.fragment,i),b(n.$$.fragment,i),u=!1},d(i){i&&a(r),g(l,i),g(n,i)}}}function cl($){let l,r='🤗 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(){l=f("p"),l.innerHTML=r},l(n){l=m(n,"P",{"data-svelte-h":!0}),w(l)!=="svelte-1qbiqsn"&&(l.innerHTML=r)},m(n,u){s(n,l,u)},p:U,d(n){n&&a(l)}}}function ul($){let l,r='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/textual_inversion/textual_inversion.py" rel="nofollow">script</a> and let us know if you have any questions or concerns.';return{c(){l=f("p"),l.innerHTML=r},l(n){l=m(n,"P",{"data-svelte-h":!0}),w(l)!=="svelte-1ayw4o7"&&(l.innerHTML=r)},m(n,u){s(n,l,u)},p:U,d(n){n&&a(l)}}}function fl($){let l,r="A full training run takes ~1 hour on a single V100 GPU.";return{c(){l=f("p"),l.textContent=r},l(n){l=m(n,"P",{"data-svelte-h":!0}),w(l)!=="svelte-50nyqv"&&(l.textContent=r)},m(n,u){s(n,l,u)},p:U,d(n){n&&a(l)}}}function ml($){let l,r;return l=new T({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQWV4cG9ydCUyMERBVEFfRElSJTNEJTIyLiUyRmNhdCUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjB0ZXh0dWFsX2ludmVyc2lvbi5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9kYXRhX2RpciUzRCUyNERBVEFfRElSJTIwJTVDJTBBJTIwJTIwLS1sZWFybmFibGVfcHJvcGVydHklM0QlMjJvYmplY3QlMjIlMjAlNUMlMEElMjAlMjAtLXBsYWNlaG9sZGVyX3Rva2VuJTNEJTIyJTNDY2F0LXRveSUzRSUyMiUyMCU1QyUwQSUyMCUyMC0taW5pdGlhbGl6ZXJfdG9rZW4lM0QlMjJ0b3klMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0QzMDAwJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNENS4wZS0wNCUyMCU1QyUwQSUyMCUyMC0tc2NhbGVfbHIlMjAlNUMlMEElMjAlMjAtLWxyX3NjaGVkdWxlciUzRCUyMmNvbnN0YW50JTIyJTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTIydGV4dHVhbF9pbnZlcnNpb25fY2F0JTIyJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",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> DATA_DIR=<span class="hljs-string">&quot;./cat&quot;</span>

accelerate launch textual_inversion.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --train_data_dir=<span class="hljs-variable">$DATA_DIR</span> \\
  --learnable_property=<span class="hljs-string">&quot;object&quot;</span> \\
  --placeholder_token=<span class="hljs-string">&quot;&lt;cat-toy&gt;&quot;</span> \\
  --initializer_token=<span class="hljs-string">&quot;toy&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=4 \\
  --max_train_steps=3000 \\
  --learning_rate=5.0e-04 \\
  --scale_lr \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --output_dir=<span class="hljs-string">&quot;textual_inversion_cat&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){d(l.$$.fragment)},l(n){h(l.$$.fragment,n)},m(n,u){y(l,n,u),r=!0},p:U,i(n){r||(M(l.$$.fragment,n),r=!0)},o(n){b(l.$$.fragment,n),r=!1},d(n){g(l,n)}}}function dl($){let l,r;return l=new T({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMmR1b25nbmElMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQtZmxheCUyMiUwQWV4cG9ydCUyMERBVEFfRElSJTNEJTIyLiUyRmNhdCUyMiUwQSUwQXB5dGhvbiUyMHRleHR1YWxfaW52ZXJzaW9uX2ZsYXgucHklMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fZGF0YV9kaXIlM0QlMjREQVRBX0RJUiUyMCU1QyUwQSUyMCUyMC0tbGVhcm5hYmxlX3Byb3BlcnR5JTNEJTIyb2JqZWN0JTIyJTIwJTVDJTBBJTIwJTIwLS1wbGFjZWhvbGRlcl90b2tlbiUzRCUyMiUzQ2NhdC10b3klM0UlMjIlMjAlNUMlMEElMjAlMjAtLWluaXRpYWxpemVyX3Rva2VuJTNEJTIydG95JTIyJTIwJTVDJTBBJTIwJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEMzAwMCUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDUuMGUtMDQlMjAlNUMlMEElMjAlMjAtLXNjYWxlX2xyJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTIydGV4dHVhbF9pbnZlcnNpb25fY2F0JTIyJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;duongna/stable-diffusion-v1-4-flax&quot;</span>
<span class="hljs-built_in">export</span> DATA_DIR=<span class="hljs-string">&quot;./cat&quot;</span>

python textual_inversion_flax.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --train_data_dir=<span class="hljs-variable">$DATA_DIR</span> \\
  --learnable_property=<span class="hljs-string">&quot;object&quot;</span> \\
  --placeholder_token=<span class="hljs-string">&quot;&lt;cat-toy&gt;&quot;</span> \\
  --initializer_token=<span class="hljs-string">&quot;toy&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --max_train_steps=3000 \\
  --learning_rate=5.0e-04 \\
  --scale_lr \\
  --output_dir=<span class="hljs-string">&quot;textual_inversion_cat&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){d(l.$$.fragment)},l(n){h(l.$$.fragment,n)},m(n,u){y(l,n,u),r=!0},p:U,i(n){r||(M(l.$$.fragment,n),r=!0)},o(n){b(l.$$.fragment,n),r=!1},d(n){g(l,n)}}}function hl($){let l,r,n,u;return l=new ge({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[ml]},$$scope:{ctx:$}}}),n=new ge({props:{id:"training-inference",option:"Flax",$$slots:{default:[dl]},$$scope:{ctx:$}}}),{c(){d(l.$$.fragment),r=o(),d(n.$$.fragment)},l(i){h(l.$$.fragment,i),r=p(i),h(n.$$.fragment,i)},m(i,c){y(l,i,c),s(i,r,c),y(n,i,c),u=!0},p(i,c){const _={};c&2&&(_.$$scope={dirty:c,ctx:i}),l.$set(_);const J={};c&2&&(J.$$scope={dirty:c,ctx:i}),n.$set(J)},i(i){u||(M(l.$$.fragment,i),M(n.$$.fragment,i),u=!0)},o(i){b(l.$$.fragment,i),b(n.$$.fragment,i),u=!1},d(i){i&&a(r),g(l,i),g(n,i)}}}function yl($){let l,r;return l=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUubG9hZF90ZXh0dWFsX2ludmVyc2lvbiglMjJzZC1jb25jZXB0cy1saWJyYXJ5JTJGY2F0LXRveSUyMiklMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKCUyMkElMjAlM0NjYXQtdG95JTNFJTIwdHJhaW4lMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNhdC10cmFpbi5wbmclMjIp",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;stable-diffusion-v1-5/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.load_textual_inversion(<span class="hljs-string">&quot;sd-concepts-library/cat-toy&quot;</span>)
image = pipeline(<span class="hljs-string">&quot;A &lt;cat-toy&gt; train&quot;</span>, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat-train.png&quot;</span>)`,wrap:!1}}),{c(){d(l.$$.fragment)},l(n){h(l.$$.fragment,n)},m(n,u){y(l,n,u),r=!0},p:U,i(n){r||(M(l.$$.fragment,n),r=!0)},o(n){b(l.$$.fragment,n),r=!1},d(n){g(l,n)}}}function Ml($){let l,r='Flax doesn’t support the <a href="/docs/diffusers/pr_10012/en/api/loaders/textual_inversion#diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion">load_textual_inversion()</a> method, but the textual_inversion_flax.py script <a href="https://github.com/huggingface/diffusers/blob/c0f058265161178f2a88849e92b37ffdc81f1dcc/examples/textual_inversion/textual_inversion_flax.py#L636C2-L636C2" rel="nofollow">saves</a> the learned embeddings as a part of the model after training. This means you can use the model for inference like any other Flax model:',n,u,i;return u=new T({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsYXgudHJhaW5pbmcuY29tbW9uX3V0aWxzJTIwaW1wb3J0JTIwc2hhcmQlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmxheFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBbW9kZWxfcGF0aCUyMCUzRCUyMCUyMnBhdGgtdG8teW91ci10cmFpbmVkLW1vZGVsJTIyJTBBcGlwZWxpbmUlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4U3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX3BhdGglMkMlMjBkdHlwZSUzRGpheC5udW1weS5iZmxvYXQxNiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwJTNDY2F0LXRveSUzRSUyMHRyYWluJTIyJTBBcHJuZ19zZWVkJTIwJTNEJTIwamF4LnJhbmRvbS5QUk5HS2V5KDApJTBBbnVtX2luZmVyZW5jZV9zdGVwcyUyMCUzRCUyMDUwJTBBJTBBbnVtX3NhbXBsZXMlMjAlM0QlMjBqYXguZGV2aWNlX2NvdW50KCklMEFwcm9tcHQlMjAlM0QlMjBudW1fc2FtcGxlcyUyMColMjAlNUJwcm9tcHQlNUQlMEFwcm9tcHRfaWRzJTIwJTNEJTIwcGlwZWxpbmUucHJlcGFyZV9pbnB1dHMocHJvbXB0KSUwQSUwQSUyMyUyMHNoYXJkJTIwaW5wdXRzJTIwYW5kJTIwcm5nJTBBcGFyYW1zJTIwJTNEJTIwcmVwbGljYXRlKHBhcmFtcyklMEFwcm5nX3NlZWQlMjAlM0QlMjBqYXgucmFuZG9tLnNwbGl0KHBybmdfc2VlZCUyQyUyMGpheC5kZXZpY2VfY291bnQoKSklMEFwcm9tcHRfaWRzJTIwJTNEJTIwc2hhcmQocHJvbXB0X2lkcyklMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlbGluZShwcm9tcHRfaWRzJTJDJTIwcGFyYW1zJTJDJTIwcHJuZ19zZWVkJTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUyQyUyMGppdCUzRFRydWUpLmltYWdlcyUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lLm51bXB5X3RvX3BpbChucC5hc2FycmF5KGltYWdlcy5yZXNoYXBlKChudW1fc2FtcGxlcyUyQyklMjAlMkIlMjBpbWFnZXMuc2hhcGUlNUItMyUzQSU1RCkpKSUwQWltYWdlLnNhdmUoJTIyY2F0LXRyYWluLnBuZyUyMik=",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

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

prompt = <span class="hljs-string">&quot;A &lt;cat-toy&gt; train&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;cat-train.png&quot;</span>)`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=r,n=o(),d(u.$$.fragment)},l(c){l=m(c,"P",{"data-svelte-h":!0}),w(l)!=="svelte-10dwisy"&&(l.innerHTML=r),n=p(c),h(u.$$.fragment,c)},m(c,_){s(c,l,_),s(c,n,_),y(u,c,_),i=!0},p:U,i(c){i||(M(u.$$.fragment,c),i=!0)},o(c){b(u.$$.fragment,c),i=!1},d(c){c&&(a(l),a(n)),g(u,c)}}}function bl($){let l,r,n,u;return l=new ge({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[yl]},$$scope:{ctx:$}}}),n=new ge({props:{id:"training-inference",option:"Flax",$$slots:{default:[Ml]},$$scope:{ctx:$}}}),{c(){d(l.$$.fragment),r=o(),d(n.$$.fragment)},l(i){h(l.$$.fragment,i),r=p(i),h(n.$$.fragment,i)},m(i,c){y(l,i,c),s(i,r,c),y(n,i,c),u=!0},p(i,c){const _={};c&2&&(_.$$scope={dirty:c,ctx:i}),l.$set(_);const J={};c&2&&(J.$$scope={dirty:c,ctx:i}),n.$set(J)},i(i){u||(M(l.$$.fragment,i),M(n.$$.fragment,i),u=!0)},o(i){b(l.$$.fragment,i),b(n.$$.fragment,i),u=!1},d(i){i&&a(r),g(l,i),g(n,i)}}}function gl($){let l,r,n,u,i,c,_,J='<a href="https://hf.co/papers/2208.01618" rel="nofollow">Textual Inversion</a> is a training technique for personalizing image generation models with just a few example images of what you want it to learn. This technique works by learning and updating the text embeddings (the new embeddings are tied to a special word you must use in the prompt) to match the example images you provide.',_e,R,gt='If you’re training on a GPU with limited vRAM, you should try enabling the <code>gradient_checkpointing</code> and <code>mixed_precision</code> parameters in the training command. You can also reduce your memory footprint by using 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 or xFormers. With the same configuration and setup as PyTorch, the Flax training script should be at least ~70% faster!',Te,C,wt='This guide will explore the <a href="https://github.com/huggingface/diffusers/blob/main/examples/textual_inversion/textual_inversion.py" rel="nofollow">textual_inversion.py</a> script to help you become more familiar with it, and how you can adapt it for your own use-case.',Je,k,$t="Before running the script, make sure you install the library from source:",Ue,I,ve,G,_t="Navigate to the example folder with the training script and install the required dependencies for the script you’re using:",Ze,v,xe,Z,je,B,Tt="Initialize an 🤗 Accelerate environment:",Xe,F,We,V,Jt="To setup a default 🤗 Accelerate environment without choosing any configurations:",Re,Y,Ce,N,Ut="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",ke,H,Ie,L,vt='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.',Ge,x,Be,z,Fe,E,Zt='The training script has many parameters to help you tailor the training run to your needs. All of the parameters and their descriptions are listed in the <a href="https://github.com/huggingface/diffusers/blob/839c2a5ece0af4e75530cb520d77bc7ed8acf474/examples/textual_inversion/textual_inversion.py#L176" rel="nofollow"><code>parse_args()</code></a> function. Where applicable, Diffusers provides default values for each parameter such as the training batch size and learning rate, but feel free to change these values in the training command if you’d like.',Ve,Q,xt="For example, to increase the number of gradient accumulation steps above the default value of 1:",Ye,S,Ne,A,jt="Some other basic and important parameters to specify include:",He,q,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>--train_data_dir</code>: path to a folder containing the training dataset (example images)</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> <li><code>--num_vectors</code>: the number of vectors to learn the embeddings with; increasing this parameter helps the model learn better but it comes with increased training costs</li> <li><code>--placeholder_token</code>: the special word to tie the learned embeddings to (you must use the word in your prompt for inference)</li> <li><code>--initializer_token</code>: a single-word that roughly describes the object or style you’re trying to train on</li> <li><code>--learnable_property</code>: whether you’re training the model to learn a new “style” (for example, Van Gogh’s painting style) or “object” (for example, your dog)</li>",Le,D,ze,P,Wt='Unlike some of the other training scripts, textual_inversion.py has a custom dataset class, <a href="https://github.com/huggingface/diffusers/blob/b81c69e489aad3a0ba73798c459a33990dc4379c/examples/textual_inversion/textual_inversion.py#L487" rel="nofollow"><code>TextualInversionDataset</code></a> for creating a dataset. You can customize the image size, placeholder token, interpolation method, whether to crop the image, and more. If you need to change how the dataset is created, you can modify <code>TextualInversionDataset</code>.',Ee,K,Rt='Next, you’ll find the dataset preprocessing code and training loop in the <a href="https://github.com/huggingface/diffusers/blob/839c2a5ece0af4e75530cb520d77bc7ed8acf474/examples/textual_inversion/textual_inversion.py#L573" rel="nofollow"><code>main()</code></a> function.',Qe,O,Ct='The script starts by loading the <a href="https://github.com/huggingface/diffusers/blob/b81c69e489aad3a0ba73798c459a33990dc4379c/examples/textual_inversion/textual_inversion.py#L616" rel="nofollow">tokenizer</a>, <a href="https://github.com/huggingface/diffusers/blob/b81c69e489aad3a0ba73798c459a33990dc4379c/examples/textual_inversion/textual_inversion.py#L622" rel="nofollow">scheduler and model</a>:',Se,ee,Ae,te,kt='The special <a href="https://github.com/huggingface/diffusers/blob/b81c69e489aad3a0ba73798c459a33990dc4379c/examples/textual_inversion/textual_inversion.py#L632" rel="nofollow">placeholder token</a> is added next to the tokenizer, and the embedding is readjusted to account for the new token.',qe,le,It='Then, the script <a href="https://github.com/huggingface/diffusers/blob/b81c69e489aad3a0ba73798c459a33990dc4379c/examples/textual_inversion/textual_inversion.py#L716" rel="nofollow">creates a dataset</a> from the <code>TextualInversionDataset</code>:',De,ne,Pe,ae,Gt='Finally, the <a href="https://github.com/huggingface/diffusers/blob/b81c69e489aad3a0ba73798c459a33990dc4379c/examples/textual_inversion/textual_inversion.py#L784" rel="nofollow">training loop</a> handles everything else from predicting the noisy residual to updating the embedding weights of the special placeholder token.',Ke,se,Bt='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.',Oe,ie,et,re,Ft="Once you’ve made all your changes or you’re okay with the default configuration, you’re ready to launch the training script! 🚀",tt,oe,Vt='For this guide, you’ll download some images of a <a href="https://huggingface.co/datasets/diffusers/cat_toy_example" rel="nofollow">cat toy</a> and store them in a directory. But remember, you can create and use your own dataset if you want (see the <a href="create_dataset">Create a dataset for training</a> guide).',lt,pe,nt,ce,Yt="Set the environment variable <code>MODEL_NAME</code> to a model id on the Hub or a path to a local model, and <code>DATA_DIR</code>  to the path where you just downloaded the cat images to. The script creates and saves the following files to your repository:",at,ue,Nt="<li><code>learned_embeds.bin</code>: the learned embedding vectors corresponding to your example images</li> <li><code>token_identifier.txt</code>: the special placeholder token</li> <li><code>type_of_concept.txt</code>: the type of concept you’re training on (either “object” or “style”)</li>",st,j,it,fe,Ht="One more thing before you launch the script. If you’re interested in following along with the training process, you can periodically save generated images as training progresses. Add the following parameters to the training command:",rt,me,ot,X,pt,de,Lt="After training is complete, you can use your newly trained model for inference like:",ct,W,ut,he,ft,ye,zt="Congratulations on training your own Textual Inversion model! 🎉 To learn more about how to use your new model, the following guides may be helpful:",mt,Me,Et='<li>Learn how to <a href="../using-diffusers/loading_adapters">load Textual Inversion embeddings</a> and also use them as negative embeddings.</li> <li>Learn how to use <a href="textual_inversion_inference">Textual Inversion</a> for inference with Stable Diffusion 1/2 and Stable Diffusion XL.</li>',dt,be,ht,we,yt;return i=new $e({props:{title:"Textual Inversion",local:"textual-inversion",headingTag:"h1"}}),I=new T({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}}),v=new bt({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[pl]},$$scope:{ctx:$}}}),Z=new Mt({props:{$$slots:{default:[cl]},$$scope:{ctx:$}}}),F=new T({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Y=new T({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),H=new T({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}}),x=new Mt({props:{$$slots:{default:[ul]},$$scope:{ctx:$}}}),z=new $e({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),S=new T({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRleHR1YWxfaW52ZXJzaW9uLnB5JTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0",highlighted:`accelerate launch textual_inversion.py \\
  --gradient_accumulation_steps=4`,wrap:!1}}),D=new $e({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),ee=new T({props:{code:"JTIzJTIwTG9hZCUyMHRva2VuaXplciUwQWlmJTIwYXJncy50b2tlbml6ZXJfbmFtZSUzQSUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUyMCUzRCUyMENMSVBUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKGFyZ3MudG9rZW5pemVyX25hbWUpJTBBZWxpZiUyMGFyZ3MucHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0ElMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlMjAlM0QlMjBDTElQVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChhcmdzLnByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIydG9rZW5pemVyJTIyKSUwQSUwQSUyMyUyMExvYWQlMjBzY2hlZHVsZXIlMjBhbmQlMjBtb2RlbHMlMEFub2lzZV9zY2hlZHVsZXIlMjAlM0QlMjBERFBNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChhcmdzLnByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQXRleHRfZW5jb2RlciUyMCUzRCUyMENMSVBUZXh0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMGFyZ3MucHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglMkMlMjBzdWJmb2xkZXIlM0QlMjJ0ZXh0X2VuY29kZXIlMjIlMkMlMjByZXZpc2lvbiUzRGFyZ3MucmV2aXNpb24lMEEpJTBBdmFlJTIwJTNEJTIwQXV0b2VuY29kZXJLTC5mcm9tX3ByZXRyYWluZWQoYXJncy5wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUyQyUyMHN1YmZvbGRlciUzRCUyMnZhZSUyMiUyQyUyMHJldmlzaW9uJTNEYXJncy5yZXZpc2lvbiklMEF1bmV0JTIwJTNEJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMGFyZ3MucHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTIwcmV2aXNpb24lM0RhcmdzLnJldmlzaW9uJTBBKQ==",highlighted:`<span class="hljs-comment"># Load tokenizer</span>
<span class="hljs-keyword">if</span> args.tokenizer_name:
    tokenizer = CLIPTokenizer.from_pretrained(args.tokenizer_name)
<span class="hljs-keyword">elif</span> args.pretrained_model_name_or_path:
    tokenizer = CLIPTokenizer.from_pretrained(args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;tokenizer&quot;</span>)

<span class="hljs-comment"># Load scheduler and models</span>
noise_scheduler = DDPMScheduler.from_pretrained(args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
text_encoder = CLIPTextModel.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, revision=args.revision
)
vae = AutoencoderKL.from_pretrained(args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, revision=args.revision)
unet = UNet2DConditionModel.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, revision=args.revision
)`,wrap:!1}}),ne=new T({props:{code:"dHJhaW5fZGF0YXNldCUyMCUzRCUyMFRleHR1YWxJbnZlcnNpb25EYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGRhdGFfcm9vdCUzRGFyZ3MudHJhaW5fZGF0YV9kaXIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEElMjAlMjAlMjAlMjBzaXplJTNEYXJncy5yZXNvbHV0aW9uJTJDJTBBJTIwJTIwJTIwJTIwcGxhY2Vob2xkZXJfdG9rZW4lM0QoJTIyJTIwJTIyLmpvaW4odG9rZW5pemVyLmNvbnZlcnRfaWRzX3RvX3Rva2VucyhwbGFjZWhvbGRlcl90b2tlbl9pZHMpKSklMkMlMEElMjAlMjAlMjAlMjByZXBlYXRzJTNEYXJncy5yZXBlYXRzJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5hYmxlX3Byb3BlcnR5JTNEYXJncy5sZWFybmFibGVfcHJvcGVydHklMkMlMEElMjAlMjAlMjAlMjBjZW50ZXJfY3JvcCUzRGFyZ3MuY2VudGVyX2Nyb3AlMkMlMEElMjAlMjAlMjAlMjBzZXQlM0QlMjJ0cmFpbiUyMiUyQyUwQSklMEF0cmFpbl9kYXRhbG9hZGVyJTIwJTNEJTIwdG9yY2gudXRpbHMuZGF0YS5EYXRhTG9hZGVyKCUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlMkMlMjBiYXRjaF9zaXplJTNEYXJncy50cmFpbl9iYXRjaF9zaXplJTJDJTIwc2h1ZmZsZSUzRFRydWUlMkMlMjBudW1fd29ya2VycyUzRGFyZ3MuZGF0YWxvYWRlcl9udW1fd29ya2VycyUwQSk=",highlighted:`train_dataset = TextualInversionDataset(
    data_root=args.train_data_dir,
    tokenizer=tokenizer,
    size=args.resolution,
    placeholder_token=(<span class="hljs-string">&quot; &quot;</span>.join(tokenizer.convert_ids_to_tokens(placeholder_token_ids))),
    repeats=args.repeats,
    learnable_property=args.learnable_property,
    center_crop=args.center_crop,
    <span class="hljs-built_in">set</span>=<span class="hljs-string">&quot;train&quot;</span>,
)
train_dataloader = torch.utils.data.DataLoader(
    train_dataset, batch_size=args.train_batch_size, shuffle=<span class="hljs-literal">True</span>, num_workers=args.dataloader_num_workers
)`,wrap:!1}}),ie=new $e({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),pe=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHNuYXBzaG90X2Rvd25sb2FkJTBBJTBBbG9jYWxfZGlyJTIwJTNEJTIwJTIyLiUyRmNhdCUyMiUwQXNuYXBzaG90X2Rvd25sb2FkKCUwQSUyMCUyMCUyMCUyMCUyMmRpZmZ1c2VycyUyRmNhdF90b3lfZXhhbXBsZSUyMiUyQyUyMGxvY2FsX2RpciUzRGxvY2FsX2RpciUyQyUyMHJlcG9fdHlwZSUzRCUyMmRhdGFzZXQlMjIlMkMlMjBpZ25vcmVfcGF0dGVybnMlM0QlMjIuZ2l0YXR0cmlidXRlcyUyMiUwQSk=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> snapshot_download

local_dir = <span class="hljs-string">&quot;./cat&quot;</span>
snapshot_download(
    <span class="hljs-string">&quot;diffusers/cat_toy_example&quot;</span>, local_dir=local_dir, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>, ignore_patterns=<span class="hljs-string">&quot;.gitattributes&quot;</span>
)`,wrap:!1}}),j=new Mt({props:{warning:!0,$$slots:{default:[fl]},$$scope:{ctx:$}}}),me=new T({props:{code:"LS12YWxpZGF0aW9uX3Byb21wdCUzRCUyMkElMjAlM0NjYXQtdG95JTNFJTIwdHJhaW4lMjIlMEEtLW51bV92YWxpZGF0aW9uX2ltYWdlcyUzRDQlMEEtLXZhbGlkYXRpb25fc3RlcHMlM0QxMDA=",highlighted:`--validation_prompt=<span class="hljs-string">&quot;A &lt;cat-toy&gt; train&quot;</span>
--num_validation_images=4
--validation_steps=100`,wrap:!1}}),X=new bt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[hl]},$$scope:{ctx:$}}}),W=new bt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[bl]},$$scope:{ctx:$}}}),he=new $e({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),be=new il({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/training/text_inversion.md"}}),{c(){l=f("meta"),r=o(),n=f("p"),u=o(),d(i.$$.fragment),c=o(),_=f("p"),_.innerHTML=J,_e=o(),R=f("p"),R.innerHTML=gt,Te=o(),C=f("p"),C.innerHTML=wt,Je=o(),k=f("p"),k.textContent=$t,Ue=o(),d(I.$$.fragment),ve=o(),G=f("p"),G.textContent=_t,Ze=o(),d(v.$$.fragment),xe=o(),d(Z.$$.fragment),je=o(),B=f("p"),B.textContent=Tt,Xe=o(),d(F.$$.fragment),We=o(),V=f("p"),V.textContent=Jt,Re=o(),d(Y.$$.fragment),Ce=o(),N=f("p"),N.textContent=Ut,ke=o(),d(H.$$.fragment),Ie=o(),L=f("p"),L.innerHTML=vt,Ge=o(),d(x.$$.fragment),Be=o(),d(z.$$.fragment),Fe=o(),E=f("p"),E.innerHTML=Zt,Ve=o(),Q=f("p"),Q.textContent=xt,Ye=o(),d(S.$$.fragment),Ne=o(),A=f("p"),A.textContent=jt,He=o(),q=f("ul"),q.innerHTML=Xt,Le=o(),d(D.$$.fragment),ze=o(),P=f("p"),P.innerHTML=Wt,Ee=o(),K=f("p"),K.innerHTML=Rt,Qe=o(),O=f("p"),O.innerHTML=Ct,Se=o(),d(ee.$$.fragment),Ae=o(),te=f("p"),te.innerHTML=kt,qe=o(),le=f("p"),le.innerHTML=It,De=o(),d(ne.$$.fragment),Pe=o(),ae=f("p"),ae.innerHTML=Gt,Ke=o(),se=f("p"),se.innerHTML=Bt,Oe=o(),d(ie.$$.fragment),et=o(),re=f("p"),re.textContent=Ft,tt=o(),oe=f("p"),oe.innerHTML=Vt,lt=o(),d(pe.$$.fragment),nt=o(),ce=f("p"),ce.innerHTML=Yt,at=o(),ue=f("ul"),ue.innerHTML=Nt,st=o(),d(j.$$.fragment),it=o(),fe=f("p"),fe.textContent=Ht,rt=o(),d(me.$$.fragment),ot=o(),d(X.$$.fragment),pt=o(),de=f("p"),de.textContent=Lt,ct=o(),d(W.$$.fragment),ut=o(),d(he.$$.fragment),ft=o(),ye=f("p"),ye.textContent=zt,mt=o(),Me=f("ul"),Me.innerHTML=Et,dt=o(),d(be.$$.fragment),ht=o(),we=f("p"),this.h()},l(e){const t=al("svelte-u9bgzb",document.head);l=m(t,"META",{name:!0,content:!0}),t.forEach(a),r=p(e),n=m(e,"P",{}),Kt(n).forEach(a),u=p(e),h(i.$$.fragment,e),c=p(e),_=m(e,"P",{"data-svelte-h":!0}),w(_)!=="svelte-vnm0dn"&&(_.innerHTML=J),_e=p(e),R=m(e,"P",{"data-svelte-h":!0}),w(R)!=="svelte-19dvf8u"&&(R.innerHTML=gt),Te=p(e),C=m(e,"P",{"data-svelte-h":!0}),w(C)!=="svelte-vv5nfp"&&(C.innerHTML=wt),Je=p(e),k=m(e,"P",{"data-svelte-h":!0}),w(k)!=="svelte-l7dm2q"&&(k.textContent=$t),Ue=p(e),h(I.$$.fragment,e),ve=p(e),G=m(e,"P",{"data-svelte-h":!0}),w(G)!=="svelte-1nancx8"&&(G.textContent=_t),Ze=p(e),h(v.$$.fragment,e),xe=p(e),h(Z.$$.fragment,e),je=p(e),B=m(e,"P",{"data-svelte-h":!0}),w(B)!=="svelte-60q53m"&&(B.textContent=Tt),Xe=p(e),h(F.$$.fragment,e),We=p(e),V=m(e,"P",{"data-svelte-h":!0}),w(V)!=="svelte-di6juu"&&(V.textContent=Jt),Re=p(e),h(Y.$$.fragment,e),Ce=p(e),N=m(e,"P",{"data-svelte-h":!0}),w(N)!=="svelte-tsz4qp"&&(N.textContent=Ut),ke=p(e),h(H.$$.fragment,e),Ie=p(e),L=m(e,"P",{"data-svelte-h":!0}),w(L)!=="svelte-1fkfdql"&&(L.innerHTML=vt),Ge=p(e),h(x.$$.fragment,e),Be=p(e),h(z.$$.fragment,e),Fe=p(e),E=m(e,"P",{"data-svelte-h":!0}),w(E)!=="svelte-1mhz0qu"&&(E.innerHTML=Zt),Ve=p(e),Q=m(e,"P",{"data-svelte-h":!0}),w(Q)!=="svelte-g9gzy9"&&(Q.textContent=xt),Ye=p(e),h(S.$$.fragment,e),Ne=p(e),A=m(e,"P",{"data-svelte-h":!0}),w(A)!=="svelte-tgclk5"&&(A.textContent=jt),He=p(e),q=m(e,"UL",{"data-svelte-h":!0}),w(q)!=="svelte-eyv1zk"&&(q.innerHTML=Xt),Le=p(e),h(D.$$.fragment,e),ze=p(e),P=m(e,"P",{"data-svelte-h":!0}),w(P)!=="svelte-qs703o"&&(P.innerHTML=Wt),Ee=p(e),K=m(e,"P",{"data-svelte-h":!0}),w(K)!=="svelte-k3h2bp"&&(K.innerHTML=Rt),Qe=p(e),O=m(e,"P",{"data-svelte-h":!0}),w(O)!=="svelte-4766ss"&&(O.innerHTML=Ct),Se=p(e),h(ee.$$.fragment,e),Ae=p(e),te=m(e,"P",{"data-svelte-h":!0}),w(te)!=="svelte-16cbi1f"&&(te.innerHTML=kt),qe=p(e),le=m(e,"P",{"data-svelte-h":!0}),w(le)!=="svelte-70930c"&&(le.innerHTML=It),De=p(e),h(ne.$$.fragment,e),Pe=p(e),ae=m(e,"P",{"data-svelte-h":!0}),w(ae)!=="svelte-1mc4ymd"&&(ae.innerHTML=Gt),Ke=p(e),se=m(e,"P",{"data-svelte-h":!0}),w(se)!=="svelte-6gmbd2"&&(se.innerHTML=Bt),Oe=p(e),h(ie.$$.fragment,e),et=p(e),re=m(e,"P",{"data-svelte-h":!0}),w(re)!=="svelte-9dei1q"&&(re.textContent=Ft),tt=p(e),oe=m(e,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-1gl7574"&&(oe.innerHTML=Vt),lt=p(e),h(pe.$$.fragment,e),nt=p(e),ce=m(e,"P",{"data-svelte-h":!0}),w(ce)!=="svelte-k1bp7z"&&(ce.innerHTML=Yt),at=p(e),ue=m(e,"UL",{"data-svelte-h":!0}),w(ue)!=="svelte-17m22mk"&&(ue.innerHTML=Nt),st=p(e),h(j.$$.fragment,e),it=p(e),fe=m(e,"P",{"data-svelte-h":!0}),w(fe)!=="svelte-iowxvh"&&(fe.textContent=Ht),rt=p(e),h(me.$$.fragment,e),ot=p(e),h(X.$$.fragment,e),pt=p(e),de=m(e,"P",{"data-svelte-h":!0}),w(de)!=="svelte-1pqx2cy"&&(de.textContent=Lt),ct=p(e),h(W.$$.fragment,e),ut=p(e),h(he.$$.fragment,e),ft=p(e),ye=m(e,"P",{"data-svelte-h":!0}),w(ye)!=="svelte-18p6tri"&&(ye.textContent=zt),mt=p(e),Me=m(e,"UL",{"data-svelte-h":!0}),w(Me)!=="svelte-gq7brs"&&(Me.innerHTML=Et),dt=p(e),h(be.$$.fragment,e),ht=p(e),we=m(e,"P",{}),Kt(we).forEach(a),this.h()},h(){Ot(l,"name","hf:doc:metadata"),Ot(l,"content",wl)},m(e,t){sl(document.head,l),s(e,r,t),s(e,n,t),s(e,u,t),y(i,e,t),s(e,c,t),s(e,_,t),s(e,_e,t),s(e,R,t),s(e,Te,t),s(e,C,t),s(e,Je,t),s(e,k,t),s(e,Ue,t),y(I,e,t),s(e,ve,t),s(e,G,t),s(e,Ze,t),y(v,e,t),s(e,xe,t),y(Z,e,t),s(e,je,t),s(e,B,t),s(e,Xe,t),y(F,e,t),s(e,We,t),s(e,V,t),s(e,Re,t),y(Y,e,t),s(e,Ce,t),s(e,N,t),s(e,ke,t),y(H,e,t),s(e,Ie,t),s(e,L,t),s(e,Ge,t),y(x,e,t),s(e,Be,t),y(z,e,t),s(e,Fe,t),s(e,E,t),s(e,Ve,t),s(e,Q,t),s(e,Ye,t),y(S,e,t),s(e,Ne,t),s(e,A,t),s(e,He,t),s(e,q,t),s(e,Le,t),y(D,e,t),s(e,ze,t),s(e,P,t),s(e,Ee,t),s(e,K,t),s(e,Qe,t),s(e,O,t),s(e,Se,t),y(ee,e,t),s(e,Ae,t),s(e,te,t),s(e,qe,t),s(e,le,t),s(e,De,t),y(ne,e,t),s(e,Pe,t),s(e,ae,t),s(e,Ke,t),s(e,se,t),s(e,Oe,t),y(ie,e,t),s(e,et,t),s(e,re,t),s(e,tt,t),s(e,oe,t),s(e,lt,t),y(pe,e,t),s(e,nt,t),s(e,ce,t),s(e,at,t),s(e,ue,t),s(e,st,t),y(j,e,t),s(e,it,t),s(e,fe,t),s(e,rt,t),y(me,e,t),s(e,ot,t),y(X,e,t),s(e,pt,t),s(e,de,t),s(e,ct,t),y(W,e,t),s(e,ut,t),y(he,e,t),s(e,ft,t),s(e,ye,t),s(e,mt,t),s(e,Me,t),s(e,dt,t),y(be,e,t),s(e,ht,t),s(e,we,t),yt=!0},p(e,[t]){const Qt={};t&2&&(Qt.$$scope={dirty:t,ctx:e}),v.$set(Qt);const St={};t&2&&(St.$$scope={dirty:t,ctx:e}),Z.$set(St);const At={};t&2&&(At.$$scope={dirty:t,ctx:e}),x.$set(At);const qt={};t&2&&(qt.$$scope={dirty:t,ctx:e}),j.$set(qt);const Dt={};t&2&&(Dt.$$scope={dirty:t,ctx:e}),X.$set(Dt);const Pt={};t&2&&(Pt.$$scope={dirty:t,ctx:e}),W.$set(Pt)},i(e){yt||(M(i.$$.fragment,e),M(I.$$.fragment,e),M(v.$$.fragment,e),M(Z.$$.fragment,e),M(F.$$.fragment,e),M(Y.$$.fragment,e),M(H.$$.fragment,e),M(x.$$.fragment,e),M(z.$$.fragment,e),M(S.$$.fragment,e),M(D.$$.fragment,e),M(ee.$$.fragment,e),M(ne.$$.fragment,e),M(ie.$$.fragment,e),M(pe.$$.fragment,e),M(j.$$.fragment,e),M(me.$$.fragment,e),M(X.$$.fragment,e),M(W.$$.fragment,e),M(he.$$.fragment,e),M(be.$$.fragment,e),yt=!0)},o(e){b(i.$$.fragment,e),b(I.$$.fragment,e),b(v.$$.fragment,e),b(Z.$$.fragment,e),b(F.$$.fragment,e),b(Y.$$.fragment,e),b(H.$$.fragment,e),b(x.$$.fragment,e),b(z.$$.fragment,e),b(S.$$.fragment,e),b(D.$$.fragment,e),b(ee.$$.fragment,e),b(ne.$$.fragment,e),b(ie.$$.fragment,e),b(pe.$$.fragment,e),b(j.$$.fragment,e),b(me.$$.fragment,e),b(X.$$.fragment,e),b(W.$$.fragment,e),b(he.$$.fragment,e),b(be.$$.fragment,e),yt=!1},d(e){e&&(a(r),a(n),a(u),a(c),a(_),a(_e),a(R),a(Te),a(C),a(Je),a(k),a(Ue),a(ve),a(G),a(Ze),a(xe),a(je),a(B),a(Xe),a(We),a(V),a(Re),a(Ce),a(N),a(ke),a(Ie),a(L),a(Ge),a(Be),a(Fe),a(E),a(Ve),a(Q),a(Ye),a(Ne),a(A),a(He),a(q),a(Le),a(ze),a(P),a(Ee),a(K),a(Qe),a(O),a(Se),a(Ae),a(te),a(qe),a(le),a(De),a(Pe),a(ae),a(Ke),a(se),a(Oe),a(et),a(re),a(tt),a(oe),a(lt),a(nt),a(ce),a(at),a(ue),a(st),a(it),a(fe),a(rt),a(ot),a(pt),a(de),a(ct),a(ut),a(ft),a(ye),a(mt),a(Me),a(dt),a(ht),a(we)),a(l),g(i,e),g(I,e),g(v,e),g(Z,e),g(F,e),g(Y,e),g(H,e),g(x,e),g(z,e),g(S,e),g(D,e),g(ee,e),g(ne,e),g(ie,e),g(pe,e),g(j,e),g(me,e),g(X,e),g(W,e),g(he,e),g(be,e)}}}const wl='{"title":"Textual Inversion","local":"textual-inversion","sections":[{"title":"Script parameters","local":"script-parameters","sections":[],"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 $l($){return tl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xl extends ll{constructor(l){super(),nl(this,l,$l,gl,el,{})}}export{xl as component};
