import{s as el,o as tl,n as U}from"../chunks/scheduler.8c3d61f6.js";import{S as ll,i as nl,g as m,s as o,r as d,A as al,h as f,f as a,c as p,j as Kt,u as h,x as $,k as Ot,y as sl,a as s,v as y,d as M,t as b,w as g}from"../chunks/index.589a98e8.js";import{T as Mt}from"../chunks/Tip.42aa8582.js";import{C as J}from"../chunks/CodeBlock.36627b28.js";import{H as we,E as il}from"../chunks/EditOnGithub.e5a8d9cb.js";import{H as bt,a as ge}from"../chunks/HfOption.9804ab8b.js";function rl(w){let l,r;return l=new J({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(w){let l,r;return l=new J({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(w){let l,r,n,u;return l=new ge({props:{id:"installation",option:"PyTorch",$$slots:{default:[rl]},$$scope:{ctx:w}}}),n=new ge({props:{id:"installation",option:"Flax",$$slots:{default:[ol]},$$scope:{ctx:w}}}),{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 T={};c&2&&(T.$$scope={dirty:c,ctx:i}),n.$set(T)},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(w){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=m("p"),l.innerHTML=r},l(n){l=f(n,"P",{"data-svelte-h":!0}),$(l)!=="svelte-1qbiqsn"&&(l.innerHTML=r)},m(n,u){s(n,l,u)},p:U,d(n){n&&a(l)}}}function ul(w){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=m("p"),l.innerHTML=r},l(n){l=f(n,"P",{"data-svelte-h":!0}),$(l)!=="svelte-1ayw4o7"&&(l.innerHTML=r)},m(n,u){s(n,l,u)},p:U,d(n){n&&a(l)}}}function ml(w){let l,r="A full training run takes ~1 hour on a single V100 GPU.";return{c(){l=m("p"),l.textContent=r},l(n){l=f(n,"P",{"data-svelte-h":!0}),$(l)!=="svelte-50nyqv"&&(l.textContent=r)},m(n,u){s(n,l,u)},p:U,d(n){n&&a(l)}}}function fl(w){let l,r;return l=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwREFUQV9ESVIlM0QlMjIuJTJGY2F0JTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRleHR1YWxfaW52ZXJzaW9uLnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlNUMlMEElMjAlMjAtLXRyYWluX2RhdGFfZGlyJTNEJTI0REFUQV9ESVIlMjAlNUMlMEElMjAlMjAtLWxlYXJuYWJsZV9wcm9wZXJ0eSUzRCUyMm9iamVjdCUyMiUyMCU1QyUwQSUyMCUyMC0tcGxhY2Vob2xkZXJfdG9rZW4lM0QlMjIlM0NjYXQtdG95JTNFJTIyJTIwJTVDJTBBJTIwJTIwLS1pbml0aWFsaXplcl90b2tlbiUzRCUyMnRveSUyMiUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDMwMDAlMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1LjBlLTA0JTIwJTVDJTBBJTIwJTIwLS1zY2FsZV9sciUyMCU1QyUwQSUyMCUyMC0tbHJfc2NoZWR1bGVyJTNEJTIyY29uc3RhbnQlMjIlMjAlNUMlMEElMjAlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDAlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjJ0ZXh0dWFsX2ludmVyc2lvbl9jYXQlMjIlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",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> 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(w){let l,r;return l=new J({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(w){let l,r,n,u;return l=new ge({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[fl]},$$scope:{ctx:w}}}),n=new ge({props:{id:"training-inference",option:"Flax",$$slots:{default:[dl]},$$scope:{ctx:w}}}),{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 T={};c&2&&(T.$$scope={dirty:c,ctx:i}),n.$set(T)},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(w){let l,r;return l=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZS5sb2FkX3RleHR1YWxfaW52ZXJzaW9uKCUyMnNkLWNvbmNlcHRzLWxpYnJhcnklMkZjYXQtdG95JTIyKSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUoJTIyQSUyMCUzQ2NhdC10b3klM0UlMjB0cmFpbiUyMiUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY2F0LXRyYWluLnBuZyUyMik=",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;runwayml/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(w){let l,r='Flax doesn’t support the <a href="/docs/diffusers/pr_7685/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 J({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=m("p"),l.innerHTML=r,n=o(),d(u.$$.fragment)},l(c){l=f(c,"P",{"data-svelte-h":!0}),$(l)!=="svelte-12pfv6g"&&(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(w){let l,r,n,u;return l=new ge({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[yl]},$$scope:{ctx:w}}}),n=new ge({props:{id:"training-inference",option:"Flax",$$slots:{default:[Ml]},$$scope:{ctx:w}}}),{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 T={};c&2&&(T.$$scope={dirty:c,ctx:i}),n.$set(T)},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(w){let l,r,n,u,i,c,_,T='<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,C,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!',Je,R,$t='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.',Te,k,wt="Before running the script, make sure you install the library from source:",Ue,G,xe,I,_t="Navigate to the example folder with the training script and install the required dependencies for the script you’re using:",ve,x,Ze,v,je,B,Jt="Initialize an 🤗 Accelerate environment:",We,V,Xe,F,Tt="To setup a default 🤗 Accelerate environment without choosing any configurations:",Ce,Y,Re,z,Ut="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",ke,E,Ge,L,xt='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.',Ie,Z,Be,H,Ve,N,vt='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.',Fe,Q,Zt="For example, to increase the number of gradient accumulation steps above the default value of 1:",Ye,A,ze,S,jt="Some other basic and important parameters to specify include:",Ee,q,Wt="<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,He,P,Xt='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>.',Ne,K,Ct='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,Rt='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>:',Ae,ee,Se,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,Gt='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,It='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,Vt="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,Ft='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,zt="<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,me,Et="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,fe,ot,W,pt,de,Lt="After training is complete, you can use your newly trained model for inference like:",ct,X,ut,he,mt,ye,Ht="Congratulations on training your own Textual Inversion model! 🎉 To learn more about how to use your new model, the following guides may be helpful:",ft,Me,Nt='<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,$e,yt;return i=new we({props:{title:"Textual Inversion",local:"textual-inversion",headingTag:"h1"}}),G=new J({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}}),x=new bt({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[pl]},$$scope:{ctx:w}}}),v=new Mt({props:{$$slots:{default:[cl]},$$scope:{ctx:w}}}),V=new J({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Y=new J({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),E=new J({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 Mt({props:{$$slots:{default:[ul]},$$scope:{ctx:w}}}),H=new we({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),A=new J({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRleHR1YWxfaW52ZXJzaW9uLnB5JTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0",highlighted:`accelerate launch textual_inversion.py \\
  --gradient_accumulation_steps=4`,wrap:!1}}),D=new we({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),ee=new J({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 J({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 we({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),pe=new J({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:[ml]},$$scope:{ctx:w}}}),fe=new J({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}}),W=new bt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[hl]},$$scope:{ctx:w}}}),X=new bt({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[bl]},$$scope:{ctx:w}}}),he=new we({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=m("meta"),r=o(),n=m("p"),u=o(),d(i.$$.fragment),c=o(),_=m("p"),_.innerHTML=T,_e=o(),C=m("p"),C.innerHTML=gt,Je=o(),R=m("p"),R.innerHTML=$t,Te=o(),k=m("p"),k.textContent=wt,Ue=o(),d(G.$$.fragment),xe=o(),I=m("p"),I.textContent=_t,ve=o(),d(x.$$.fragment),Ze=o(),d(v.$$.fragment),je=o(),B=m("p"),B.textContent=Jt,We=o(),d(V.$$.fragment),Xe=o(),F=m("p"),F.textContent=Tt,Ce=o(),d(Y.$$.fragment),Re=o(),z=m("p"),z.textContent=Ut,ke=o(),d(E.$$.fragment),Ge=o(),L=m("p"),L.innerHTML=xt,Ie=o(),d(Z.$$.fragment),Be=o(),d(H.$$.fragment),Ve=o(),N=m("p"),N.innerHTML=vt,Fe=o(),Q=m("p"),Q.textContent=Zt,Ye=o(),d(A.$$.fragment),ze=o(),S=m("p"),S.textContent=jt,Ee=o(),q=m("ul"),q.innerHTML=Wt,Le=o(),d(D.$$.fragment),He=o(),P=m("p"),P.innerHTML=Xt,Ne=o(),K=m("p"),K.innerHTML=Ct,Qe=o(),O=m("p"),O.innerHTML=Rt,Ae=o(),d(ee.$$.fragment),Se=o(),te=m("p"),te.innerHTML=kt,qe=o(),le=m("p"),le.innerHTML=Gt,De=o(),d(ne.$$.fragment),Pe=o(),ae=m("p"),ae.innerHTML=It,Ke=o(),se=m("p"),se.innerHTML=Bt,Oe=o(),d(ie.$$.fragment),et=o(),re=m("p"),re.textContent=Vt,tt=o(),oe=m("p"),oe.innerHTML=Ft,lt=o(),d(pe.$$.fragment),nt=o(),ce=m("p"),ce.innerHTML=Yt,at=o(),ue=m("ul"),ue.innerHTML=zt,st=o(),d(j.$$.fragment),it=o(),me=m("p"),me.textContent=Et,rt=o(),d(fe.$$.fragment),ot=o(),d(W.$$.fragment),pt=o(),de=m("p"),de.textContent=Lt,ct=o(),d(X.$$.fragment),ut=o(),d(he.$$.fragment),mt=o(),ye=m("p"),ye.textContent=Ht,ft=o(),Me=m("ul"),Me.innerHTML=Nt,dt=o(),d(be.$$.fragment),ht=o(),$e=m("p"),this.h()},l(e){const t=al("svelte-u9bgzb",document.head);l=f(t,"META",{name:!0,content:!0}),t.forEach(a),r=p(e),n=f(e,"P",{}),Kt(n).forEach(a),u=p(e),h(i.$$.fragment,e),c=p(e),_=f(e,"P",{"data-svelte-h":!0}),$(_)!=="svelte-vnm0dn"&&(_.innerHTML=T),_e=p(e),C=f(e,"P",{"data-svelte-h":!0}),$(C)!=="svelte-19dvf8u"&&(C.innerHTML=gt),Je=p(e),R=f(e,"P",{"data-svelte-h":!0}),$(R)!=="svelte-vv5nfp"&&(R.innerHTML=$t),Te=p(e),k=f(e,"P",{"data-svelte-h":!0}),$(k)!=="svelte-l7dm2q"&&(k.textContent=wt),Ue=p(e),h(G.$$.fragment,e),xe=p(e),I=f(e,"P",{"data-svelte-h":!0}),$(I)!=="svelte-1nancx8"&&(I.textContent=_t),ve=p(e),h(x.$$.fragment,e),Ze=p(e),h(v.$$.fragment,e),je=p(e),B=f(e,"P",{"data-svelte-h":!0}),$(B)!=="svelte-60q53m"&&(B.textContent=Jt),We=p(e),h(V.$$.fragment,e),Xe=p(e),F=f(e,"P",{"data-svelte-h":!0}),$(F)!=="svelte-di6juu"&&(F.textContent=Tt),Ce=p(e),h(Y.$$.fragment,e),Re=p(e),z=f(e,"P",{"data-svelte-h":!0}),$(z)!=="svelte-tsz4qp"&&(z.textContent=Ut),ke=p(e),h(E.$$.fragment,e),Ge=p(e),L=f(e,"P",{"data-svelte-h":!0}),$(L)!=="svelte-1fkfdql"&&(L.innerHTML=xt),Ie=p(e),h(Z.$$.fragment,e),Be=p(e),h(H.$$.fragment,e),Ve=p(e),N=f(e,"P",{"data-svelte-h":!0}),$(N)!=="svelte-1mhz0qu"&&(N.innerHTML=vt),Fe=p(e),Q=f(e,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-g9gzy9"&&(Q.textContent=Zt),Ye=p(e),h(A.$$.fragment,e),ze=p(e),S=f(e,"P",{"data-svelte-h":!0}),$(S)!=="svelte-tgclk5"&&(S.textContent=jt),Ee=p(e),q=f(e,"UL",{"data-svelte-h":!0}),$(q)!=="svelte-eyv1zk"&&(q.innerHTML=Wt),Le=p(e),h(D.$$.fragment,e),He=p(e),P=f(e,"P",{"data-svelte-h":!0}),$(P)!=="svelte-qs703o"&&(P.innerHTML=Xt),Ne=p(e),K=f(e,"P",{"data-svelte-h":!0}),$(K)!=="svelte-k3h2bp"&&(K.innerHTML=Ct),Qe=p(e),O=f(e,"P",{"data-svelte-h":!0}),$(O)!=="svelte-4766ss"&&(O.innerHTML=Rt),Ae=p(e),h(ee.$$.fragment,e),Se=p(e),te=f(e,"P",{"data-svelte-h":!0}),$(te)!=="svelte-16cbi1f"&&(te.innerHTML=kt),qe=p(e),le=f(e,"P",{"data-svelte-h":!0}),$(le)!=="svelte-70930c"&&(le.innerHTML=Gt),De=p(e),h(ne.$$.fragment,e),Pe=p(e),ae=f(e,"P",{"data-svelte-h":!0}),$(ae)!=="svelte-1mc4ymd"&&(ae.innerHTML=It),Ke=p(e),se=f(e,"P",{"data-svelte-h":!0}),$(se)!=="svelte-6gmbd2"&&(se.innerHTML=Bt),Oe=p(e),h(ie.$$.fragment,e),et=p(e),re=f(e,"P",{"data-svelte-h":!0}),$(re)!=="svelte-9dei1q"&&(re.textContent=Vt),tt=p(e),oe=f(e,"P",{"data-svelte-h":!0}),$(oe)!=="svelte-1gl7574"&&(oe.innerHTML=Ft),lt=p(e),h(pe.$$.fragment,e),nt=p(e),ce=f(e,"P",{"data-svelte-h":!0}),$(ce)!=="svelte-k1bp7z"&&(ce.innerHTML=Yt),at=p(e),ue=f(e,"UL",{"data-svelte-h":!0}),$(ue)!=="svelte-17m22mk"&&(ue.innerHTML=zt),st=p(e),h(j.$$.fragment,e),it=p(e),me=f(e,"P",{"data-svelte-h":!0}),$(me)!=="svelte-iowxvh"&&(me.textContent=Et),rt=p(e),h(fe.$$.fragment,e),ot=p(e),h(W.$$.fragment,e),pt=p(e),de=f(e,"P",{"data-svelte-h":!0}),$(de)!=="svelte-1pqx2cy"&&(de.textContent=Lt),ct=p(e),h(X.$$.fragment,e),ut=p(e),h(he.$$.fragment,e),mt=p(e),ye=f(e,"P",{"data-svelte-h":!0}),$(ye)!=="svelte-18p6tri"&&(ye.textContent=Ht),ft=p(e),Me=f(e,"UL",{"data-svelte-h":!0}),$(Me)!=="svelte-gq7brs"&&(Me.innerHTML=Nt),dt=p(e),h(be.$$.fragment,e),ht=p(e),$e=f(e,"P",{}),Kt($e).forEach(a),this.h()},h(){Ot(l,"name","hf:doc:metadata"),Ot(l,"content",$l)},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,C,t),s(e,Je,t),s(e,R,t),s(e,Te,t),s(e,k,t),s(e,Ue,t),y(G,e,t),s(e,xe,t),s(e,I,t),s(e,ve,t),y(x,e,t),s(e,Ze,t),y(v,e,t),s(e,je,t),s(e,B,t),s(e,We,t),y(V,e,t),s(e,Xe,t),s(e,F,t),s(e,Ce,t),y(Y,e,t),s(e,Re,t),s(e,z,t),s(e,ke,t),y(E,e,t),s(e,Ge,t),s(e,L,t),s(e,Ie,t),y(Z,e,t),s(e,Be,t),y(H,e,t),s(e,Ve,t),s(e,N,t),s(e,Fe,t),s(e,Q,t),s(e,Ye,t),y(A,e,t),s(e,ze,t),s(e,S,t),s(e,Ee,t),s(e,q,t),s(e,Le,t),y(D,e,t),s(e,He,t),s(e,P,t),s(e,Ne,t),s(e,K,t),s(e,Qe,t),s(e,O,t),s(e,Ae,t),y(ee,e,t),s(e,Se,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,me,t),s(e,rt,t),y(fe,e,t),s(e,ot,t),y(W,e,t),s(e,pt,t),s(e,de,t),s(e,ct,t),y(X,e,t),s(e,ut,t),y(he,e,t),s(e,mt,t),s(e,ye,t),s(e,ft,t),s(e,Me,t),s(e,dt,t),y(be,e,t),s(e,ht,t),s(e,$e,t),yt=!0},p(e,[t]){const Qt={};t&2&&(Qt.$$scope={dirty:t,ctx:e}),x.$set(Qt);const At={};t&2&&(At.$$scope={dirty:t,ctx:e}),v.$set(At);const St={};t&2&&(St.$$scope={dirty:t,ctx:e}),Z.$set(St);const qt={};t&2&&(qt.$$scope={dirty:t,ctx:e}),j.$set(qt);const Dt={};t&2&&(Dt.$$scope={dirty:t,ctx:e}),W.$set(Dt);const Pt={};t&2&&(Pt.$$scope={dirty:t,ctx:e}),X.$set(Pt)},i(e){yt||(M(i.$$.fragment,e),M(G.$$.fragment,e),M(x.$$.fragment,e),M(v.$$.fragment,e),M(V.$$.fragment,e),M(Y.$$.fragment,e),M(E.$$.fragment,e),M(Z.$$.fragment,e),M(H.$$.fragment,e),M(A.$$.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(fe.$$.fragment,e),M(W.$$.fragment,e),M(X.$$.fragment,e),M(he.$$.fragment,e),M(be.$$.fragment,e),yt=!0)},o(e){b(i.$$.fragment,e),b(G.$$.fragment,e),b(x.$$.fragment,e),b(v.$$.fragment,e),b(V.$$.fragment,e),b(Y.$$.fragment,e),b(E.$$.fragment,e),b(Z.$$.fragment,e),b(H.$$.fragment,e),b(A.$$.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(fe.$$.fragment,e),b(W.$$.fragment,e),b(X.$$.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(C),a(Je),a(R),a(Te),a(k),a(Ue),a(xe),a(I),a(ve),a(Ze),a(je),a(B),a(We),a(Xe),a(F),a(Ce),a(Re),a(z),a(ke),a(Ge),a(L),a(Ie),a(Be),a(Ve),a(N),a(Fe),a(Q),a(Ye),a(ze),a(S),a(Ee),a(q),a(Le),a(He),a(P),a(Ne),a(K),a(Qe),a(O),a(Ae),a(Se),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(me),a(rt),a(ot),a(pt),a(de),a(ct),a(ut),a(mt),a(ye),a(ft),a(Me),a(dt),a(ht),a($e)),a(l),g(i,e),g(G,e),g(x,e),g(v,e),g(V,e),g(Y,e),g(E,e),g(Z,e),g(H,e),g(A,e),g(D,e),g(ee,e),g(ne,e),g(ie,e),g(pe,e),g(j,e),g(fe,e),g(W,e),g(X,e),g(he,e),g(be,e)}}}const $l='{"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 wl(w){return tl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zl extends ll{constructor(l){super(),nl(this,l,wl,gl,el,{})}}export{Zl as component};
