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