import{s as Dl,o as ql,n as W}from"../chunks/scheduler.182ea377.js";import{S as Pl,i as Kl,g as f,s as o,r as h,A as Ol,h as u,f as a,c as r,j as Sl,u as M,x as $,k as Ql,y as ea,a as n,v as y,d as b,t as w,w as g}from"../chunks/index.abf12888.js";import{T as nl}from"../chunks/Tip.230e2334.js";import{C as Z}from"../chunks/CodeBlock.57fe6e13.js";import{H as I}from"../chunks/Heading.16916d63.js";import{H as il,a as N}from"../chunks/HfOption.fc88c804.js";function ta(U){let l,m;return l=new Z({props:{code:"Y2QlMjBleGFtcGxlcyUyRmRyZWFtYm9vdGglMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/dreambooth
pip install -r requirements.txt`,wrap:!1}}),{c(){h(l.$$.fragment)},l(s){M(l.$$.fragment,s)},m(s,c){y(l,s,c),m=!0},p:W,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){w(l.$$.fragment,s),m=!1},d(s){g(l,s)}}}function la(U){let l,m;return l=new Z({props:{code:"Y2QlMjBleGFtcGxlcyUyRmRyZWFtYm9vdGglMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHNfZmxheC50eHQ=",highlighted:`<span class="hljs-built_in">cd</span> examples/dreambooth
pip install -r requirements_flax.txt`,wrap:!1}}),{c(){h(l.$$.fragment)},l(s){M(l.$$.fragment,s)},m(s,c){y(l,s,c),m=!0},p:W,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){w(l.$$.fragment,s),m=!1},d(s){g(l,s)}}}function aa(U){let l,m,s,c;return l=new N({props:{id:"installation",option:"PyTorch",$$slots:{default:[ta]},$$scope:{ctx:U}}}),s=new N({props:{id:"installation",option:"Flax",$$slots:{default:[la]},$$scope:{ctx:U}}}),{c(){h(l.$$.fragment),m=o(),h(s.$$.fragment)},l(i){M(l.$$.fragment,i),m=r(i),M(s.$$.fragment,i)},m(i,p){y(l,i,p),n(i,m,p),y(s,i,p),c=!0},p(i,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:i}),l.$set(d);const _={};p&2&&(_.$$scope={dirty:p,ctx:i}),s.$set(_)},i(i){c||(b(l.$$.fragment,i),b(s.$$.fragment,i),c=!0)},o(i){w(l.$$.fragment,i),w(s.$$.fragment,i),c=!1},d(i){i&&a(m),g(l,i),g(s,i)}}}function sa(U){let l,m='🤗 Accelerate is a library for helping you train on multiple GPUs/TPUs or with mixed-precision. It’ll automatically configure your training setup based on your hardware and environment. Take a look at the 🤗 Accelerate <a href="https://huggingface.co/docs/accelerate/quicktour" rel="nofollow">Quick tour</a> to learn more.';return{c(){l=f("p"),l.innerHTML=m},l(s){l=u(s,"P",{"data-svelte-h":!0}),$(l)!=="svelte-1qbiqsn"&&(l.innerHTML=m)},m(s,c){n(s,l,c)},p:W,d(s){s&&a(l)}}}function na(U){let l,m='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/dreambooth/train_dreambooth.py" rel="nofollow">script</a> and let us know if you have any questions or concerns.';return{c(){l=f("p"),l.innerHTML=m},l(s){l=u(s,"P",{"data-svelte-h":!0}),$(l)!=="svelte-ag3huc"&&(l.innerHTML=m)},m(s,c){n(s,l,c)},p:W,d(s){s&&a(l)}}}function ia(U){let l,m='DreamBooth is very sensitive to training hyperparameters, and it is easy to overfit. Read the <a href="https://huggingface.co/blog/dreambooth" rel="nofollow">Training Stable Diffusion with Dreambooth using 🧨 Diffusers</a> blog post for recommended settings for different subjects to help you choose the appropriate hyperparameters.';return{c(){l=f("p"),l.innerHTML=m},l(s){l=u(s,"P",{"data-svelte-h":!0}),$(l)!=="svelte-1gadrly"&&(l.innerHTML=m)},m(s,c){n(s,l,c)},p:W,d(s){s&&a(l)}}}function oa(U){let l,m="On a 16GB GPU, you can use bitsandbytes 8-bit optimizer and gradient checkpointing to help you train a DreamBooth model. Install bitsandbytes:",s,c,i,p,d="Then, add the following parameter to your training command:",_,j,C;return c=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcw==",highlighted:"pip install bitsandbytes",wrap:!1}}),j=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUM=",highlighted:`accelerate launch train_dreambooth.py \\
  --gradient_checkpointing \\
  --use_8bit_adam \\`,wrap:!1}}),{c(){l=f("p"),l.textContent=m,s=o(),h(c.$$.fragment),i=o(),p=f("p"),p.textContent=d,_=o(),h(j.$$.fragment)},l(T){l=u(T,"P",{"data-svelte-h":!0}),$(l)!=="svelte-fd1675"&&(l.textContent=m),s=r(T),M(c.$$.fragment,T),i=r(T),p=u(T,"P",{"data-svelte-h":!0}),$(p)!=="svelte-1rkm1uq"&&(p.textContent=d),_=r(T),M(j.$$.fragment,T)},m(T,v){n(T,l,v),n(T,s,v),y(c,T,v),n(T,i,v),n(T,p,v),n(T,_,v),y(j,T,v),C=!0},p:W,i(T){C||(b(c.$$.fragment,T),b(j.$$.fragment,T),C=!0)},o(T){w(c.$$.fragment,T),w(j.$$.fragment,T),C=!1},d(T){T&&(a(l),a(s),a(i),a(p),a(_)),g(c,T),g(j,T)}}}function ra(U){let l,m="On a 12GB GPU, you’ll need bitsandbytes 8-bit optimizer, gradient checkpointing, xFormers, and set the gradients to <code>None</code> instead of zero to reduce your memory-usage.",s,c,i;return c=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUyMCU1QyUwQSUyMCUyMC0tc2V0X2dyYWRzX3RvX25vbmUlMjAlNUM=",highlighted:`accelerate launch train_dreambooth.py \\
  --use_8bit_adam \\
  --gradient_checkpointing \\
  --enable_xformers_memory_efficient_attention \\
  --set_grads_to_none \\`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=m,s=o(),h(c.$$.fragment)},l(p){l=u(p,"P",{"data-svelte-h":!0}),$(l)!=="svelte-13zq302"&&(l.innerHTML=m),s=r(p),M(c.$$.fragment,p)},m(p,d){n(p,l,d),n(p,s,d),y(c,p,d),i=!0},p:W,i(p){i||(b(c.$$.fragment,p),i=!0)},o(p){w(c.$$.fragment,p),i=!1},d(p){p&&(a(l),a(s)),g(c,p)}}}function pa(U){let l,m='On a 8GB GPU, you’ll need <a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a> to offload some of the tensors from the vRAM to either the CPU or NVME to allow training with less GPU memory.',s,c,i="Run the following command to configure your 🤗 Accelerate environment:",p,d,_,j,C='During configuration, confirm that you want to use DeepSpeed. Now it should be possible to train on under 8GB vRAM by combining DeepSpeed stage 2, fp16 mixed precision, and offloading the model parameters and the optimizer state to the CPU. The drawback is that this requires more system RAM (~25 GB). See the <a href="https://huggingface.co/docs/accelerate/usage_guides/deepspeed" rel="nofollow">DeepSpeed documentation</a> for more configuration options.',T,v,x='You should also change the default Adam optimizer to DeepSpeed’s optimized version of Adam <a href="https://deepspeed.readthedocs.io/en/latest/optimizers.html#adam-cpu" rel="nofollow"><code>deepspeed.ops.adam.DeepSpeedCPUAdam</code></a> for a substantial speedup. Enabling <code>DeepSpeedCPUAdam</code> requires your system’s CUDA toolchain version to be the same as the one installed with PyTorch.',Q,X,B="bitsandbytes 8-bit optimizers don’t seem to be compatible with DeepSpeed at the moment.",D,R,k="That’s it! You don’t need to add any additional parameters to your training command.",V;return d=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),{c(){l=f("p"),l.innerHTML=m,s=o(),c=f("p"),c.textContent=i,p=o(),h(d.$$.fragment),_=o(),j=f("p"),j.innerHTML=C,T=o(),v=f("p"),v.innerHTML=x,Q=o(),X=f("p"),X.textContent=B,D=o(),R=f("p"),R.textContent=k},l(J){l=u(J,"P",{"data-svelte-h":!0}),$(l)!=="svelte-5k52bm"&&(l.innerHTML=m),s=r(J),c=u(J,"P",{"data-svelte-h":!0}),$(c)!=="svelte-1fx999v"&&(c.textContent=i),p=r(J),M(d.$$.fragment,J),_=r(J),j=u(J,"P",{"data-svelte-h":!0}),$(j)!=="svelte-wvaz2k"&&(j.innerHTML=C),T=r(J),v=u(J,"P",{"data-svelte-h":!0}),$(v)!=="svelte-14m6rf5"&&(v.innerHTML=x),Q=r(J),X=u(J,"P",{"data-svelte-h":!0}),$(X)!=="svelte-z8cdsf"&&(X.textContent=B),D=r(J),R=u(J,"P",{"data-svelte-h":!0}),$(R)!=="svelte-lwtx0u"&&(R.textContent=k)},m(J,G){n(J,l,G),n(J,s,G),n(J,c,G),n(J,p,G),y(d,J,G),n(J,_,G),n(J,j,G),n(J,T,G),n(J,v,G),n(J,Q,G),n(J,X,G),n(J,D,G),n(J,R,G),V=!0},p:W,i(J){V||(b(d.$$.fragment,J),V=!0)},o(J){w(d.$$.fragment,J),V=!1},d(J){J&&(a(l),a(s),a(c),a(p),a(_),a(j),a(T),a(v),a(Q),a(X),a(D),a(R)),g(d,J)}}}function ma(U){let l,m,s,c,i,p;return l=new N({props:{id:"gpu-select",option:"16GB",$$slots:{default:[oa]},$$scope:{ctx:U}}}),s=new N({props:{id:"gpu-select",option:"12GB",$$slots:{default:[ra]},$$scope:{ctx:U}}}),i=new N({props:{id:"gpu-select",option:"8GB",$$slots:{default:[pa]},$$scope:{ctx:U}}}),{c(){h(l.$$.fragment),m=o(),h(s.$$.fragment),c=o(),h(i.$$.fragment)},l(d){M(l.$$.fragment,d),m=r(d),M(s.$$.fragment,d),c=r(d),M(i.$$.fragment,d)},m(d,_){y(l,d,_),n(d,m,_),y(s,d,_),n(d,c,_),y(i,d,_),p=!0},p(d,_){const j={};_&2&&(j.$$scope={dirty:_,ctx:d}),l.$set(j);const C={};_&2&&(C.$$scope={dirty:_,ctx:d}),s.$set(C);const T={};_&2&&(T.$$scope={dirty:_,ctx:d}),i.$set(T)},i(d){p||(b(l.$$.fragment,d),b(s.$$.fragment,d),b(i.$$.fragment,d),p=!0)},o(d){w(l.$$.fragment,d),w(s.$$.fragment,d),w(i.$$.fragment,d),p=!1},d(d){d&&(a(m),a(c)),g(l,d),g(s,d),g(i,d)}}}function ca(U){let l,m;return l=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwSU5TVEFOQ0VfRElSJTNEJTIyLiUyRmRvZyUyMiUwQWV4cG9ydCUyME9VVFBVVF9ESVIlM0QlMjJwYXRoX3RvX3NhdmVkX21vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfZGF0YV9kaXIlM0QlMjRJTlNUQU5DRV9ESVIlMjAlNUMlMEElMjAlMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwJTIwLS1pbnN0YW5jZV9wcm9tcHQlM0QlMjJhJTIwcGhvdG8lMjBvZiUyMHNrcyUyMGRvZyUyMiUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDElMjAlNUMlMEElMjAlMjAtLWxlYXJuaW5nX3JhdGUlM0Q1ZS02JTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNENDAwJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",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> INSTANCE_DIR=<span class="hljs-string">&quot;./dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path_to_saved_model&quot;</span>

accelerate launch train_dreambooth.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> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=1 \\
  --learning_rate=5e-6 \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --max_train_steps=400 \\
  --push_to_hub`,wrap:!1}}),{c(){h(l.$$.fragment)},l(s){M(l.$$.fragment,s)},m(s,c){y(l,s,c),m=!0},p:W,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){w(l.$$.fragment,s),m=!1},d(s){g(l,s)}}}function da(U){let l,m;return l=new Z({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMmR1b25nbmElMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQtZmxheCUyMiUwQWV4cG9ydCUyMElOU1RBTkNFX0RJUiUzRCUyMi4lMkZkb2clMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aC10by1zYXZlLW1vZGVsJTIyJTBBJTBBcHl0aG9uJTIwdHJhaW5fZHJlYW1ib290aF9mbGF4LnB5JTIwJTVDJTBBJTIwJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX05BTUUlMjAlMjAlNUMlMEElMjAlMjAtLWluc3RhbmNlX2RhdGFfZGlyJTNEJTI0SU5TVEFOQ0VfRElSJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMCUyMC0taW5zdGFuY2VfcHJvbXB0JTNEJTIyYSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjIlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNENWUtNiUyMCU1QyUwQSUyMCUyMC0tbWF4X3RyYWluX3N0ZXBzJTNENDAwJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",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> INSTANCE_DIR=<span class="hljs-string">&quot;./dog&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path-to-save-model&quot;</span>

python train_dreambooth_flax.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> \\
  --instance_prompt=<span class="hljs-string">&quot;a photo of sks dog&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --learning_rate=5e-6 \\
  --max_train_steps=400 \\
  --push_to_hub`,wrap:!1}}),{c(){h(l.$$.fragment)},l(s){M(l.$$.fragment,s)},m(s,c){y(l,s,c),m=!0},p:W,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){w(l.$$.fragment,s),m=!1},d(s){g(l,s)}}}function fa(U){let l,m,s,c;return l=new N({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[ca]},$$scope:{ctx:U}}}),s=new N({props:{id:"training-inference",option:"Flax",$$slots:{default:[da]},$$scope:{ctx:U}}}),{c(){h(l.$$.fragment),m=o(),h(s.$$.fragment)},l(i){M(l.$$.fragment,i),m=r(i),M(s.$$.fragment,i)},m(i,p){y(l,i,p),n(i,m,p),y(s,i,p),c=!0},p(i,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:i}),l.$set(d);const _={};p&2&&(_.$$scope={dirty:p,ctx:i}),s.$set(_)},i(i){c||(b(l.$$.fragment,i),b(s.$$.fragment,i),c=!0)},o(i){w(l.$$.fragment,i),w(s.$$.fragment,i),c=!1},d(i){i&&a(m),g(l,i),g(s,i)}}}function ua(U){let l,m="Can’t wait to try your model for inference before training is complete? 🤭 Make sure you have the latest version of 🤗 Accelerate installed.",s,c,i;return c=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTJDJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ0xJUFRleHRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJwYXRoJTJGdG8lMkZtb2RlbCUyRmNoZWNrcG9pbnQtMTAwJTJGdW5ldCUyMiklMEElMEElMjMlMjBpZiUyMHlvdSUyMGhhdmUlMjB0cmFpbmVkJTIwd2l0aCUyMCU2MC0tYXJncy50cmFpbl90ZXh0X2VuY29kZXIlNjAlMjBtYWtlJTIwc3VyZSUyMHRvJTIwYWxzbyUyMGxvYWQlMjB0aGUlMjB0ZXh0JTIwZW5jb2RlciUwQXRleHRfZW5jb2RlciUyMCUzRCUyMENMSVBUZXh0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdGglMkZ0byUyRm1vZGVsJTJGY2hlY2twb2ludC0xMDAlMkZjaGVja3BvaW50LTEwMCUyRnRleHRfZW5jb2RlciUyMiklMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHVuZXQlM0R1bmV0JTJDJTIwdGV4dF9lbmNvZGVyJTNEdGV4dF9lbmNvZGVyJTJDJTIwZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUoJTIyQSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjBpbiUyMGElMjBidWNrZXQlMjIlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDcuNSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyZG9nLWJ1Y2tldC5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, UNet2DConditionModel
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPTextModel
<span class="hljs-keyword">import</span> torch

unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">&quot;path/to/model/checkpoint-100/unet&quot;</span>)

<span class="hljs-comment"># if you have trained with \`--args.train_text_encoder\` make sure to also load the text encoder</span>
text_encoder = CLIPTextModel.from_pretrained(<span class="hljs-string">&quot;path/to/model/checkpoint-100/checkpoint-100/text_encoder&quot;</span>)

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, unet=unet, text_encoder=text_encoder, dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipeline(<span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span>, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){l=f("p"),l.textContent=m,s=o(),h(c.$$.fragment)},l(p){l=u(p,"P",{"data-svelte-h":!0}),$(l)!=="svelte-fduxd"&&(l.textContent=m),s=r(p),M(c.$$.fragment,p)},m(p,d){n(p,l,d),n(p,s,d),y(c,p,d),i=!0},p:W,i(p){i||(b(c.$$.fragment,p),i=!0)},o(p){w(c.$$.fragment,p),i=!1},d(p){p&&(a(l),a(s)),g(c,p)}}}function ha(U){let l,m;return l=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJwYXRoX3RvX3NhdmVkX21vZGVsJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKCUyMkElMjBwaG90byUyMG9mJTIwc2tzJTIwZG9nJTIwaW4lMjBhJTIwYnVja2V0JTIyJTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q3LjUpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmRvZy1idWNrZXQucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;path_to_saved_model&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = pipeline(<span class="hljs-string">&quot;A photo of sks dog in a bucket&quot;</span>, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){h(l.$$.fragment)},l(s){M(l.$$.fragment,s)},m(s,c){y(l,s,c),m=!0},p:W,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){w(l.$$.fragment,s),m=!1},d(s){g(l,s)}}}function Ma(U){let l,m;return l=new Z({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsYXgudHJhaW5pbmcuY29tbW9uX3V0aWxzJTIwaW1wb3J0JTIwc2hhcmQlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmxheFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMkMlMjBwYXJhbXMlMjAlM0QlMjBGbGF4U3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMnBhdGgtdG8teW91ci10cmFpbmVkLW1vZGVsJTIyJTJDJTIwZHR5cGUlM0RqYXgubnVtcHkuYmZsb2F0MTYpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMHBob3RvJTIwb2YlMjBza3MlMjBkb2clMjBpbiUyMGElMjBidWNrZXQlMjIlMEFwcm5nX3NlZWQlMjAlM0QlMjBqYXgucmFuZG9tLlBSTkdLZXkoMCklMEFudW1faW5mZXJlbmNlX3N0ZXBzJTIwJTNEJTIwNTAlMEElMEFudW1fc2FtcGxlcyUyMCUzRCUyMGpheC5kZXZpY2VfY291bnQoKSUwQXByb21wdCUyMCUzRCUyMG51bV9zYW1wbGVzJTIwKiUyMCU1QnByb21wdCU1RCUwQXByb21wdF9pZHMlMjAlM0QlMjBwaXBlbGluZS5wcmVwYXJlX2lucHV0cyhwcm9tcHQpJTBBJTBBJTIzJTIwc2hhcmQlMjBpbnB1dHMlMjBhbmQlMjBybmclMEFwYXJhbXMlMjAlM0QlMjByZXBsaWNhdGUocGFyYW1zKSUwQXBybmdfc2VlZCUyMCUzRCUyMGpheC5yYW5kb20uc3BsaXQocHJuZ19zZWVkJTJDJTIwamF4LmRldmljZV9jb3VudCgpKSUwQXByb21wdF9pZHMlMjAlM0QlMjBzaGFyZChwcm9tcHRfaWRzKSUwQSUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lKHByb21wdF9pZHMlMkMlMjBwYXJhbXMlMkMlMjBwcm5nX3NlZWQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTJDJTIwaml0JTNEVHJ1ZSkuaW1hZ2VzJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUubnVtcHlfdG9fcGlsKG5wLmFzYXJyYXkoaW1hZ2VzLnJlc2hhcGUoKG51bV9zYW1wbGVzJTJDKSUyMCUyQiUyMGltYWdlcy5zaGFwZSU1Qi0zJTNBJTVEKSkpJTBBaW1hZ2Uuc2F2ZSglMjJkb2ctYnVja2V0LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> jax
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> flax.jax_utils <span class="hljs-keyword">import</span> replicate
<span class="hljs-keyword">from</span> flax.training.common_utils <span class="hljs-keyword">import</span> shard
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxStableDiffusionPipeline

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

prompt = <span class="hljs-string">&quot;A photo of sks dog in a bucket&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;dog-bucket.png&quot;</span>)`,wrap:!1}}),{c(){h(l.$$.fragment)},l(s){M(l.$$.fragment,s)},m(s,c){y(l,s,c),m=!0},p:W,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){w(l.$$.fragment,s),m=!1},d(s){g(l,s)}}}function ya(U){let l,m,s,c;return l=new N({props:{id:"training-inference",option:"PyTorch",$$slots:{default:[ha]},$$scope:{ctx:U}}}),s=new N({props:{id:"training-inference",option:"Flax",$$slots:{default:[Ma]},$$scope:{ctx:U}}}),{c(){h(l.$$.fragment),m=o(),h(s.$$.fragment)},l(i){M(l.$$.fragment,i),m=r(i),M(s.$$.fragment,i)},m(i,p){y(l,i,p),n(i,m,p),y(s,i,p),c=!0},p(i,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:i}),l.$set(d);const _={};p&2&&(_.$$scope={dirty:p,ctx:i}),s.$set(_)},i(i){c||(b(l.$$.fragment,i),b(s.$$.fragment,i),c=!0)},o(i){w(l.$$.fragment,i),w(s.$$.fragment,i),c=!1},d(i){i&&a(m),g(l,i),g(s,i)}}}function ba(U){let l,m,s,c,i,p,d,_='<a href="https://huggingface.co/papers/2208.12242" rel="nofollow">DreamBooth</a> is a training technique that updates the entire diffusion model by training on just a few images of a subject or style. It works by associating a special word in the prompt with the example images.',j,C,T='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. You should have a GPU with &gt;30GB of memory if you want to train faster with Flax.',v,x,Q='This guide will explore the <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py" rel="nofollow">train_dreambooth.py</a> script to help you become more familiar with it, and how you can adapt it for your own use-case.',X,B,D="Before running the script, make sure you install the library from source:",R,k,V,J,G="Navigate to the example folder with the training script and install the required dependencies for the script you’re using:",qe,Y,Pe,F,Ke,q,ol="Initialize an 🤗 Accelerate environment:",Oe,P,et,K,rl="To setup a default 🤗 Accelerate environment without choosing any configurations:",tt,O,lt,ee,pl="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",at,te,st,le,ml='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.',nt,E,it,ae,ot,z,rt,se,cl='The training script offers many parameters for customizing your training run. All of the parameters and their descriptions are found in the <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L228" rel="nofollow"><code>parse_args()</code></a> function. The parameters are set with default values that should work pretty well out-of-the-box, but you can also set your own values in the training command if you’d like.',pt,ne,dl="For example, to train in the bf16 format:",mt,ie,ct,oe,fl="Some basic and important parameters to know and specify are:",dt,re,ul="<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>--instance_data_dir</code>: path to a folder containing the training dataset (example images)</li> <li><code>--instance_prompt</code>: the text prompt that contains the special word for the example images</li> <li><code>--train_text_encoder</code>: whether to also train the text encoder</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>",ft,pe,ut,me,hl='The <a href="https://huggingface.co/papers/2303.09556" rel="nofollow">Min-SNR</a> weighting strategy can help with training by rebalancing the loss to achieve faster convergence. The training script supports predicting <code>epsilon</code> (noise) or <code>v_prediction</code>, but Min-SNR is compatible with both prediction types. This weighting strategy is only supported by PyTorch and is unavailable in the Flax training script.',ht,ce,Ml="Add the <code>--snr_gamma</code> parameter and set it to the recommended value of 5.0:",Mt,de,yt,fe,bt,ue,yl="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.",wt,he,bl="<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>--class_data_dir</code>: path to a folder containing the generated class sample images</li> <li><code>--class_prompt</code>: the text prompt describing the class of the generated sample images</li>",gt,Me,$t,ye,Jt,be,wl="To improve the quality of the generated outputs, you can also train the text encoder in addition to the UNet. This requires additional memory and you’ll need a GPU with at least 24GB of vRAM. If you have the necessary hardware, then training the text encoder produces better results, especially when generating images of faces. Enable this option by:",Ut,we,Tt,ge,_t,$e,gl="DreamBooth comes with its own dataset classes:",Zt,Je,$l='<li><a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L604" rel="nofollow"><code>DreamBoothDataset</code></a>: preprocesses the images and class images, and tokenizes the prompts for training</li> <li><a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L738" rel="nofollow"><code>PromptDataset</code></a>: generates the prompt embeddings to generate the class images</li>',jt,Ue,Jl='If you enabled <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L842" rel="nofollow">prior preservation loss</a>, the class images are generated here:',vt,Te,Ct,_e,Ul='Next is the <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L799" rel="nofollow"><code>main()</code></a> function which handles setting up the dataset for training and the training loop itself. The script loads the <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L898" rel="nofollow">tokenizer</a>, <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L912C1-L912C1" rel="nofollow">scheduler and models</a>:',Gt,Ze,Wt,je,Tl='Then, it’s time to <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L1073" rel="nofollow">create the training dataset</a> and DataLoader from <code>DreamBoothDataset</code>:',Xt,ve,Rt,Ce,_l='Lastly, the <a href="https://github.com/huggingface/diffusers/blob/072e00897a7cf4302c347a63ec917b4b8add16d4/examples/dreambooth/train_dreambooth.py#L1151" rel="nofollow">training loop</a> takes care of the remaining steps such as converting images to latent space, adding noise to the input, predicting the noise residual, and calculating the loss.',xt,Ge,Zl='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.',Bt,We,kt,Xe,jl="You’re now ready to launch the training script! 🚀",It,Re,vl='For this guide, you’ll download some images of a <a href="https://huggingface.co/datasets/diffusers/dog-example" rel="nofollow">dog</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).',Vt,xe,Nt,Be,Cl="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 dog images to, and <code>OUTPUT_DIR</code> to where you want to save the model. You’ll use <code>sks</code> as the special word to tie the training to.",Yt,ke,Gl="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:",Ft,Ie,Et,Ve,Wl="One more thing before you launch the script! Depending on the GPU you have, you may need to enable certain optimizations to train DreamBooth.",zt,H,Ht,L,Lt,Ne,Xl="Once training is complete, you can use your newly trained model for inference!",At,A,St,S,Qt,Ye,Dt,Fe,Rl='LoRA is a training technique for significantly reducing the number of trainable parameters. As a result, training is faster and it is easier to store the resulting weights because they are a lot smaller (~100MBs). Use the <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora.py" rel="nofollow">train_dreambooth_lora.py</a> script to train with LoRA.',qt,Ee,xl='The LoRA training script is discussed in more detail in the <a href="lora">LoRA training</a> guide.',Pt,ze,Kt,He,Bl='Stable Diffusion XL (SDXL) is a powerful text-to-image model that generates high-resolution images, and it adds a second text-encoder to its architecture. Use the <a href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora_sdxl.py" rel="nofollow">train_dreambooth_lora_sdxl.py</a> script to train a SDXL model with LoRA.',Ot,Le,kl='The SDXL training script is discussed in more detail in the <a href="sdxl">SDXL training</a> guide.',el,Ae,tl,Se,Il="Congratulations on training your DreamBooth model! To learn more about how to use your new model, the following guide may be helpful:",ll,Qe,Vl='<li>Learn how to <a href="../using-diffusers/loading_adapters">load a DreamBooth</a> model for inference if you trained your model with LoRA.</li>',al,De,sl;return i=new I({props:{title:"DreamBooth",local:"dreambooth",headingTag:"h1"}}),k=new Z({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install .`,wrap:!1}}),Y=new il({props:{id:"installation",options:["PyTorch","Flax"],$$slots:{default:[aa]},$$scope:{ctx:U}}}),F=new nl({props:{$$slots:{default:[sa]},$$scope:{ctx:U}}}),P=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),O=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),te=new Z({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}}),E=new nl({props:{$$slots:{default:[na]},$$scope:{ctx:U}}}),ae=new I({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),z=new nl({props:{warning:!0,$$slots:{default:[ia]},$$scope:{ctx:U}}}),ie=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmJmMTYlMjI=",highlighted:`accelerate launch train_dreambooth.py \\
    --mixed_precision=<span class="hljs-string">&quot;bf16&quot;</span>`,wrap:!1}}),pe=new I({props:{title:"Min-SNR weighting",local:"min-snr-weighting",headingTag:"h3"}}),de=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_dreambooth.py \\
  --snr_gamma=5.0`,wrap:!1}}),fe=new I({props:{title:"Prior preservation loss",local:"prior-preservation-loss",headingTag:"h3"}}),Me=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXdpdGhfcHJpb3JfcHJlc2VydmF0aW9uJTIwJTVDJTBBJTIwJTIwLS1wcmlvcl9sb3NzX3dlaWdodCUzRDEuMCUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfZGF0YV9kaXIlM0QlMjJwYXRoJTJGdG8lMkZjbGFzcyUyRmltYWdlcyUyMiUyMCU1QyUwQSUyMCUyMC0tY2xhc3NfcHJvbXB0JTNEJTIydGV4dCUyMHByb21wdCUyMGRlc2NyaWJpbmclMjBjbGFzcyUyMg==",highlighted:`accelerate launch train_dreambooth.py \\
  --with_prior_preservation \\
  --prior_loss_weight=1.0 \\
  --class_data_dir=<span class="hljs-string">&quot;path/to/class/images&quot;</span> \\
  --class_prompt=<span class="hljs-string">&quot;text prompt describing class&quot;</span>`,wrap:!1}}),ye=new I({props:{title:"Train text encoder",local:"train-text-encoder",headingTag:"h3"}}),we=new Z({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2RyZWFtYm9vdGgucHklMjAlNUMlMEElMjAlMjAtLXRyYWluX3RleHRfZW5jb2Rlcg==",highlighted:`accelerate launch train_dreambooth.py \\
  --train_text_encoder`,wrap:!1}}),ge=new I({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),Te=new Z({props:{code:"c2FtcGxlX2RhdGFzZXQlMjAlM0QlMjBQcm9tcHREYXRhc2V0KGFyZ3MuY2xhc3NfcHJvbXB0JTJDJTIwbnVtX25ld19pbWFnZXMpJTBBc2FtcGxlX2RhdGFsb2FkZXIlMjAlM0QlMjB0b3JjaC51dGlscy5kYXRhLkRhdGFMb2FkZXIoc2FtcGxlX2RhdGFzZXQlMkMlMjBiYXRjaF9zaXplJTNEYXJncy5zYW1wbGVfYmF0Y2hfc2l6ZSklMEElMEFzYW1wbGVfZGF0YWxvYWRlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoc2FtcGxlX2RhdGFsb2FkZXIpJTBBcGlwZWxpbmUudG8oYWNjZWxlcmF0b3IuZGV2aWNlKSUwQSUwQWZvciUyMGV4YW1wbGUlMjBpbiUyMHRxZG0oJTBBJTIwJTIwJTIwJTIwc2FtcGxlX2RhdGFsb2FkZXIlMkMlMjBkZXNjJTNEJTIyR2VuZXJhdGluZyUyMGNsYXNzJTIwaW1hZ2VzJTIyJTJDJTIwZGlzYWJsZSUzRG5vdCUyMGFjY2VsZXJhdG9yLmlzX2xvY2FsX21haW5fcHJvY2VzcyUwQSklM0ElMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjBwaXBlbGluZShleGFtcGxlJTVCJTIycHJvbXB0JTIyJTVEKS5pbWFnZXM=",highlighted:`sample_dataset = PromptDataset(args.class_prompt, num_new_images)
sample_dataloader = torch.utils.data.DataLoader(sample_dataset, batch_size=args.sample_batch_size)

sample_dataloader = accelerator.prepare(sample_dataloader)
pipeline.to(accelerator.device)

<span class="hljs-keyword">for</span> example <span class="hljs-keyword">in</span> tqdm(
    sample_dataloader, desc=<span class="hljs-string">&quot;Generating class images&quot;</span>, disable=<span class="hljs-keyword">not</span> accelerator.is_local_main_process
):
    images = pipeline(example[<span class="hljs-string">&quot;prompt&quot;</span>]).images`,wrap:!1}}),Ze=new Z({props:{code:"JTIzJTIwTG9hZCUyMHRoZSUyMHRva2VuaXplciUwQWlmJTIwYXJncy50b2tlbml6ZXJfbmFtZSUzQSUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKGFyZ3MudG9rZW5pemVyX25hbWUlMkMlMjByZXZpc2lvbiUzRGFyZ3MucmV2aXNpb24lMkMlMjB1c2VfZmFzdCUzREZhbHNlKSUwQWVsaWYlMjBhcmdzLnByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNBJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXJncy5wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHN1YmZvbGRlciUzRCUyMnRva2VuaXplciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldmlzaW9uJTNEYXJncy5yZXZpc2lvbiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHVzZV9mYXN0JTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjApJTBBJTBBJTIzJTIwTG9hZCUyMHNjaGVkdWxlciUyMGFuZCUyMG1vZGVscyUwQW5vaXNlX3NjaGVkdWxlciUyMCUzRCUyMEREUE1TY2hlZHVsZXIuZnJvbV9wcmV0cmFpbmVkKGFyZ3MucHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglMkMlMjBzdWJmb2xkZXIlM0QlMjJzY2hlZHVsZXIlMjIpJTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwdGV4dF9lbmNvZGVyX2Nscy5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwYXJncy5wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUyQyUyMHN1YmZvbGRlciUzRCUyMnRleHRfZW5jb2RlciUyMiUyQyUyMHJldmlzaW9uJTNEYXJncy5yZXZpc2lvbiUwQSklMEElMEFpZiUyMG1vZGVsX2hhc192YWUoYXJncyklM0ElMEElMjAlMjAlMjAlMjB2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhcmdzLnByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlJTIyJTJDJTIwcmV2aXNpb24lM0RhcmdzLnJldmlzaW9uJTBBJTIwJTIwJTIwJTIwKSUwQWVsc2UlM0ElMEElMjAlMjAlMjAlMjB2YWUlMjAlM0QlMjBOb25lJTBBJTBBdW5ldCUyMCUzRCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBhcmdzLnByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIydW5ldCUyMiUyQyUyMHJldmlzaW9uJTNEYXJncy5yZXZpc2lvbiUwQSk=",highlighted:`<span class="hljs-comment"># Load the tokenizer</span>
<span class="hljs-keyword">if</span> args.tokenizer_name:
    tokenizer = AutoTokenizer.from_pretrained(args.tokenizer_name, revision=args.revision, use_fast=<span class="hljs-literal">False</span>)
<span class="hljs-keyword">elif</span> args.pretrained_model_name_or_path:
    tokenizer = AutoTokenizer.from_pretrained(
        args.pretrained_model_name_or_path,
        subfolder=<span class="hljs-string">&quot;tokenizer&quot;</span>,
        revision=args.revision,
        use_fast=<span class="hljs-literal">False</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 = text_encoder_cls.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, revision=args.revision
)

<span class="hljs-keyword">if</span> model_has_vae(args):
    vae = AutoencoderKL.from_pretrained(
        args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, revision=args.revision
    )
<span class="hljs-keyword">else</span>:
    vae = <span class="hljs-literal">None</span>

unet = UNet2DConditionModel.from_pretrained(
    args.pretrained_model_name_or_path, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, revision=args.revision
)`,wrap:!1}}),ve=new Z({props:{code:"dHJhaW5fZGF0YXNldCUyMCUzRCUyMERyZWFtQm9vdGhEYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGluc3RhbmNlX2RhdGFfcm9vdCUzRGFyZ3MuaW5zdGFuY2VfZGF0YV9kaXIlMkMlMEElMjAlMjAlMjAlMjBpbnN0YW5jZV9wcm9tcHQlM0RhcmdzLmluc3RhbmNlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGNsYXNzX2RhdGFfcm9vdCUzRGFyZ3MuY2xhc3NfZGF0YV9kaXIlMjBpZiUyMGFyZ3Mud2l0aF9wcmlvcl9wcmVzZXJ2YXRpb24lMjBlbHNlJTIwTm9uZSUyQyUwQSUyMCUyMCUyMCUyMGNsYXNzX3Byb21wdCUzRGFyZ3MuY2xhc3NfcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwY2xhc3NfbnVtJTNEYXJncy5udW1fY2xhc3NfaW1hZ2VzJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwc2l6ZSUzRGFyZ3MucmVzb2x1dGlvbiUyQyUwQSUyMCUyMCUyMCUyMGNlbnRlcl9jcm9wJTNEYXJncy5jZW50ZXJfY3JvcCUyQyUwQSUyMCUyMCUyMCUyMGVuY29kZXJfaGlkZGVuX3N0YXRlcyUzRHByZV9jb21wdXRlZF9lbmNvZGVyX2hpZGRlbl9zdGF0ZXMlMkMlMEElMjAlMjAlMjAlMjBjbGFzc19wcm9tcHRfZW5jb2Rlcl9oaWRkZW5fc3RhdGVzJTNEcHJlX2NvbXB1dGVkX2NsYXNzX3Byb21wdF9lbmNvZGVyX2hpZGRlbl9zdGF0ZXMlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXJfbWF4X2xlbmd0aCUzRGFyZ3MudG9rZW5pemVyX21heF9sZW5ndGglMkMlMEEpJTBBJTBBdHJhaW5fZGF0YWxvYWRlciUyMCUzRCUyMHRvcmNoLnV0aWxzLmRhdGEuRGF0YUxvYWRlciglMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRGFyZ3MudHJhaW5fYmF0Y2hfc2l6ZSUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGxhbWJkYSUyMGV4YW1wbGVzJTNBJTIwY29sbGF0ZV9mbihleGFtcGxlcyUyQyUyMGFyZ3Mud2l0aF9wcmlvcl9wcmVzZXJ2YXRpb24pJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3dvcmtlcnMlM0RhcmdzLmRhdGFsb2FkZXJfbnVtX3dvcmtlcnMlMkMlMEEp",highlighted:`train_dataset = DreamBoothDataset(
    instance_data_root=args.instance_data_dir,
    instance_prompt=args.instance_prompt,
    class_data_root=args.class_data_dir <span class="hljs-keyword">if</span> args.with_prior_preservation <span class="hljs-keyword">else</span> <span class="hljs-literal">None</span>,
    class_prompt=args.class_prompt,
    class_num=args.num_class_images,
    tokenizer=tokenizer,
    size=args.resolution,
    center_crop=args.center_crop,
    encoder_hidden_states=pre_computed_encoder_hidden_states,
    class_prompt_encoder_hidden_states=pre_computed_class_prompt_encoder_hidden_states,
    tokenizer_max_length=args.tokenizer_max_length,
)

train_dataloader = torch.utils.data.DataLoader(
    train_dataset,
    batch_size=args.train_batch_size,
    shuffle=<span class="hljs-literal">True</span>,
    collate_fn=<span class="hljs-keyword">lambda</span> examples: collate_fn(examples, args.with_prior_preservation),
    num_workers=args.dataloader_num_workers,
)`,wrap:!1}}),We=new I({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),xe=new Z({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHNuYXBzaG90X2Rvd25sb2FkJTBBJTBBbG9jYWxfZGlyJTIwJTNEJTIwJTIyLiUyRmRvZyUyMiUwQXNuYXBzaG90X2Rvd25sb2FkKCUwQSUyMCUyMCUyMCUyMCUyMmRpZmZ1c2VycyUyRmRvZy1leGFtcGxlJTIyJTJDJTBBJTIwJTIwJTIwJTIwbG9jYWxfZGlyJTNEbG9jYWxfZGlyJTJDJTBBJTIwJTIwJTIwJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMiUyQyUwQSUyMCUyMCUyMCUyMGlnbm9yZV9wYXR0ZXJucyUzRCUyMi5naXRhdHRyaWJ1dGVzJTIyJTJDJTBBKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> snapshot_download

local_dir = <span class="hljs-string">&quot;./dog&quot;</span>
snapshot_download(
    <span class="hljs-string">&quot;diffusers/dog-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}}),Ie=new Z({props:{code:"LS12YWxpZGF0aW9uX3Byb21wdCUzRCUyMmElMjBwaG90byUyMG9mJTIwYSUyMHNrcyUyMGRvZyUyMiUwQS0tbnVtX3ZhbGlkYXRpb25faW1hZ2VzJTNENCUwQS0tdmFsaWRhdGlvbl9zdGVwcyUzRDEwMA==",highlighted:`--validation_prompt=<span class="hljs-string">&quot;a photo of a sks dog&quot;</span>
--num_validation_images=4
--validation_steps=100`,wrap:!1}}),H=new il({props:{id:"gpu-select",options:["16GB","12GB","8GB"],$$slots:{default:[ma]},$$scope:{ctx:U}}}),L=new il({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[fa]},$$scope:{ctx:U}}}),A=new nl({props:{$$slots:{default:[ua]},$$scope:{ctx:U}}}),S=new il({props:{id:"training-inference",options:["PyTorch","Flax"],$$slots:{default:[ya]},$$scope:{ctx:U}}}),Ye=new I({props:{title:"LoRA",local:"lora",headingTag:"h2"}}),ze=new I({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),Ae=new I({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),{c(){l=f("meta"),m=o(),s=f("p"),c=o(),h(i.$$.fragment),p=o(),d=f("p"),d.innerHTML=_,j=o(),C=f("p"),C.innerHTML=T,v=o(),x=f("p"),x.innerHTML=Q,X=o(),B=f("p"),B.textContent=D,R=o(),h(k.$$.fragment),V=o(),J=f("p"),J.textContent=G,qe=o(),h(Y.$$.fragment),Pe=o(),h(F.$$.fragment),Ke=o(),q=f("p"),q.textContent=ol,Oe=o(),h(P.$$.fragment),et=o(),K=f("p"),K.textContent=rl,tt=o(),h(O.$$.fragment),lt=o(),ee=f("p"),ee.textContent=pl,at=o(),h(te.$$.fragment),st=o(),le=f("p"),le.innerHTML=ml,nt=o(),h(E.$$.fragment),it=o(),h(ae.$$.fragment),ot=o(),h(z.$$.fragment),rt=o(),se=f("p"),se.innerHTML=cl,pt=o(),ne=f("p"),ne.textContent=dl,mt=o(),h(ie.$$.fragment),ct=o(),oe=f("p"),oe.textContent=fl,dt=o(),re=f("ul"),re.innerHTML=ul,ft=o(),h(pe.$$.fragment),ut=o(),me=f("p"),me.innerHTML=hl,ht=o(),ce=f("p"),ce.innerHTML=Ml,Mt=o(),h(de.$$.fragment),yt=o(),h(fe.$$.fragment),bt=o(),ue=f("p"),ue.textContent=yl,wt=o(),he=f("ul"),he.innerHTML=bl,gt=o(),h(Me.$$.fragment),$t=o(),h(ye.$$.fragment),Jt=o(),be=f("p"),be.textContent=wl,Ut=o(),h(we.$$.fragment),Tt=o(),h(ge.$$.fragment),_t=o(),$e=f("p"),$e.textContent=gl,Zt=o(),Je=f("ul"),Je.innerHTML=$l,jt=o(),Ue=f("p"),Ue.innerHTML=Jl,vt=o(),h(Te.$$.fragment),Ct=o(),_e=f("p"),_e.innerHTML=Ul,Gt=o(),h(Ze.$$.fragment),Wt=o(),je=f("p"),je.innerHTML=Tl,Xt=o(),h(ve.$$.fragment),Rt=o(),Ce=f("p"),Ce.innerHTML=_l,xt=o(),Ge=f("p"),Ge.innerHTML=Zl,Bt=o(),h(We.$$.fragment),kt=o(),Xe=f("p"),Xe.textContent=jl,It=o(),Re=f("p"),Re.innerHTML=vl,Vt=o(),h(xe.$$.fragment),Nt=o(),Be=f("p"),Be.innerHTML=Cl,Yt=o(),ke=f("p"),ke.textContent=Gl,Ft=o(),h(Ie.$$.fragment),Et=o(),Ve=f("p"),Ve.textContent=Wl,zt=o(),h(H.$$.fragment),Ht=o(),h(L.$$.fragment),Lt=o(),Ne=f("p"),Ne.textContent=Xl,At=o(),h(A.$$.fragment),St=o(),h(S.$$.fragment),Qt=o(),h(Ye.$$.fragment),Dt=o(),Fe=f("p"),Fe.innerHTML=Rl,qt=o(),Ee=f("p"),Ee.innerHTML=xl,Pt=o(),h(ze.$$.fragment),Kt=o(),He=f("p"),He.innerHTML=Bl,Ot=o(),Le=f("p"),Le.innerHTML=kl,el=o(),h(Ae.$$.fragment),tl=o(),Se=f("p"),Se.textContent=Il,ll=o(),Qe=f("ul"),Qe.innerHTML=Vl,al=o(),De=f("p"),this.h()},l(e){const t=Ol("svelte-u9bgzb",document.head);l=u(t,"META",{name:!0,content:!0}),t.forEach(a),m=r(e),s=u(e,"P",{}),Sl(s).forEach(a),c=r(e),M(i.$$.fragment,e),p=r(e),d=u(e,"P",{"data-svelte-h":!0}),$(d)!=="svelte-yz6jri"&&(d.innerHTML=_),j=r(e),C=u(e,"P",{"data-svelte-h":!0}),$(C)!=="svelte-en2tmp"&&(C.innerHTML=T),v=r(e),x=u(e,"P",{"data-svelte-h":!0}),$(x)!=="svelte-1ol1kd9"&&(x.innerHTML=Q),X=r(e),B=u(e,"P",{"data-svelte-h":!0}),$(B)!=="svelte-l7dm2q"&&(B.textContent=D),R=r(e),M(k.$$.fragment,e),V=r(e),J=u(e,"P",{"data-svelte-h":!0}),$(J)!=="svelte-1nancx8"&&(J.textContent=G),qe=r(e),M(Y.$$.fragment,e),Pe=r(e),M(F.$$.fragment,e),Ke=r(e),q=u(e,"P",{"data-svelte-h":!0}),$(q)!=="svelte-60q53m"&&(q.textContent=ol),Oe=r(e),M(P.$$.fragment,e),et=r(e),K=u(e,"P",{"data-svelte-h":!0}),$(K)!=="svelte-di6juu"&&(K.textContent=rl),tt=r(e),M(O.$$.fragment,e),lt=r(e),ee=u(e,"P",{"data-svelte-h":!0}),$(ee)!=="svelte-tsz4qp"&&(ee.textContent=pl),at=r(e),M(te.$$.fragment,e),st=r(e),le=u(e,"P",{"data-svelte-h":!0}),$(le)!=="svelte-1fkfdql"&&(le.innerHTML=ml),nt=r(e),M(E.$$.fragment,e),it=r(e),M(ae.$$.fragment,e),ot=r(e),M(z.$$.fragment,e),rt=r(e),se=u(e,"P",{"data-svelte-h":!0}),$(se)!=="svelte-gb0mrm"&&(se.innerHTML=cl),pt=r(e),ne=u(e,"P",{"data-svelte-h":!0}),$(ne)!=="svelte-1aa3zni"&&(ne.textContent=dl),mt=r(e),M(ie.$$.fragment,e),ct=r(e),oe=u(e,"P",{"data-svelte-h":!0}),$(oe)!=="svelte-1ug35mp"&&(oe.textContent=fl),dt=r(e),re=u(e,"UL",{"data-svelte-h":!0}),$(re)!=="svelte-pohxvr"&&(re.innerHTML=ul),ft=r(e),M(pe.$$.fragment,e),ut=r(e),me=u(e,"P",{"data-svelte-h":!0}),$(me)!=="svelte-isitbv"&&(me.innerHTML=hl),ht=r(e),ce=u(e,"P",{"data-svelte-h":!0}),$(ce)!=="svelte-tp3kp"&&(ce.innerHTML=Ml),Mt=r(e),M(de.$$.fragment,e),yt=r(e),M(fe.$$.fragment,e),bt=r(e),ue=u(e,"P",{"data-svelte-h":!0}),$(ue)!=="svelte-1oc83h6"&&(ue.textContent=yl),wt=r(e),he=u(e,"UL",{"data-svelte-h":!0}),$(he)!=="svelte-1e6kqrs"&&(he.innerHTML=bl),gt=r(e),M(Me.$$.fragment,e),$t=r(e),M(ye.$$.fragment,e),Jt=r(e),be=u(e,"P",{"data-svelte-h":!0}),$(be)!=="svelte-n5xd96"&&(be.textContent=wl),Ut=r(e),M(we.$$.fragment,e),Tt=r(e),M(ge.$$.fragment,e),_t=r(e),$e=u(e,"P",{"data-svelte-h":!0}),$($e)!=="svelte-76mqwg"&&($e.textContent=gl),Zt=r(e),Je=u(e,"UL",{"data-svelte-h":!0}),$(Je)!=="svelte-1sge1kf"&&(Je.innerHTML=$l),jt=r(e),Ue=u(e,"P",{"data-svelte-h":!0}),$(Ue)!=="svelte-c9697n"&&(Ue.innerHTML=Jl),vt=r(e),M(Te.$$.fragment,e),Ct=r(e),_e=u(e,"P",{"data-svelte-h":!0}),$(_e)!=="svelte-e2s2vm"&&(_e.innerHTML=Ul),Gt=r(e),M(Ze.$$.fragment,e),Wt=r(e),je=u(e,"P",{"data-svelte-h":!0}),$(je)!=="svelte-s7uwdj"&&(je.innerHTML=Tl),Xt=r(e),M(ve.$$.fragment,e),Rt=r(e),Ce=u(e,"P",{"data-svelte-h":!0}),$(Ce)!=="svelte-4ixpqk"&&(Ce.innerHTML=_l),xt=r(e),Ge=u(e,"P",{"data-svelte-h":!0}),$(Ge)!=="svelte-6gmbd2"&&(Ge.innerHTML=Zl),Bt=r(e),M(We.$$.fragment,e),kt=r(e),Xe=u(e,"P",{"data-svelte-h":!0}),$(Xe)!=="svelte-1fq45yi"&&(Xe.textContent=jl),It=r(e),Re=u(e,"P",{"data-svelte-h":!0}),$(Re)!=="svelte-191fegd"&&(Re.innerHTML=vl),Vt=r(e),M(xe.$$.fragment,e),Nt=r(e),Be=u(e,"P",{"data-svelte-h":!0}),$(Be)!=="svelte-bekdku"&&(Be.innerHTML=Cl),Yt=r(e),ke=u(e,"P",{"data-svelte-h":!0}),$(ke)!=="svelte-196wtq5"&&(ke.textContent=Gl),Ft=r(e),M(Ie.$$.fragment,e),Et=r(e),Ve=u(e,"P",{"data-svelte-h":!0}),$(Ve)!=="svelte-7wz93i"&&(Ve.textContent=Wl),zt=r(e),M(H.$$.fragment,e),Ht=r(e),M(L.$$.fragment,e),Lt=r(e),Ne=u(e,"P",{"data-svelte-h":!0}),$(Ne)!=="svelte-1x6in5t"&&(Ne.textContent=Xl),At=r(e),M(A.$$.fragment,e),St=r(e),M(S.$$.fragment,e),Qt=r(e),M(Ye.$$.fragment,e),Dt=r(e),Fe=u(e,"P",{"data-svelte-h":!0}),$(Fe)!=="svelte-1bstso5"&&(Fe.innerHTML=Rl),qt=r(e),Ee=u(e,"P",{"data-svelte-h":!0}),$(Ee)!=="svelte-1sxi0tl"&&(Ee.innerHTML=xl),Pt=r(e),M(ze.$$.fragment,e),Kt=r(e),He=u(e,"P",{"data-svelte-h":!0}),$(He)!=="svelte-1stipnz"&&(He.innerHTML=Bl),Ot=r(e),Le=u(e,"P",{"data-svelte-h":!0}),$(Le)!=="svelte-6dxtva"&&(Le.innerHTML=kl),el=r(e),M(Ae.$$.fragment,e),tl=r(e),Se=u(e,"P",{"data-svelte-h":!0}),$(Se)!=="svelte-1lopwzr"&&(Se.textContent=Il),ll=r(e),Qe=u(e,"UL",{"data-svelte-h":!0}),$(Qe)!=="svelte-nczfxk"&&(Qe.innerHTML=Vl),al=r(e),De=u(e,"P",{}),Sl(De).forEach(a),this.h()},h(){Ql(l,"name","hf:doc:metadata"),Ql(l,"content",wa)},m(e,t){ea(document.head,l),n(e,m,t),n(e,s,t),n(e,c,t),y(i,e,t),n(e,p,t),n(e,d,t),n(e,j,t),n(e,C,t),n(e,v,t),n(e,x,t),n(e,X,t),n(e,B,t),n(e,R,t),y(k,e,t),n(e,V,t),n(e,J,t),n(e,qe,t),y(Y,e,t),n(e,Pe,t),y(F,e,t),n(e,Ke,t),n(e,q,t),n(e,Oe,t),y(P,e,t),n(e,et,t),n(e,K,t),n(e,tt,t),y(O,e,t),n(e,lt,t),n(e,ee,t),n(e,at,t),y(te,e,t),n(e,st,t),n(e,le,t),n(e,nt,t),y(E,e,t),n(e,it,t),y(ae,e,t),n(e,ot,t),y(z,e,t),n(e,rt,t),n(e,se,t),n(e,pt,t),n(e,ne,t),n(e,mt,t),y(ie,e,t),n(e,ct,t),n(e,oe,t),n(e,dt,t),n(e,re,t),n(e,ft,t),y(pe,e,t),n(e,ut,t),n(e,me,t),n(e,ht,t),n(e,ce,t),n(e,Mt,t),y(de,e,t),n(e,yt,t),y(fe,e,t),n(e,bt,t),n(e,ue,t),n(e,wt,t),n(e,he,t),n(e,gt,t),y(Me,e,t),n(e,$t,t),y(ye,e,t),n(e,Jt,t),n(e,be,t),n(e,Ut,t),y(we,e,t),n(e,Tt,t),y(ge,e,t),n(e,_t,t),n(e,$e,t),n(e,Zt,t),n(e,Je,t),n(e,jt,t),n(e,Ue,t),n(e,vt,t),y(Te,e,t),n(e,Ct,t),n(e,_e,t),n(e,Gt,t),y(Ze,e,t),n(e,Wt,t),n(e,je,t),n(e,Xt,t),y(ve,e,t),n(e,Rt,t),n(e,Ce,t),n(e,xt,t),n(e,Ge,t),n(e,Bt,t),y(We,e,t),n(e,kt,t),n(e,Xe,t),n(e,It,t),n(e,Re,t),n(e,Vt,t),y(xe,e,t),n(e,Nt,t),n(e,Be,t),n(e,Yt,t),n(e,ke,t),n(e,Ft,t),y(Ie,e,t),n(e,Et,t),n(e,Ve,t),n(e,zt,t),y(H,e,t),n(e,Ht,t),y(L,e,t),n(e,Lt,t),n(e,Ne,t),n(e,At,t),y(A,e,t),n(e,St,t),y(S,e,t),n(e,Qt,t),y(Ye,e,t),n(e,Dt,t),n(e,Fe,t),n(e,qt,t),n(e,Ee,t),n(e,Pt,t),y(ze,e,t),n(e,Kt,t),n(e,He,t),n(e,Ot,t),n(e,Le,t),n(e,el,t),y(Ae,e,t),n(e,tl,t),n(e,Se,t),n(e,ll,t),n(e,Qe,t),n(e,al,t),n(e,De,t),sl=!0},p(e,[t]){const Nl={};t&2&&(Nl.$$scope={dirty:t,ctx:e}),Y.$set(Nl);const Yl={};t&2&&(Yl.$$scope={dirty:t,ctx:e}),F.$set(Yl);const Fl={};t&2&&(Fl.$$scope={dirty:t,ctx:e}),E.$set(Fl);const El={};t&2&&(El.$$scope={dirty:t,ctx:e}),z.$set(El);const zl={};t&2&&(zl.$$scope={dirty:t,ctx:e}),H.$set(zl);const Hl={};t&2&&(Hl.$$scope={dirty:t,ctx:e}),L.$set(Hl);const Ll={};t&2&&(Ll.$$scope={dirty:t,ctx:e}),A.$set(Ll);const Al={};t&2&&(Al.$$scope={dirty:t,ctx:e}),S.$set(Al)},i(e){sl||(b(i.$$.fragment,e),b(k.$$.fragment,e),b(Y.$$.fragment,e),b(F.$$.fragment,e),b(P.$$.fragment,e),b(O.$$.fragment,e),b(te.$$.fragment,e),b(E.$$.fragment,e),b(ae.$$.fragment,e),b(z.$$.fragment,e),b(ie.$$.fragment,e),b(pe.$$.fragment,e),b(de.$$.fragment,e),b(fe.$$.fragment,e),b(Me.$$.fragment,e),b(ye.$$.fragment,e),b(we.$$.fragment,e),b(ge.$$.fragment,e),b(Te.$$.fragment,e),b(Ze.$$.fragment,e),b(ve.$$.fragment,e),b(We.$$.fragment,e),b(xe.$$.fragment,e),b(Ie.$$.fragment,e),b(H.$$.fragment,e),b(L.$$.fragment,e),b(A.$$.fragment,e),b(S.$$.fragment,e),b(Ye.$$.fragment,e),b(ze.$$.fragment,e),b(Ae.$$.fragment,e),sl=!0)},o(e){w(i.$$.fragment,e),w(k.$$.fragment,e),w(Y.$$.fragment,e),w(F.$$.fragment,e),w(P.$$.fragment,e),w(O.$$.fragment,e),w(te.$$.fragment,e),w(E.$$.fragment,e),w(ae.$$.fragment,e),w(z.$$.fragment,e),w(ie.$$.fragment,e),w(pe.$$.fragment,e),w(de.$$.fragment,e),w(fe.$$.fragment,e),w(Me.$$.fragment,e),w(ye.$$.fragment,e),w(we.$$.fragment,e),w(ge.$$.fragment,e),w(Te.$$.fragment,e),w(Ze.$$.fragment,e),w(ve.$$.fragment,e),w(We.$$.fragment,e),w(xe.$$.fragment,e),w(Ie.$$.fragment,e),w(H.$$.fragment,e),w(L.$$.fragment,e),w(A.$$.fragment,e),w(S.$$.fragment,e),w(Ye.$$.fragment,e),w(ze.$$.fragment,e),w(Ae.$$.fragment,e),sl=!1},d(e){e&&(a(m),a(s),a(c),a(p),a(d),a(j),a(C),a(v),a(x),a(X),a(B),a(R),a(V),a(J),a(qe),a(Pe),a(Ke),a(q),a(Oe),a(et),a(K),a(tt),a(lt),a(ee),a(at),a(st),a(le),a(nt),a(it),a(ot),a(rt),a(se),a(pt),a(ne),a(mt),a(ct),a(oe),a(dt),a(re),a(ft),a(ut),a(me),a(ht),a(ce),a(Mt),a(yt),a(bt),a(ue),a(wt),a(he),a(gt),a($t),a(Jt),a(be),a(Ut),a(Tt),a(_t),a($e),a(Zt),a(Je),a(jt),a(Ue),a(vt),a(Ct),a(_e),a(Gt),a(Wt),a(je),a(Xt),a(Rt),a(Ce),a(xt),a(Ge),a(Bt),a(kt),a(Xe),a(It),a(Re),a(Vt),a(Nt),a(Be),a(Yt),a(ke),a(Ft),a(Et),a(Ve),a(zt),a(Ht),a(Lt),a(Ne),a(At),a(St),a(Qt),a(Dt),a(Fe),a(qt),a(Ee),a(Pt),a(Kt),a(He),a(Ot),a(Le),a(el),a(tl),a(Se),a(ll),a(Qe),a(al),a(De)),a(l),g(i,e),g(k,e),g(Y,e),g(F,e),g(P,e),g(O,e),g(te,e),g(E,e),g(ae,e),g(z,e),g(ie,e),g(pe,e),g(de,e),g(fe,e),g(Me,e),g(ye,e),g(we,e),g(ge,e),g(Te,e),g(Ze,e),g(ve,e),g(We,e),g(xe,e),g(Ie,e),g(H,e),g(L,e),g(A,e),g(S,e),g(Ye,e),g(ze,e),g(Ae,e)}}}const wa='{"title":"DreamBooth","local":"dreambooth","sections":[{"title":"Script parameters","local":"script-parameters","sections":[{"title":"Min-SNR weighting","local":"min-snr-weighting","sections":[],"depth":3},{"title":"Prior preservation loss","local":"prior-preservation-loss","sections":[],"depth":3},{"title":"Train text encoder","local":"train-text-encoder","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":"LoRA","local":"lora","sections":[],"depth":2},{"title":"Stable Diffusion XL","local":"stable-diffusion-xl","sections":[],"depth":2},{"title":"Next steps","local":"next-steps","sections":[],"depth":2}],"depth":1}';function ga(U){return ql(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ja extends Pl{constructor(l){super(),Kl(this,l,ga,ba,Dl,{})}}export{ja as component};
