import{s as Jl,o as Ul,n as A}from"../chunks/scheduler.8c3d61f6.js";import{S as Tl,i as bl,g as u,s as i,r as d,A as _l,h as M,f as l,c as o,j as yl,u as y,x as m,k as hl,y as jl,a as s,v as h,d as w,t as J,w as U}from"../chunks/index.da70eac4.js";import{T as Nt}from"../chunks/Tip.1d9b8c37.js";import{C as j}from"../chunks/CodeBlock.00a903b3.js";import{H as ve,E as Cl}from"../chunks/EditOnGithub.1e64e623.js";import{H as wl,a as Gt}from"../chunks/HfOption.6ab18950.js";function gl(_){let n,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(){n=u("p"),n.innerHTML=r},l(a){n=M(a,"P",{"data-svelte-h":!0}),m(n)!=="svelte-1qbiqsn"&&(n.innerHTML=r)},m(a,c){s(a,n,c)},p:A,d(a){a&&l(n)}}}function $l(_){let n,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/custom_diffusion/train_custom_diffusion.py" rel="nofollow">script</a> and let us know if you have any questions or concerns.';return{c(){n=u("p"),n.innerHTML=r},l(a){n=M(a,"P",{"data-svelte-h":!0}),m(n)!=="svelte-lc7164"&&(n.innerHTML=r)},m(a,c){s(a,n,c)},p:A,d(a){a&&l(n)}}}function Il(_){let n,r='A lot of the code in the Custom Diffusion training script is similar to the <a href="dreambooth#training-script">DreamBooth</a> script. This guide instead focuses on the code that is relevant to Custom Diffusion.';return{c(){n=u("p"),n.innerHTML=r},l(a){n=M(a,"P",{"data-svelte-h":!0}),m(n)!=="svelte-17hnobu"&&(n.innerHTML=r)},m(a,c){s(a,n,c)},p:A,d(a){a&&l(n)}}}function Zl(_){let n,r="If you’re training on human faces, the Custom Diffusion team has found the following parameters to work well:",a,c,p="<li><code>--learning_rate=5e-6</code></li> <li><code>--max_train_steps</code> can be anywhere between 1000 and 2000</li> <li><code>--freeze_model=crossattn</code></li> <li>use at least 15-20 images to train with</li>";return{c(){n=u("p"),n.textContent=r,a=i(),c=u("ul"),c.innerHTML=p},l(f){n=M(f,"P",{"data-svelte-h":!0}),m(n)!=="svelte-1nab0gg"&&(n.textContent=r),a=o(f),c=M(f,"UL",{"data-svelte-h":!0}),m(c)!=="svelte-1a7julv"&&(c.innerHTML=p)},m(f,b){s(f,n,b),s(f,a,b),s(f,c,b)},p:A,d(f){f&&(l(n),l(a),l(c))}}}function Xl(_){let n,r;return n=new j({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aC10by1zYXZlLW1vZGVsJTIyJTBBZXhwb3J0JTIwSU5TVEFOQ0VfRElSJTNEJTIyLiUyRmRhdGElMkZjYXQlMjIlMEElMEFhY2NlbGVyYXRlJTIwbGF1bmNoJTIwdHJhaW5fY3VzdG9tX2RpZmZ1c2lvbi5weSUyMCU1QyUwQSUyMCUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9OQU1FJTIwJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9kYXRhX2RpciUzRCUyNElOU1RBTkNFX0RJUiUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyNE9VVFBVVF9ESVIlMjAlNUMlMEElMjAlMjAtLWNsYXNzX2RhdGFfZGlyJTNELiUyRnJlYWxfcmVnJTJGc2FtcGxlc19jYXQlMkYlMjAlNUMlMEElMjAlMjAtLXdpdGhfcHJpb3JfcHJlc2VydmF0aW9uJTIwJTVDJTBBJTIwJTIwLS1yZWFsX3ByaW9yJTIwJTVDJTBBJTIwJTIwLS1wcmlvcl9sb3NzX3dlaWdodCUzRDEuMCUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfcHJvbXB0JTNEJTIyY2F0JTIyJTIwJTVDJTBBJTIwJTIwLS1udW1fY2xhc3NfaW1hZ2VzJTNEMjAwJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9wcm9tcHQlM0QlMjJwaG90byUyMG9mJTIwYSUyMCUzQ25ldzElM0UlMjBjYXQlMjIlMjAlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QyJTIwJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNEMWUtNSUyMCUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNEMjUwJTIwJTVDJTBBJTIwJTIwLS1zY2FsZV9sciUyMCU1QyUwQSUyMCUyMC0taGZsaXAlMjAlMjAlNUMlMEElMjAlMjAtLW1vZGlmaWVyX3Rva2VuJTIwJTIyJTNDbmV3MSUzRSUyMiUyMCU1QyUwQSUyMCUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlM0QlMjIlM0NuZXcxJTNFJTIwY2F0JTIwc2l0dGluZyUyMGluJTIwYSUyMGJ1Y2tldCUyMiUyMCU1QyUwQSUyMCUyMC0tcmVwb3J0X3RvJTNEJTIyd2FuZGIlMjIlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>
<span class="hljs-built_in">export</span> INSTANCE_DIR=<span class="hljs-string">&quot;./data/cat&quot;</span>

accelerate launch train_custom_diffusion.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --instance_data_dir=<span class="hljs-variable">$INSTANCE_DIR</span> \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --class_data_dir=./real_reg/samples_cat/ \\
  --with_prior_preservation \\
  --real_prior \\
  --prior_loss_weight=1.0 \\
  --class_prompt=<span class="hljs-string">&quot;cat&quot;</span> \\
  --num_class_images=200 \\
  --instance_prompt=<span class="hljs-string">&quot;photo of a &lt;new1&gt; cat&quot;</span>  \\
  --resolution=512  \\
  --train_batch_size=2  \\
  --learning_rate=1e-5  \\
  --lr_warmup_steps=0 \\
  --max_train_steps=250 \\
  --scale_lr \\
  --hflip  \\
  --modifier_token <span class="hljs-string">&quot;&lt;new1&gt;&quot;</span> \\
  --validation_prompt=<span class="hljs-string">&quot;&lt;new1&gt; cat sitting in a bucket&quot;</span> \\
  --report_to=<span class="hljs-string">&quot;wandb&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){d(n.$$.fragment)},l(a){y(n.$$.fragment,a)},m(a,c){h(n,a,c),r=!0},p:A,i(a){r||(w(n.$$.fragment,a),r=!0)},o(a){J(n.$$.fragment,a),r=!1},d(a){U(n,a)}}}function Wl(_){let n,r='Custom Diffusion can also learn multiple concepts if you provide a <a href="https://github.com/adobe-research/custom-diffusion/blob/main/assets/concept_list.json" rel="nofollow">JSON</a> file with some details about each concept it should learn.',a,c,p="Run clip-retrieval to collect some real images to use for regularization:",f,b,g,$,X="Then you can launch the script:",B,I,Z;return b=new j({props:{code:"cGlwJTIwaW5zdGFsbCUyMGNsaXAtcmV0cmlldmFsJTBBcHl0aG9uJTIwcmV0cmlldmUucHklMjAtLWNsYXNzX3Byb21wdCUyMCU3QiU3RCUyMC0tY2xhc3NfZGF0YV9kaXIlMjAlN0IlN0QlMjAtLW51bV9jbGFzc19pbWFnZXMlMjAyMDA=",highlighted:`pip install clip-retrieval
python retrieve.py --class_prompt {} --class_data_dir {} --num_class_images 200`,wrap:!1}}),I=new j({props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SUyMCUyMC0tcHVzaF90b19odWI=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>

accelerate launch train_custom_diffusion.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span>  \\
  --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
  --concepts_list=./concept_list.json \\
  --with_prior_preservation \\
  --real_prior \\
  --prior_loss_weight=1.0 \\
  --resolution=512  \\
  --train_batch_size=2  \\
  --learning_rate=1e-5  \\
  --lr_warmup_steps=0 \\
  --max_train_steps=500 \\
  --num_class_images=200 \\
  --scale_lr \\
  --hflip  \\
  --modifier_token <span class="hljs-string">&quot;&lt;new1&gt;+&lt;new2&gt;&quot;</span> \\
  --push_to_hub`,wrap:!1}}),{c(){n=u("p"),n.innerHTML=r,a=i(),c=u("p"),c.textContent=p,f=i(),d(b.$$.fragment),g=i(),$=u("p"),$.textContent=X,B=i(),d(I.$$.fragment)},l(T){n=M(T,"P",{"data-svelte-h":!0}),m(n)!=="svelte-dc1va4"&&(n.innerHTML=r),a=o(T),c=M(T,"P",{"data-svelte-h":!0}),m(c)!=="svelte-wqrprq"&&(c.textContent=p),f=o(T),y(b.$$.fragment,T),g=o(T),$=M(T,"P",{"data-svelte-h":!0}),m($)!=="svelte-1etdm7l"&&($.textContent=X),B=o(T),y(I.$$.fragment,T)},m(T,C){s(T,n,C),s(T,a,C),s(T,c,C),s(T,f,C),h(b,T,C),s(T,g,C),s(T,$,C),s(T,B,C),h(I,T,C),Z=!0},p:A,i(T){Z||(w(b.$$.fragment,T),w(I.$$.fragment,T),Z=!0)},o(T){J(b.$$.fragment,T),J(I.$$.fragment,T),Z=!1},d(T){T&&(l(n),l(a),l(c),l(f),l(g),l($),l(B)),U(b,T),U(I,T)}}}function vl(_){let n,r,a,c;return n=new Gt({props:{id:"training-inference",option:"single concept",$$slots:{default:[Xl]},$$scope:{ctx:_}}}),a=new Gt({props:{id:"training-inference",option:"multiple concepts",$$slots:{default:[Wl]},$$scope:{ctx:_}}}),{c(){d(n.$$.fragment),r=i(),d(a.$$.fragment)},l(p){y(n.$$.fragment,p),r=o(p),y(a.$$.fragment,p)},m(p,f){h(n,p,f),s(p,r,f),h(a,p,f),c=!0},p(p,f){const b={};f&2&&(b.$$scope={dirty:f,ctx:p}),n.$set(b);const g={};f&2&&(g.$$scope={dirty:f,ctx:p}),a.$set(g)},i(p){c||(w(n.$$.fragment,p),w(a.$$.fragment,p),c=!0)},o(p){J(n.$$.fragment,p),J(a.$$.fragment,p),c=!1},d(p){p&&l(r),U(n,p),U(a,p)}}}function Vl(_){let n,r;return n=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnVuZXQubG9hZF9hdHRuX3Byb2NzKCUyMnBhdGgtdG8tc2F2ZS1tb2RlbCUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIycHl0b3JjaF9jdXN0b21fZGlmZnVzaW9uX3dlaWdodHMuYmluJTIyKSUwQXBpcGVsaW5lLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIycGF0aC10by1zYXZlLW1vZGVsJTIyJTJDJTIwd2VpZ2h0X25hbWUlM0QlMjIlM0NuZXcxJTNFLmJpbiUyMiklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMiUzQ25ldzElM0UlMjBjYXQlMjBzaXR0aW5nJTIwaW4lMjBhJTIwYnVja2V0JTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENi4wJTJDJTBBJTIwJTIwJTIwJTIwZXRhJTNEMS4wJTJDJTBBKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJjYXQucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>, torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.unet.load_attn_procs(<span class="hljs-string">&quot;path-to-save-model&quot;</span>, weight_name=<span class="hljs-string">&quot;pytorch_custom_diffusion_weights.bin&quot;</span>)
pipeline.load_textual_inversion(<span class="hljs-string">&quot;path-to-save-model&quot;</span>, weight_name=<span class="hljs-string">&quot;&lt;new1&gt;.bin&quot;</span>)

image = pipeline(
    <span class="hljs-string">&quot;&lt;new1&gt; cat sitting in a bucket&quot;</span>,
    num_inference_steps=<span class="hljs-number">100</span>,
    guidance_scale=<span class="hljs-number">6.0</span>,
    eta=<span class="hljs-number">1.0</span>,
).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat.png&quot;</span>)`,wrap:!1}}),{c(){d(n.$$.fragment)},l(a){y(n.$$.fragment,a)},m(a,c){h(n,a,c),r=!0},p:A,i(a){r||(w(n.$$.fragment,a),r=!0)},o(a){J(n.$$.fragment,a),r=!1},d(a){U(n,a)}}}function Nl(_){let n,r;return n=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwaHVnZ2luZ2ZhY2VfaH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ZGFuY2Vfc2NhbGUlM0Q2LjAlMkMlMEElMjAlMjAlMjAlMjBldGElM0QxLjAlMkMlMEEpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMm11bHRpLXN1YmplY3QucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> huggingface_hub.repocard <span class="hljs-keyword">import</span> RepoCard
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>, torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
model_id = <span class="hljs-string">&quot;sayakpaul/custom-diffusion-cat-wooden-pot&quot;</span>
pipeline.unet.load_attn_procs(model_id, weight_name=<span class="hljs-string">&quot;pytorch_custom_diffusion_weights.bin&quot;</span>)
pipeline.load_textual_inversion(model_id, weight_name=<span class="hljs-string">&quot;&lt;new1&gt;.bin&quot;</span>)
pipeline.load_textual_inversion(model_id, weight_name=<span class="hljs-string">&quot;&lt;new2&gt;.bin&quot;</span>)

image = pipeline(
    <span class="hljs-string">&quot;the &lt;new1&gt; cat sculpture in the style of a &lt;new2&gt; wooden pot&quot;</span>,
    num_inference_steps=<span class="hljs-number">100</span>,
    guidance_scale=<span class="hljs-number">6.0</span>,
    eta=<span class="hljs-number">1.0</span>,
).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;multi-subject.png&quot;</span>)`,wrap:!1}}),{c(){d(n.$$.fragment)},l(a){y(n.$$.fragment,a)},m(a,c){h(n,a,c),r=!0},p:A,i(a){r||(w(n.$$.fragment,a),r=!0)},o(a){J(n.$$.fragment,a),r=!1},d(a){U(n,a)}}}function Gl(_){let n,r,a,c;return n=new Gt({props:{id:"training-inference",option:"single concept",$$slots:{default:[Vl]},$$scope:{ctx:_}}}),a=new Gt({props:{id:"training-inference",option:"multiple concepts",$$slots:{default:[Nl]},$$scope:{ctx:_}}}),{c(){d(n.$$.fragment),r=i(),d(a.$$.fragment)},l(p){y(n.$$.fragment,p),r=o(p),y(a.$$.fragment,p)},m(p,f){h(n,p,f),s(p,r,f),h(a,p,f),c=!0},p(p,f){const b={};f&2&&(b.$$scope={dirty:f,ctx:p}),n.$set(b);const g={};f&2&&(g.$$scope={dirty:f,ctx:p}),a.$set(g)},i(p){c||(w(n.$$.fragment,p),w(a.$$.fragment,p),c=!0)},o(p){J(n.$$.fragment,p),J(a.$$.fragment,p),c=!1},d(p){p&&l(r),U(n,p),U(a,p)}}}function Rl(_){let n,r,a,c,p,f,b,g='<a href="https://huggingface.co/papers/2212.04488" rel="nofollow">Custom Diffusion</a> is a training technique for personalizing image generation models. Like Textual Inversion, DreamBooth, and LoRA, Custom Diffusion only requires a few (~4-5) example images. This technique works by only training weights in the cross-attention layers, and it uses a special word to represent the newly learned concept. Custom Diffusion is unique because it can also learn multiple concepts at the same time.',$,X,B="If you’re training on a GPU with limited vRAM, you should try enabling xFormers with <code>--enable_xformers_memory_efficient_attention</code> for faster training with lower vRAM requirements (16GB). To save even more memory, add <code>--set_grads_to_none</code> in the training argument to set the gradients to <code>None</code> instead of zero (this option can cause some issues, so if you experience any, try removing this parameter).",I,Z,T='This guide will explore the <a href="https://github.com/huggingface/diffusers/blob/main/examples/custom_diffusion/train_custom_diffusion.py" rel="nofollow">train_custom_diffusion.py</a> script to help you become more familiar with it, and how you can adapt it for your own use-case.',C,k,Rt="Before running the script, make sure you install the library from source:",Ne,z,Ge,x,At="Navigate to the example folder with the training script and install the required dependencies:",Re,E,Ae,W,Be,Y,Bt="Initialize an 🤗 Accelerate environment:",ke,Q,ze,H,kt="To setup a default 🤗 Accelerate environment without choosing any configurations:",xe,L,Ee,S,zt="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",Ye,F,Qe,q,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.',He,v,Le,D,Se,P,Et='The training script contains all the parameters to help you customize your training run. These are found in the <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/custom_diffusion/train_custom_diffusion.py#L319" rel="nofollow"><code>parse_args()</code></a> function. The function comes with default values, but you can also set your own values in the training command if you’d like.',Fe,K,Yt="For example, to change the resolution of the input image:",qe,O,De,ee,Qt='Many of the basic parameters are described in the <a href="dreambooth#script-parameters">DreamBooth</a> training guide, so this guide focuses on the parameters unique to Custom Diffusion:',Pe,te,Ht="<li><code>--freeze_model</code>: freezes the key and value parameters in the cross-attention layer; the default is <code>crossattn_kv</code>, but you can set it to <code>crossattn</code> to train all the parameters in the cross-attention layer</li> <li><code>--concepts_list</code>: to learn multiple concepts, provide a path to a JSON file containing the concepts</li> <li><code>--modifier_token</code>: a special word used to represent the learned concept</li> <li><code>--initializer_token</code>: a special word used to initialize the embeddings of the <code>modifier_token</code></li>",Ke,le,Oe,se,Lt="Prior preservation loss is a method that uses a model’s own generated samples to help it learn how to generate more diverse images. Because these generated sample images belong to the same class as the images you provided, they help the model retain what it has learned about the class and how it can use what it already knows about the class to make new compositions.",et,ne,St='Many of the parameters for prior preservation loss are described in the <a href="dreambooth#prior-preservation-loss">DreamBooth</a> training guide.',tt,ae,lt,ie,Ft="Custom Diffusion includes training the target images with a small set of real images to prevent overfitting. As you can imagine, this can be easy to do when you’re only training on a few images! Download 200 real images with <code>clip_retrieval</code>. The <code>class_prompt</code> should be the same category as the target images. These images are stored in <code>class_data_dir</code>.",st,oe,nt,pe,qt="To enable regularization, add the following parameters:",at,re,Dt="<li><code>--with_prior_preservation</code>: whether to use prior preservation loss</li> <li><code>--prior_loss_weight</code>: controls the influence of the prior preservation loss on the model</li> <li><code>--real_prior</code>: whether to use a small set of real images to prevent overfitting</li>",it,ce,ot,ue,pt,V,rt,Me,Pt="The Custom Diffusion training script has two dataset classes:",ct,me,Kt='<li><a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/custom_diffusion/train_custom_diffusion.py#L165" rel="nofollow"><code>CustomDiffusionDataset</code></a>: preprocesses the images, class images, and prompts for training</li> <li><a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/custom_diffusion/train_custom_diffusion.py#L148" rel="nofollow"><code>PromptDataset</code></a>: prepares the prompts for generating class images</li>',ut,fe,Ot='Next, the <code>modifier_token</code> is <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/custom_diffusion/train_custom_diffusion.py#L811" rel="nofollow">added to the tokenizer</a>, converted to token ids, and the token embeddings are resized to account for the new <code>modifier_token</code>. Then the <code>modifier_token</code> embeddings are initialized with the embeddings of the <code>initializer_token</code>. All parameters in the text encoder are frozen, except for the token embeddings since this is what the model is trying to learn to associate with the concepts.',Mt,de,mt,ye,el='Now you’ll need to add the <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/custom_diffusion/train_custom_diffusion.py#L911C3-L911C3" rel="nofollow">Custom Diffusion weights</a> to the attention layers. This is a really important step for getting the shape and size of the attention weights correct, and for setting the appropriate number of attention processors in each UNet block.',ft,he,dt,we,tl='The <a href="https://github.com/huggingface/diffusers/blob/84cd9e8d01adb47f046b1ee449fc76a0c32dc4e2/examples/custom_diffusion/train_custom_diffusion.py#L982" rel="nofollow">optimizer</a> is initialized to update the cross-attention layer parameters:',yt,Je,ht,Ue,ll='In the <a href="https://github.com/huggingface/diffusers/blob/84cd9e8d01adb47f046b1ee449fc76a0c32dc4e2/examples/custom_diffusion/train_custom_diffusion.py#L1048" rel="nofollow">training loop</a>, it is important to only update the embeddings for the concept you’re trying to learn. This means setting the gradients of all the other token embeddings to zero:',wt,Te,Jt,be,Ut,_e,sl="Once you’ve made all your changes or you’re okay with the default configuration, you’re ready to launch the training script! 🚀",Tt,je,nl='In this guide, you’ll download and use these example <a href="https://www.cs.cmu.edu/~custom-diffusion/assets/data.zip" rel="nofollow">cat images</a>. You can also create and use your own dataset if you want (see the <a href="create_dataset">Create a dataset for training</a> guide).',bt,Ce,al="Set the environment variable <code>MODEL_NAME</code> to a model id on the Hub or a path to a local model, <code>INSTANCE_DIR</code>  to the path where you just downloaded the cat images to, and <code>OUTPUT_DIR</code> to where you want to save the model. You’ll use <code>&lt;new1&gt;</code> as the special word to tie the newly learned embeddings to. The script creates and saves model checkpoints and a pytorch_custom_diffusion_weights.bin file to your repository.",_t,ge,il="To monitor training progress with Weights and Biases, add the <code>--report_to=wandb</code> parameter to the training command and specify a validation prompt with <code>--validation_prompt</code>. This is useful for debugging and saving intermediate results.",jt,N,Ct,G,gt,$e,ol="Once training is finished, you can use your new Custom Diffusion model for inference.",$t,R,It,Ie,Zt,Ze,pl="Congratulations on training a model with Custom Diffusion! 🎉 To learn more:",Xt,Xe,rl='<li>Read the <a href="https://www.cs.cmu.edu/~custom-diffusion/" rel="nofollow">Multi-Concept Customization of Text-to-Image Diffusion</a> blog post to learn more details about the experimental results from the Custom Diffusion team.</li>',Wt,We,vt,Ve,Vt;return p=new ve({props:{title:"Custom Diffusion",local:"custom-diffusion",headingTag:"h1"}}),z=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}}),E=new j({props:{code:"Y2QlMjBleGFtcGxlcyUyRmN1c3RvbV9kaWZmdXNpb24lMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0JTBBcGlwJTIwaW5zdGFsbCUyMGNsaXAtcmV0cmlldmFs",highlighted:`<span class="hljs-built_in">cd</span> examples/custom_diffusion
pip install -r requirements.txt
pip install clip-retrieval`,wrap:!1}}),W=new Nt({props:{$$slots:{default:[gl]},$$scope:{ctx:_}}}),Q=new j({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),L=new j({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),F=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}}),v=new Nt({props:{$$slots:{default:[$l]},$$scope:{ctx:_}}}),D=new ve({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),O=new j({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2N1c3RvbV9kaWZmdXNpb24ucHklMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0QyNTY=",highlighted:`accelerate launch train_custom_diffusion.py \\
  --resolution=256`,wrap:!1}}),le=new ve({props:{title:"Prior preservation loss",local:"prior-preservation-loss",headingTag:"h3"}}),ae=new ve({props:{title:"Regularization",local:"regularization",headingTag:"h3"}}),oe=new j({props:{code:"cHl0aG9uJTIwcmV0cmlldmUucHklMjAtLWNsYXNzX3Byb21wdCUyMGNhdCUyMC0tY2xhc3NfZGF0YV9kaXIlMjByZWFsX3JlZyUyRnNhbXBsZXNfY2F0JTIwLS1udW1fY2xhc3NfaW1hZ2VzJTIwMjAw",highlighted:'python retrieve.py --class_prompt <span class="hljs-built_in">cat</span> --class_data_dir real_reg/samples_cat --num_class_images 200',wrap:!1}}),ce=new j({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2N1c3RvbV9kaWZmdXNpb24ucHklMjAlNUMlMEElMjAlMjAtLXdpdGhfcHJpb3JfcHJlc2VydmF0aW9uJTIwJTVDJTBBJTIwJTIwLS1wcmlvcl9sb3NzX3dlaWdodCUzRDEuMCUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfZGF0YV9kaXIlM0QlMjIuJTJGcmVhbF9yZWclMkZzYW1wbGVzX2NhdCUyMiUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfcHJvbXB0JTNEJTIyY2F0JTIyJTIwJTVDJTBBJTIwJTIwLS1yZWFsX3ByaW9yJTNEVHJ1ZSUyMCU1Qw==",highlighted:`accelerate launch train_custom_diffusion.py \\
  --with_prior_preservation \\
  --prior_loss_weight=1.0 \\
  --class_data_dir=<span class="hljs-string">&quot;./real_reg/samples_cat&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;cat&quot;</span> \\
  --real_prior=True \\`,wrap:!1}}),ue=new ve({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),V=new Nt({props:{$$slots:{default:[Il]},$$scope:{ctx:_}}}),de=new j({props:{code:"cGFyYW1zX3RvX2ZyZWV6ZSUyMCUzRCUyMGl0ZXJ0b29scy5jaGFpbiglMEElMjAlMjAlMjAlMjB0ZXh0X2VuY29kZXIudGV4dF9tb2RlbC5lbmNvZGVyLnBhcmFtZXRlcnMoKSUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2Rlci50ZXh0X21vZGVsLmZpbmFsX2xheWVyX25vcm0ucGFyYW1ldGVycygpJTJDJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyLnRleHRfbW9kZWwuZW1iZWRkaW5ncy5wb3NpdGlvbl9lbWJlZGRpbmcucGFyYW1ldGVycygpJTJDJTBBKSUwQWZyZWV6ZV9wYXJhbXMocGFyYW1zX3RvX2ZyZWV6ZSk=",highlighted:`params_to_freeze = itertools.chain(
    text_encoder.text_model.encoder.parameters(),
    text_encoder.text_model.final_layer_norm.parameters(),
    text_encoder.text_model.embeddings.position_embedding.parameters(),
)
freeze_params(params_to_freeze)`,wrap:!1}}),he=new j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AlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cmFpbl9xX291dCUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaGlkZGVuX3NpemUlM0RoaWRkZW5fc2l6ZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGNyb3NzX2F0dGVudGlvbl9kaW0lM0Rjcm9zc19hdHRlbnRpb25fZGltJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQWRlbCUyMHN0JTBBdW5ldC5zZXRfYXR0bl9wcm9jZXNzb3IoY3VzdG9tX2RpZmZ1c2lvbl9hdHRuX3Byb2NzKSUwQWN1c3RvbV9kaWZmdXNpb25fbGF5ZXJzJTIwJTNEJTIwQXR0blByb2NzTGF5ZXJzKHVuZXQuYXR0bl9wcm9jZXNzb3JzKQ==",highlighted:`st = unet.state_dict()
<span class="hljs-keyword">for</span> name, _ <span class="hljs-keyword">in</span> unet.attn_processors.items():
    cross_attention_dim = <span class="hljs-literal">None</span> <span class="hljs-keyword">if</span> name.endswith(<span class="hljs-string">&quot;attn1.processor&quot;</span>) <span class="hljs-keyword">else</span> unet.config.cross_attention_dim
    <span class="hljs-keyword">if</span> name.startswith(<span class="hljs-string">&quot;mid_block&quot;</span>):
        hidden_size = unet.config.block_out_channels[-<span class="hljs-number">1</span>]
    <span class="hljs-keyword">elif</span> name.startswith(<span class="hljs-string">&quot;up_blocks&quot;</span>):
        block_id = <span class="hljs-built_in">int</span>(name[<span class="hljs-built_in">len</span>(<span class="hljs-string">&quot;up_blocks.&quot;</span>)])
        hidden_size = <span class="hljs-built_in">list</span>(<span class="hljs-built_in">reversed</span>(unet.config.block_out_channels))[block_id]
    <span class="hljs-keyword">elif</span> name.startswith(<span class="hljs-string">&quot;down_blocks&quot;</span>):
        block_id = <span class="hljs-built_in">int</span>(name[<span class="hljs-built_in">len</span>(<span class="hljs-string">&quot;down_blocks.&quot;</span>)])
        hidden_size = unet.config.block_out_channels[block_id]
    layer_name = name.split(<span class="hljs-string">&quot;.processor&quot;</span>)[<span class="hljs-number">0</span>]
    weights = {
        <span class="hljs-string">&quot;to_k_custom_diffusion.weight&quot;</span>: st[layer_name + <span class="hljs-string">&quot;.to_k.weight&quot;</span>],
        <span class="hljs-string">&quot;to_v_custom_diffusion.weight&quot;</span>: st[layer_name + <span class="hljs-string">&quot;.to_v.weight&quot;</span>],
    }
    <span class="hljs-keyword">if</span> train_q_out:
        weights[<span class="hljs-string">&quot;to_q_custom_diffusion.weight&quot;</span>] = st[layer_name + <span class="hljs-string">&quot;.to_q.weight&quot;</span>]
        weights[<span class="hljs-string">&quot;to_out_custom_diffusion.0.weight&quot;</span>] = st[layer_name + <span class="hljs-string">&quot;.to_out.0.weight&quot;</span>]
        weights[<span class="hljs-string">&quot;to_out_custom_diffusion.0.bias&quot;</span>] = st[layer_name + <span class="hljs-string">&quot;.to_out.0.bias&quot;</span>]
    <span class="hljs-keyword">if</span> cross_attention_dim <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
        custom_diffusion_attn_procs[name] = attention_class(
            train_kv=train_kv,
            train_q_out=train_q_out,
            hidden_size=hidden_size,
            cross_attention_dim=cross_attention_dim,
        ).to(unet.device)
        custom_diffusion_attn_procs[name].load_state_dict(weights)
    <span class="hljs-keyword">else</span>:
        custom_diffusion_attn_procs[name] = attention_class(
            train_kv=<span class="hljs-literal">False</span>,
            train_q_out=<span class="hljs-literal">False</span>,
            hidden_size=hidden_size,
            cross_attention_dim=cross_attention_dim,
        )
<span class="hljs-keyword">del</span> st
unet.set_attn_processor(custom_diffusion_attn_procs)
custom_diffusion_layers = AttnProcsLayers(unet.attn_processors)`,wrap:!1}}),Je=new j({props:{code:"b3B0aW1pemVyJTIwJTNEJTIwb3B0aW1pemVyX2NsYXNzKCUwQSUyMCUyMCUyMCUyMGl0ZXJ0b29scy5jaGFpbih0ZXh0X2VuY29kZXIuZ2V0X2lucHV0X2VtYmVkZGluZ3MoKS5wYXJhbWV0ZXJzKCklMkMlMjBjdXN0b21fZGlmZnVzaW9uX2xheWVycy5wYXJhbWV0ZXJzKCkpJTBBJTIwJTIwJTIwJTIwaWYlMjBhcmdzLm1vZGlmaWVyX3Rva2VuJTIwaXMlMjBub3QlMjBOb25lJTBBJTIwJTIwJTIwJTIwZWxzZSUyMGN1c3RvbV9kaWZmdXNpb25fbGF5ZXJzLnBhcmFtZXRlcnMoKSUyQyUwQSUyMCUyMCUyMCUyMGxyJTNEYXJncy5sZWFybmluZ19yYXRlJTJDJTBBJTIwJTIwJTIwJTIwYmV0YXMlM0QoYXJncy5hZGFtX2JldGExJTJDJTIwYXJncy5hZGFtX2JldGEyKSUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRGFyZ3MuYWRhbV93ZWlnaHRfZGVjYXklMkMlMEElMjAlMjAlMjAlMjBlcHMlM0RhcmdzLmFkYW1fZXBzaWxvbiUyQyUwQSk=",highlighted:`optimizer = optimizer_class(
    itertools.chain(text_encoder.get_input_embeddings().parameters(), custom_diffusion_layers.parameters())
    <span class="hljs-keyword">if</span> args.modifier_token <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>
    <span class="hljs-keyword">else</span> custom_diffusion_layers.parameters(),
    lr=args.learning_rate,
    betas=(args.adam_beta1, args.adam_beta2),
    weight_decay=args.adam_weight_decay,
    eps=args.adam_epsilon,
)`,wrap:!1}}),Te=new j({props:{code:"aWYlMjBhcmdzLm1vZGlmaWVyX3Rva2VuJTIwaXMlMjBub3QlMjBOb25lJTNBJTBBJTIwJTIwJTIwJTIwaWYlMjBhY2NlbGVyYXRvci5udW1fcHJvY2Vzc2VzJTIwJTNFJTIwMSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGdyYWRzX3RleHRfZW5jb2RlciUyMCUzRCUyMHRleHRfZW5jb2Rlci5tb2R1bGUuZ2V0X2lucHV0X2VtYmVkZGluZ3MoKS53ZWlnaHQuZ3JhZCUwQSUyMCUyMCUyMCUyMGVsc2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBncmFkc190ZXh0X2VuY29kZXIlMjAlM0QlMjB0ZXh0X2VuY29kZXIuZ2V0X2lucHV0X2VtYmVkZGluZ3MoKS53ZWlnaHQuZ3JhZCUwQSUyMCUyMCUyMCUyMGluZGV4X2dyYWRzX3RvX3plcm8lMjAlM0QlMjB0b3JjaC5hcmFuZ2UobGVuKHRva2VuaXplcikpJTIwISUzRCUyMG1vZGlmaWVyX3Rva2VuX2lkJTVCMCU1RCUwQSUyMCUyMCUyMCUyMGZvciUyMGklMjBpbiUyMHJhbmdlKGxlbihtb2RpZmllcl90b2tlbl9pZCU1QjElM0ElNUQpKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGluZGV4X2dyYWRzX3RvX3plcm8lMjAlM0QlMjBpbmRleF9ncmFkc190b196ZXJvJTIwJTI2JTIwKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHRvcmNoLmFyYW5nZShsZW4odG9rZW5pemVyKSklMjAhJTNEJTIwbW9kaWZpZXJfdG9rZW5faWQlNUJpJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMGdyYWRzX3RleHRfZW5jb2Rlci5kYXRhJTVCaW5kZXhfZ3JhZHNfdG9femVybyUyQyUyMCUzQSU1RCUyMCUzRCUyMGdyYWRzX3RleHRfZW5jb2Rlci5kYXRhJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaW5kZXhfZ3JhZHNfdG9femVybyUyQyUyMCUzQSUwQSUyMCUyMCUyMCUyMCU1RC5maWxsXygwKQ==",highlighted:`<span class="hljs-keyword">if</span> args.modifier_token <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
    <span class="hljs-keyword">if</span> accelerator.num_processes &gt; <span class="hljs-number">1</span>:
        grads_text_encoder = text_encoder.module.get_input_embeddings().weight.grad
    <span class="hljs-keyword">else</span>:
        grads_text_encoder = text_encoder.get_input_embeddings().weight.grad
    index_grads_to_zero = torch.arange(<span class="hljs-built_in">len</span>(tokenizer)) != modifier_token_id[<span class="hljs-number">0</span>]
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-built_in">len</span>(modifier_token_id[<span class="hljs-number">1</span>:])):
        index_grads_to_zero = index_grads_to_zero &amp; (
            torch.arange(<span class="hljs-built_in">len</span>(tokenizer)) != modifier_token_id[i]
        )
    grads_text_encoder.data[index_grads_to_zero, :] = grads_text_encoder.data[
        index_grads_to_zero, :
    ].fill_(<span class="hljs-number">0</span>)`,wrap:!1}}),be=new ve({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),N=new Nt({props:{$$slots:{default:[Zl]},$$scope:{ctx:_}}}),G=new wl({props:{id:"training-inference",options:["single concept","multiple concepts"],$$slots:{default:[vl]},$$scope:{ctx:_}}}),R=new wl({props:{id:"training-inference",options:["single concept","multiple concepts"],$$slots:{default:[Gl]},$$scope:{ctx:_}}}),Ie=new ve({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),We=new Cl({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/training/custom_diffusion.md"}}),{c(){n=u("meta"),r=i(),a=u("p"),c=i(),d(p.$$.fragment),f=i(),b=u("p"),b.innerHTML=g,$=i(),X=u("p"),X.innerHTML=B,I=i(),Z=u("p"),Z.innerHTML=T,C=i(),k=u("p"),k.textContent=Rt,Ne=i(),d(z.$$.fragment),Ge=i(),x=u("p"),x.textContent=At,Re=i(),d(E.$$.fragment),Ae=i(),d(W.$$.fragment),Be=i(),Y=u("p"),Y.textContent=Bt,ke=i(),d(Q.$$.fragment),ze=i(),H=u("p"),H.textContent=kt,xe=i(),d(L.$$.fragment),Ee=i(),S=u("p"),S.textContent=zt,Ye=i(),d(F.$$.fragment),Qe=i(),q=u("p"),q.innerHTML=xt,He=i(),d(v.$$.fragment),Le=i(),d(D.$$.fragment),Se=i(),P=u("p"),P.innerHTML=Et,Fe=i(),K=u("p"),K.textContent=Yt,qe=i(),d(O.$$.fragment),De=i(),ee=u("p"),ee.innerHTML=Qt,Pe=i(),te=u("ul"),te.innerHTML=Ht,Ke=i(),d(le.$$.fragment),Oe=i(),se=u("p"),se.textContent=Lt,et=i(),ne=u("p"),ne.innerHTML=St,tt=i(),d(ae.$$.fragment),lt=i(),ie=u("p"),ie.innerHTML=Ft,st=i(),d(oe.$$.fragment),nt=i(),pe=u("p"),pe.textContent=qt,at=i(),re=u("ul"),re.innerHTML=Dt,it=i(),d(ce.$$.fragment),ot=i(),d(ue.$$.fragment),pt=i(),d(V.$$.fragment),rt=i(),Me=u("p"),Me.textContent=Pt,ct=i(),me=u("ul"),me.innerHTML=Kt,ut=i(),fe=u("p"),fe.innerHTML=Ot,Mt=i(),d(de.$$.fragment),mt=i(),ye=u("p"),ye.innerHTML=el,ft=i(),d(he.$$.fragment),dt=i(),we=u("p"),we.innerHTML=tl,yt=i(),d(Je.$$.fragment),ht=i(),Ue=u("p"),Ue.innerHTML=ll,wt=i(),d(Te.$$.fragment),Jt=i(),d(be.$$.fragment),Ut=i(),_e=u("p"),_e.textContent=sl,Tt=i(),je=u("p"),je.innerHTML=nl,bt=i(),Ce=u("p"),Ce.innerHTML=al,_t=i(),ge=u("p"),ge.innerHTML=il,jt=i(),d(N.$$.fragment),Ct=i(),d(G.$$.fragment),gt=i(),$e=u("p"),$e.textContent=ol,$t=i(),d(R.$$.fragment),It=i(),d(Ie.$$.fragment),Zt=i(),Ze=u("p"),Ze.textContent=pl,Xt=i(),Xe=u("ul"),Xe.innerHTML=rl,Wt=i(),d(We.$$.fragment),vt=i(),Ve=u("p"),this.h()},l(e){const t=_l("svelte-u9bgzb",document.head);n=M(t,"META",{name:!0,content:!0}),t.forEach(l),r=o(e),a=M(e,"P",{}),yl(a).forEach(l),c=o(e),y(p.$$.fragment,e),f=o(e),b=M(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-zoobzt"&&(b.innerHTML=g),$=o(e),X=M(e,"P",{"data-svelte-h":!0}),m(X)!=="svelte-1pc1nnz"&&(X.innerHTML=B),I=o(e),Z=M(e,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-u5h0jz"&&(Z.innerHTML=T),C=o(e),k=M(e,"P",{"data-svelte-h":!0}),m(k)!=="svelte-l7dm2q"&&(k.textContent=Rt),Ne=o(e),y(z.$$.fragment,e),Ge=o(e),x=M(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-1nnn36i"&&(x.textContent=At),Re=o(e),y(E.$$.fragment,e),Ae=o(e),y(W.$$.fragment,e),Be=o(e),Y=M(e,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-60q53m"&&(Y.textContent=Bt),ke=o(e),y(Q.$$.fragment,e),ze=o(e),H=M(e,"P",{"data-svelte-h":!0}),m(H)!=="svelte-di6juu"&&(H.textContent=kt),xe=o(e),y(L.$$.fragment,e),Ee=o(e),S=M(e,"P",{"data-svelte-h":!0}),m(S)!=="svelte-tsz4qp"&&(S.textContent=zt),Ye=o(e),y(F.$$.fragment,e),Qe=o(e),q=M(e,"P",{"data-svelte-h":!0}),m(q)!=="svelte-1fkfdql"&&(q.innerHTML=xt),He=o(e),y(v.$$.fragment,e),Le=o(e),y(D.$$.fragment,e),Se=o(e),P=M(e,"P",{"data-svelte-h":!0}),m(P)!=="svelte-1t7lm99"&&(P.innerHTML=Et),Fe=o(e),K=M(e,"P",{"data-svelte-h":!0}),m(K)!=="svelte-or9ig"&&(K.textContent=Yt),qe=o(e),y(O.$$.fragment,e),De=o(e),ee=M(e,"P",{"data-svelte-h":!0}),m(ee)!=="svelte-j5tc3k"&&(ee.innerHTML=Qt),Pe=o(e),te=M(e,"UL",{"data-svelte-h":!0}),m(te)!=="svelte-11ngzwo"&&(te.innerHTML=Ht),Ke=o(e),y(le.$$.fragment,e),Oe=o(e),se=M(e,"P",{"data-svelte-h":!0}),m(se)!=="svelte-1oc83h6"&&(se.textContent=Lt),et=o(e),ne=M(e,"P",{"data-svelte-h":!0}),m(ne)!=="svelte-1mpzp5"&&(ne.innerHTML=St),tt=o(e),y(ae.$$.fragment,e),lt=o(e),ie=M(e,"P",{"data-svelte-h":!0}),m(ie)!=="svelte-13fgxpn"&&(ie.innerHTML=Ft),st=o(e),y(oe.$$.fragment,e),nt=o(e),pe=M(e,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-hwsu6x"&&(pe.textContent=qt),at=o(e),re=M(e,"UL",{"data-svelte-h":!0}),m(re)!=="svelte-6jy6u"&&(re.innerHTML=Dt),it=o(e),y(ce.$$.fragment,e),ot=o(e),y(ue.$$.fragment,e),pt=o(e),y(V.$$.fragment,e),rt=o(e),Me=M(e,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-1owi8ao"&&(Me.textContent=Pt),ct=o(e),me=M(e,"UL",{"data-svelte-h":!0}),m(me)!=="svelte-1fby5zy"&&(me.innerHTML=Kt),ut=o(e),fe=M(e,"P",{"data-svelte-h":!0}),m(fe)!=="svelte-1jto000"&&(fe.innerHTML=Ot),Mt=o(e),y(de.$$.fragment,e),mt=o(e),ye=M(e,"P",{"data-svelte-h":!0}),m(ye)!=="svelte-12higtg"&&(ye.innerHTML=el),ft=o(e),y(he.$$.fragment,e),dt=o(e),we=M(e,"P",{"data-svelte-h":!0}),m(we)!=="svelte-bhf9v4"&&(we.innerHTML=tl),yt=o(e),y(Je.$$.fragment,e),ht=o(e),Ue=M(e,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-dnomct"&&(Ue.innerHTML=ll),wt=o(e),y(Te.$$.fragment,e),Jt=o(e),y(be.$$.fragment,e),Ut=o(e),_e=M(e,"P",{"data-svelte-h":!0}),m(_e)!=="svelte-9dei1q"&&(_e.textContent=sl),Tt=o(e),je=M(e,"P",{"data-svelte-h":!0}),m(je)!=="svelte-mn6swm"&&(je.innerHTML=nl),bt=o(e),Ce=M(e,"P",{"data-svelte-h":!0}),m(Ce)!=="svelte-1o5n4y1"&&(Ce.innerHTML=al),_t=o(e),ge=M(e,"P",{"data-svelte-h":!0}),m(ge)!=="svelte-gvoz0n"&&(ge.innerHTML=il),jt=o(e),y(N.$$.fragment,e),Ct=o(e),y(G.$$.fragment,e),gt=o(e),$e=M(e,"P",{"data-svelte-h":!0}),m($e)!=="svelte-1mw1g2x"&&($e.textContent=ol),$t=o(e),y(R.$$.fragment,e),It=o(e),y(Ie.$$.fragment,e),Zt=o(e),Ze=M(e,"P",{"data-svelte-h":!0}),m(Ze)!=="svelte-nq8p2g"&&(Ze.textContent=pl),Xt=o(e),Xe=M(e,"UL",{"data-svelte-h":!0}),m(Xe)!=="svelte-1u8bbml"&&(Xe.innerHTML=rl),Wt=o(e),y(We.$$.fragment,e),vt=o(e),Ve=M(e,"P",{}),yl(Ve).forEach(l),this.h()},h(){hl(n,"name","hf:doc:metadata"),hl(n,"content",Al)},m(e,t){jl(document.head,n),s(e,r,t),s(e,a,t),s(e,c,t),h(p,e,t),s(e,f,t),s(e,b,t),s(e,$,t),s(e,X,t),s(e,I,t),s(e,Z,t),s(e,C,t),s(e,k,t),s(e,Ne,t),h(z,e,t),s(e,Ge,t),s(e,x,t),s(e,Re,t),h(E,e,t),s(e,Ae,t),h(W,e,t),s(e,Be,t),s(e,Y,t),s(e,ke,t),h(Q,e,t),s(e,ze,t),s(e,H,t),s(e,xe,t),h(L,e,t),s(e,Ee,t),s(e,S,t),s(e,Ye,t),h(F,e,t),s(e,Qe,t),s(e,q,t),s(e,He,t),h(v,e,t),s(e,Le,t),h(D,e,t),s(e,Se,t),s(e,P,t),s(e,Fe,t),s(e,K,t),s(e,qe,t),h(O,e,t),s(e,De,t),s(e,ee,t),s(e,Pe,t),s(e,te,t),s(e,Ke,t),h(le,e,t),s(e,Oe,t),s(e,se,t),s(e,et,t),s(e,ne,t),s(e,tt,t),h(ae,e,t),s(e,lt,t),s(e,ie,t),s(e,st,t),h(oe,e,t),s(e,nt,t),s(e,pe,t),s(e,at,t),s(e,re,t),s(e,it,t),h(ce,e,t),s(e,ot,t),h(ue,e,t),s(e,pt,t),h(V,e,t),s(e,rt,t),s(e,Me,t),s(e,ct,t),s(e,me,t),s(e,ut,t),s(e,fe,t),s(e,Mt,t),h(de,e,t),s(e,mt,t),s(e,ye,t),s(e,ft,t),h(he,e,t),s(e,dt,t),s(e,we,t),s(e,yt,t),h(Je,e,t),s(e,ht,t),s(e,Ue,t),s(e,wt,t),h(Te,e,t),s(e,Jt,t),h(be,e,t),s(e,Ut,t),s(e,_e,t),s(e,Tt,t),s(e,je,t),s(e,bt,t),s(e,Ce,t),s(e,_t,t),s(e,ge,t),s(e,jt,t),h(N,e,t),s(e,Ct,t),h(G,e,t),s(e,gt,t),s(e,$e,t),s(e,$t,t),h(R,e,t),s(e,It,t),h(Ie,e,t),s(e,Zt,t),s(e,Ze,t),s(e,Xt,t),s(e,Xe,t),s(e,Wt,t),h(We,e,t),s(e,vt,t),s(e,Ve,t),Vt=!0},p(e,[t]){const cl={};t&2&&(cl.$$scope={dirty:t,ctx:e}),W.$set(cl);const ul={};t&2&&(ul.$$scope={dirty:t,ctx:e}),v.$set(ul);const Ml={};t&2&&(Ml.$$scope={dirty:t,ctx:e}),V.$set(Ml);const ml={};t&2&&(ml.$$scope={dirty:t,ctx:e}),N.$set(ml);const fl={};t&2&&(fl.$$scope={dirty:t,ctx:e}),G.$set(fl);const dl={};t&2&&(dl.$$scope={dirty:t,ctx:e}),R.$set(dl)},i(e){Vt||(w(p.$$.fragment,e),w(z.$$.fragment,e),w(E.$$.fragment,e),w(W.$$.fragment,e),w(Q.$$.fragment,e),w(L.$$.fragment,e),w(F.$$.fragment,e),w(v.$$.fragment,e),w(D.$$.fragment,e),w(O.$$.fragment,e),w(le.$$.fragment,e),w(ae.$$.fragment,e),w(oe.$$.fragment,e),w(ce.$$.fragment,e),w(ue.$$.fragment,e),w(V.$$.fragment,e),w(de.$$.fragment,e),w(he.$$.fragment,e),w(Je.$$.fragment,e),w(Te.$$.fragment,e),w(be.$$.fragment,e),w(N.$$.fragment,e),w(G.$$.fragment,e),w(R.$$.fragment,e),w(Ie.$$.fragment,e),w(We.$$.fragment,e),Vt=!0)},o(e){J(p.$$.fragment,e),J(z.$$.fragment,e),J(E.$$.fragment,e),J(W.$$.fragment,e),J(Q.$$.fragment,e),J(L.$$.fragment,e),J(F.$$.fragment,e),J(v.$$.fragment,e),J(D.$$.fragment,e),J(O.$$.fragment,e),J(le.$$.fragment,e),J(ae.$$.fragment,e),J(oe.$$.fragment,e),J(ce.$$.fragment,e),J(ue.$$.fragment,e),J(V.$$.fragment,e),J(de.$$.fragment,e),J(he.$$.fragment,e),J(Je.$$.fragment,e),J(Te.$$.fragment,e),J(be.$$.fragment,e),J(N.$$.fragment,e),J(G.$$.fragment,e),J(R.$$.fragment,e),J(Ie.$$.fragment,e),J(We.$$.fragment,e),Vt=!1},d(e){e&&(l(r),l(a),l(c),l(f),l(b),l($),l(X),l(I),l(Z),l(C),l(k),l(Ne),l(Ge),l(x),l(Re),l(Ae),l(Be),l(Y),l(ke),l(ze),l(H),l(xe),l(Ee),l(S),l(Ye),l(Qe),l(q),l(He),l(Le),l(Se),l(P),l(Fe),l(K),l(qe),l(De),l(ee),l(Pe),l(te),l(Ke),l(Oe),l(se),l(et),l(ne),l(tt),l(lt),l(ie),l(st),l(nt),l(pe),l(at),l(re),l(it),l(ot),l(pt),l(rt),l(Me),l(ct),l(me),l(ut),l(fe),l(Mt),l(mt),l(ye),l(ft),l(dt),l(we),l(yt),l(ht),l(Ue),l(wt),l(Jt),l(Ut),l(_e),l(Tt),l(je),l(bt),l(Ce),l(_t),l(ge),l(jt),l(Ct),l(gt),l($e),l($t),l(It),l(Zt),l(Ze),l(Xt),l(Xe),l(Wt),l(vt),l(Ve)),l(n),U(p,e),U(z,e),U(E,e),U(W,e),U(Q,e),U(L,e),U(F,e),U(v,e),U(D,e),U(O,e),U(le,e),U(ae,e),U(oe,e),U(ce,e),U(ue,e),U(V,e),U(de,e),U(he,e),U(Je,e),U(Te,e),U(be,e),U(N,e),U(G,e),U(R,e),U(Ie,e),U(We,e)}}}const Al='{"title":"Custom Diffusion","local":"custom-diffusion","sections":[{"title":"Script parameters","local":"script-parameters","sections":[{"title":"Prior preservation loss","local":"prior-preservation-loss","sections":[],"depth":3},{"title":"Regularization","local":"regularization","sections":[],"depth":3}],"depth":2},{"title":"Training script","local":"training-script","sections":[],"depth":2},{"title":"Launch the script","local":"launch-the-script","sections":[],"depth":2},{"title":"Next steps","local":"next-steps","sections":[],"depth":2}],"depth":1}';function Bl(_){return Ul(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hl extends Tl{constructor(n){super(),bl(this,n,Bl,Rl,Jl,{})}}export{Hl as component};
