import{S as ff,i as uf,s as hf,e as a,k as f,w as h,t as r,M as df,c as i,d as l,m as u,a as n,x as d,h as o,b as p,N as Wt,G as e,g as c,y as m,q as b,o as y,B as g,v as mf}from"../../chunks/vendor-hf-doc-builder.js";import{T as cf}from"../../chunks/Tip-hf-doc-builder.js";import{I as j}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as J}from"../../chunks/CodeBlock-hf-doc-builder.js";function bf(Fe){let _,G,v,U,Z;return{c(){_=a("p"),G=r("To successfully run the latest versions of the example scripts, we highly recommend "),v=a("strong"),U=r("installing from source"),Z=r(" and keeping the installation up to date. We update the example scripts frequently and install example-specific requirements.")},l(w){_=i(w,"P",{});var M=n(_);G=o(M,"To successfully run the latest versions of the example scripts, we highly recommend "),v=i(M,"STRONG",{});var C=n(v);U=o(C,"installing from source"),C.forEach(l),Z=o(M," and keeping the installation up to date. We update the example scripts frequently and install example-specific requirements."),M.forEach(l)},m(w,M){c(w,_,M),e(_,G),e(_,v),e(v,U),e(_,Z)},d(w){w&&l(_)}}}function yf(Fe){let _,G,v,U,Z;return{c(){_=a("p"),G=r("See "),v=a("a"),U=r("documentation"),Z=r(" for more DeepSpeed configuration options."),this.h()},l(w){_=i(w,"P",{});var M=n(_);G=o(M,"See "),v=i(M,"A",{href:!0,rel:!0});var C=n(v);U=o(C,"documentation"),C.forEach(l),Z=o(M," for more DeepSpeed configuration options."),M.forEach(l),this.h()},h(){p(v,"href","https://huggingface.co/docs/accelerate/usage_guides/deepspeed"),p(v,"rel","nofollow")},m(w,M){c(w,_,M),e(_,G),e(_,v),e(v,U),e(_,Z)},d(w){w&&l(_)}}}function gf(Fe){let _,G,v,U,Z,w,M,C,Nn,Ia,Rt,$t,kn,Cn,Na,V,Sn,It,Bn,Xn,Nt,Vn,xn,ka,A,et,jl,kt,Yn,Gl,An,Ca,De,Fn,Sa,lt,Ba,Qe,Dn,Xa,Ct,Va,St,Qn,Bt,zn,xa,Xt,Ya,ze,Pn,Aa,Vt,Fa,at,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,oo,_a,po,co,va,fo,Bi,Ie,Ne,uo,ho,Xi,_t,mo,wa,bo,yo,Vi,Ul,go,xi,ke,Yi,vt,Ai,wt,_o,Ma,vo,wo,Fi,Ce,Di,K,Mt,Ua,Se,Mo,Ta,Uo,Qi,E,To,Tl,Eo,Jo,Ea,Zo,jo,Ja,Go,Wo,Za,Ro,$o,ja,Io,No,zi,Be,Pi,tt,Ut,Ga,Xe,ko,Wa,Co,qi,I,So,Ve,Bo,Xo,Ra,Vo,xo,xe,Yo,Ao,Li;return w=new j({}),kt=new j({}),lt=new cf({props:{warning:!0,$$slots:{default:[bf]},$$scope:{ctx:Fe}}}),Ct=new J({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC1lJTIwLg==",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install -e .`}}),Xt=new J({props:{code:"Y2QlMjBleGFtcGxlcyUyRmNvbnRyb2xuZXQ=",highlighted:'<span class="hljs-built_in">cd</span> examples/controlnet'}}),Vt=new J({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt"}}),Yt=new J({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config"}}),At=new J({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default"}}),Ft=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()`}}),Dt=new j({}),Ht=new j({}),Ot=new J({props:{code:"d2dldCUyMGh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmRpZmZ1c2VycyUyRmNvbnRyb2xuZXRfdHJhaW5pbmclMkZjb25kaXRpb25pbmdfaW1hZ2VfMS5wbmclMEElMEF3Z2V0JTIwaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGZGlmZnVzZXJzJTJGY29udHJvbG5ldF90cmFpbmluZyUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZw==",highlighted:`wget https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_1.png

wget https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_2.png`}}),te=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAlNUMlMEElMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&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_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=4 \\
 --push_to_hub`}}),ee=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&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_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
  --push_to_hub`}}),le=new j({}),ie=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMC0tbXVsdGlfZ3B1JTIwdHJhaW5fY29udHJvbG5ldC5weSUyMCU1QyUwQSUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0QlMjRNT0RFTF9ESVIlMjAlNUMlMEElMjAtLW91dHB1dF9kaXIlM0QlMjRPVVRQVVRfRElSJTIwJTVDJTBBJTIwLS1kYXRhc2V0X25hbWUlM0RmdXNpbmclMkZmaWxsNTBrJTIwJTVDJTBBJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwJTVDJTBBJTIwLS1sZWFybmluZ19yYXRlJTNEMWUtNSUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9pbWFnZSUyMCUyMi4lMkZjb25kaXRpb25pbmdfaW1hZ2VfMS5wbmclMjIlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzIucG5nJTIyJTIwJTVDJTBBJTIwLS12YWxpZGF0aW9uX3Byb21wdCUyMCUyMnJlZCUyMGNpcmNsZSUyMHdpdGglMjBibHVlJTIwYmFja2dyb3VuZCUyMiUyMCUyMmN5YW4lMjBjaXJjbGUlMjB3aXRoJTIwYnJvd24lMjBmbG9yYWwlMjBiYWNrZ3JvdW5kJTIyJTIwJTVDJTBBJTIwLS10cmFpbl9iYXRjaF9zaXplJTNENCUyMCU1QyUwQSUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMCU1QyUwQSUyMC0tdHJhY2tlcl9wcm9qZWN0X25hbWUlM0QlMjJjb250cm9sbmV0LWRlbW8lMjIlMjAlNUMlMEElMjAtLXJlcG9ydF90byUzRHdhbmRiJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> OUTPUT_DIR=<span class="hljs-string">&quot;path to save model&quot;</span>

accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> --multi_gpu train_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=4 \\
 --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> \\
 --tracker_project_name=<span class="hljs-string">&quot;controlnet-demo&quot;</span> \\
 --report_to=wandb \\
  --push_to_hub`}}),ne=new j({}),se=new j({}),ue=new j({}),ge=new j({}),we=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&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_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
 --gradient_checkpointing \\
 --use_8bit_adam \\
  --push_to_hub`}}),Me=new j({}),Ze=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTUlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25faW1hZ2UlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZyUyMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9wcm9tcHQlMjAlMjJyZWQlMjBjaXJjbGUlMjB3aXRoJTIwYmx1ZSUyMGJhY2tncm91bmQlMjIlMjAlMjJjeWFuJTIwY2lyY2xlJTIwd2l0aCUyMGJyb3duJTIwZmxvcmFsJTIwYmFja2dyb3VuZCUyMiUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUyMCU1QyUwQSUyMC0tc2V0X2dyYWRzX3RvX25vbmUlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHVi",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&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_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --learning_rate=1e-5 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
 --gradient_checkpointing \\
 --use_8bit_adam \\
 --enable_xformers_memory_efficient_attention \\
 --set_grads_to_none \\
  --push_to_hub`}}),je=new j({}),ke=new J({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTBBJTIwJTIwZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNBJTIwNCUwQSUyMCUyMG9mZmxvYWRfb3B0aW1pemVyX2RldmljZSUzQSUyMGNwdSUwQSUyMCUyMG9mZmxvYWRfcGFyYW1fZGV2aWNlJTNBJTIwY3B1JTBBJTIwJTIwemVybzNfaW5pdF9mbGFnJTNBJTIwZmFsc2UlMEElMjAlMjB6ZXJvX3N0YWdlJTNBJTIwMiUwQWRpc3RyaWJ1dGVkX3R5cGUlM0ElMjBERUVQU1BFRUQ=",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">deepspeed_config:</span>
  <span class="hljs-attr">gradient_accumulation_steps:</span> <span class="hljs-number">4</span>
  <span class="hljs-attr">offload_optimizer_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">offload_param_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">zero3_init_flag:</span> <span class="hljs-literal">false</span>
  <span class="hljs-attr">zero_stage:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">DEEPSPEED</span>`}}),vt=new cf({props:{$$slots:{default:[yf]},$$scope:{ctx:Fe}}}),Ce=new J({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFleHBvcnQlMjBPVVRQVVRfRElSJTNEJTIycGF0aCUyMHRvJTIwc2F2ZSUyMG1vZGVsJTIyJTBBJTBBYWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfRElSJTIwJTVDJTBBJTIwLS1vdXRwdXRfZGlyJTNEJTI0T1VUUFVUX0RJUiUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEZnVzaW5nJTJGZmlsbDUwayUyMCU1QyUwQSUyMC0tcmVzb2x1dGlvbiUzRDUxMiUyMCU1QyUwQSUyMC0tdmFsaWRhdGlvbl9pbWFnZSUyMCUyMi4lMkZjb25kaXRpb25pbmdfaW1hZ2VfMS5wbmclMjIlMjAlMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzIucG5nJTIyJTIwJTVDJTBBJTIwLS12YWxpZGF0aW9uX3Byb21wdCUyMCUyMnJlZCUyMGNpcmNsZSUyMHdpdGglMjBibHVlJTIwYmFja2dyb3VuZCUyMiUyMCUyMmN5YW4lMjBjaXJjbGUlMjB3aXRoJTIwYnJvd24lMjBmbG9yYWwlMjBiYWNrZ3JvdW5kJTIyJTIwJTVDJTBBJTIwLS10cmFpbl9iYXRjaF9zaXplJTNEMSUyMCU1QyUwQSUyMC0tZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNENCUyMCU1QyUwQSUyMC0tZ3JhZGllbnRfY2hlY2twb2ludGluZyUyMCU1QyUwQSUyMC0tZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uJTIwJTVDJTBBJTIwLS1zZXRfZ3JhZHNfdG9fbm9uZSUyMCU1QyUwQSUyMC0tbWl4ZWRfcHJlY2lzaW9uJTIwZnAxNiUyMCU1QyUwQSUyMC0tcHVzaF90b19odWI=",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&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_controlnet.py \\
 --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_DIR</span> \\
 --output_dir=<span class="hljs-variable">$OUTPUT_DIR</span> \\
 --dataset_name=fusing/fill50k \\
 --resolution=512 \\
 --validation_image <span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span> <span class="hljs-string">&quot;./conditioning_image_2.png&quot;</span> \\
 --validation_prompt <span class="hljs-string">&quot;red circle with blue background&quot;</span> <span class="hljs-string">&quot;cyan circle with brown floral background&quot;</span> \\
 --train_batch_size=1 \\
 --gradient_accumulation_steps=4 \\
 --gradient_checkpointing \\
 --enable_xformers_memory_efficient_attention \\
 --set_grads_to_none \\
 --mixed_precision fp16 \\
 --push_to_hub`}}),Se=new j({}),Be=new J({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkNvbnRyb2xOZXRQaXBlbGluZSUyQyUyMENvbnRyb2xOZXRNb2RlbCUyQyUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWJhc2VfbW9kZWxfcGF0aCUyMCUzRCUyMCUyMnBhdGglMjB0byUyMG1vZGVsJTIyJTBBY29udHJvbG5ldF9wYXRoJTIwJTNEJTIwJTIycGF0aCUyMHRvJTIwY29udHJvbG5ldCUyMiUwQSUwQWNvbnRyb2xuZXQlMjAlM0QlMjBDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKGNvbnRyb2xuZXRfcGF0aCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbkNvbnRyb2xOZXRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwYmFzZV9tb2RlbF9wYXRoJTJDJTIwY29udHJvbG5ldCUzRGNvbnRyb2xuZXQlMkMlMjB0b3JjaF9k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G5nJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

base_model_path = <span class="hljs-string">&quot;path to model&quot;</span>
controlnet_path = <span class="hljs-string">&quot;path to controlnet&quot;</span>

controlnet = ControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    base_model_path, controlnet=controlnet, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
)

<span class="hljs-comment"># speed up diffusion process with faster scheduler and memory optimization</span>
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
<span class="hljs-comment"># remove following line if xformers is not installed</span>
pipe.enable_xformers_memory_efficient_attention()

pipe.enable_model_cpu_offload()

control_image = load_image(<span class="hljs-string">&quot;./conditioning_image_1.png&quot;</span>)
prompt = <span class="hljs-string">&quot;pale golden rod circle with old lace background&quot;</span>

<span class="hljs-comment"># generate image</span>
generator = torch.manual_seed(<span class="hljs-number">0</span>)
image = pipe(prompt, num_inference_steps=<span class="hljs-number">20</span>, generator=generator, image=control_image).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;./output.png&quot;</span>)`}}),Xe=new j({}),{c(){_=a("meta"),G=f(),v=a("h1"),U=a("a"),Z=a("span"),h(w.$$.fragment),M=f(),C=a("span"),Nn=r("ControlNet"),Ia=f(),Rt=a("p"),$t=a("a"),kn=r("Adding Conditional Control to Text-to-Image Diffusion Models"),Cn=r(" (ControlNet) by Lvmin Zhang and Maneesh Agrawala."),Na=f(),V=a("p"),Sn=r("This example is based on the "),It=a("a"),Bn=r("training example in the original ControlNet repository"),Xn=r(". It trains a ControlNet to fill circles using a "),Nt=a("a"),Vn=r("small synthetic dataset"),xn=r("."),ka=f(),A=a("h2"),et=a("a"),jl=a("span"),h(kt.$$.fragment),Yn=f(),Gl=a("span"),An=r("Installing the dependencies"),Ca=f(),De=a("p"),Fn=r("Before running the scripts, make sure to install the library\u2019s training dependencies."),Sa=f(),h(lt.$$.fragment),Ba=f(),Qe=a("p"),Dn=r("To do this, execute the following steps in a new virtual environment:"),Xa=f(),h(Ct.$$.fragment),Va=f(),St=a("p"),Qn=r("Then navigate into the "),Bt=a("a"),zn=r("example folder"),xa=f(),h(Xt.$$.fragment),Ya=f(),ze=a("p"),Pn=r("Now run:"),Aa=f(),h(Vt.$$.fragment),Fa=f(),at=a("p"),qn=r("And initialize an "),xt=a("a"),Ln=r("\u{1F917}Accelerate"),Hn=r(" environment with:"),Da=f(),h(Yt.$$.fragment),Qa=f(),Pe=a("p"),On=r("Or for a default \u{1F917}Accelerate configuration without answering questions about your environment:"),za=f(),h(At.$$.fragment),Pa=f(),qe=a("p"),Kn=r("Or if your environment doesn\u2019t support an interactive shell like a notebook:"),qa=f(),h(Ft.$$.fragment),La=f(),F=a("h2"),it=a("a"),Wl=a("span"),h(Dt.$$.fragment),ts=f(),Rl=a("span"),es=r("Circle filling dataset"),Ha=f(),x=a("p"),ls=r("The original dataset is hosted in the ControlNet "),Qt=a("a"),as=r("repo"),is=r(", but we re-uploaded it "),zt=a("a"),ns=r("here"),ss=r(" to be compatible with \u{1F917} Datasets so that it can handle the data loading within the training script."),Oa=f(),W=a("p"),rs=r("Our training examples use "),Pt=a("a"),$l=a("code"),os=r("runwayml/stable-diffusion-v1-5"),ps=r(" because that is what the original set of ControlNet models was trained on. However, ControlNet can be trained to augment any compatible Stable Diffusion model (such as "),qt=a("a"),Il=a("code"),cs=r("CompVis/stable-diffusion-v1-4"),fs=r(") or "),Lt=a("a"),Nl=a("code"),us=r("stabilityai/stable-diffusion-2-1"),hs=r("."),Ka=f(),nt=a("p"),ds=r("To use your own dataset, take a look at the "),Le=a("a"),ms=r("Create a dataset for training"),bs=r(" guide."),ti=f(),D=a("h2"),st=a("a"),kl=a("span"),h(Ht.$$.fragment),ys=f(),Cl=a("span"),gs=r("Training"),ei=f(),He=a("p"),_s=r("Download the following images to condition our training with:"),li=f(),h(Ot.$$.fragment),ai=f(),Y=a("p"),vs=r("Specify the "),Sl=a("code"),ws=r("MODEL_NAME"),Ms=r(" environment variable (either a Hub model repository id or a path to the directory containing the model weights) and pass it to the "),Kt=a("a"),Bl=a("code"),Us=r("pretrained_model_name_or_path"),Ts=r(" argument."),ii=f(),rt=a("p"),Es=r("The training script creates and saves a "),Xl=a("code"),Js=r("diffusion_pytorch_model.bin"),Zs=r(" file in your repository."),ni=f(),h(te.$$.fragment),si=f(),Oe=a("p"),js=r("This default configuration requires ~38GB VRAM."),ri=f(),ot=a("p"),Gs=r("By default, the training script logs outputs to tensorboard. Pass "),Vl=a("code"),Ws=r("--report_to wandb"),Rs=r(` to use Weights &
Biases.`),oi=f(),Ke=a("p"),$s=r("Gradient accumulation with a smaller batch size can be used to reduce training requirements to ~20 GB VRAM."),pi=f(),h(ee.$$.fragment),ci=f(),Q=a("h2"),pt=a("a"),xl=a("span"),h(le.$$.fragment),Is=f(),Yl=a("span"),Ns=r("Training with multiple GPUs"),fi=f(),S=a("p"),Al=a("code"),ks=r("accelerate"),Cs=r(" allows for seamless multi-GPU training. Follow the instructions "),ae=a("a"),Ss=r("here"),Bs=r(`
for running distributed training with `),Fl=a("code"),Xs=r("accelerate"),Vs=r(". Here is an example command:"),ui=f(),h(ie.$$.fragment),hi=f(),z=a("h2"),ct=a("a"),Dl=a("span"),h(ne.$$.fragment),xs=f(),Ql=a("span"),Ys=r("Example results"),di=f(),P=a("h4"),ft=a("a"),zl=a("span"),h(se.$$.fragment),As=f(),Pl=a("span"),Fs=r("After 300 steps with batch size 8"),mi=f(),ut=a("table"),ql=a("thead"),re=a("tr"),bi=a("th"),Ds=f(),Ll=a("th"),Qs=f(),B=a("tbody"),oe=a("tr"),yi=a("td"),zs=f(),tl=a("td"),Ps=r("red circle with blue background"),qs=f(),pe=a("tr"),Hl=a("td"),el=a("img"),Ls=f(),ll=a("td"),al=a("img"),Hs=f(),ce=a("tr"),gi=a("td"),Os=f(),il=a("td"),Ks=r("cyan circle with brown floral background"),tr=f(),fe=a("tr"),Ol=a("td"),nl=a("img"),er=f(),sl=a("td"),rl=a("img"),_i=f(),q=a("h4"),ht=a("a"),Kl=a("span"),h(ue.$$.fragment),lr=f(),ta=a("span"),ar=r("After 6000 steps with batch size 8:"),vi=f(),dt=a("table"),ea=a("thead"),he=a("tr"),wi=a("th"),ir=f(),la=a("th"),nr=f(),X=a("tbody"),de=a("tr"),Mi=a("td"),sr=f(),ol=a("td"),rr=r("red circle with blue background"),or=f(),me=a("tr"),aa=a("td"),pl=a("img"),pr=f(),cl=a("td"),fl=a("img"),cr=f(),be=a("tr"),Ui=a("td"),fr=f(),ul=a("td"),ur=r("cyan circle with brown floral background"),hr=f(),ye=a("tr"),ia=a("td"),hl=a("img"),dr=f(),dl=a("td"),ml=a("img"),Ti=f(),L=a("h2"),mt=a("a"),na=a("span"),h(ge.$$.fragment),mr=f(),sa=a("span"),br=r("Training on a 16 GB GPU"),Ei=f(),bl=a("p"),yr=r("Enable the following optimizations to train on a 16GB GPU:"),Ji=f(),bt=a("ul"),ra=a("li"),gr=r("Gradient checkpointing"),_r=f(),_e=a("li"),vr=r("bitsandbyte\u2019s 8-bit optimizer (take a look at the [installation](("),ve=a("a"),wr=r("https://github.com/TimDettmers/bitsandbytes#requirements\u2014installation"),Mr=r(") instructions if you don\u2019t already have it installed)"),Zi=f(),yl=a("p"),Ur=r("Now you can launch the training script:"),ji=f(),h(we.$$.fragment),Gi=f(),H=a("h2"),yt=a("a"),oa=a("span"),h(Me.$$.fragment),Tr=f(),pa=a("span"),Er=r("Training on a 12 GB GPU"),Wi=f(),gl=a("p"),Jr=r("Enable the following optimizations to train on a 12GB GPU:"),Ri=f(),R=a("ul"),ca=a("li"),Zr=r("Gradient checkpointing"),jr=f(),Ue=a("li"),Gr=r("bitsandbyte\u2019s 8-bit optimizer (take a look at the [installation](("),Te=a("a"),Wr=r("https://github.com/TimDettmers/bitsandbytes#requirements\u2014installation"),Rr=r(") instructions if you don\u2019t already have it installed)"),$r=f(),Ee=a("li"),Ir=r("xFormers (take a look at the "),Je=a("a"),Nr=r("installation"),kr=r(" instructions if you don\u2019t already have it installed)"),Cr=f(),_l=a("li"),Sr=r("set gradients to "),fa=a("code"),Br=r("None"),$i=f(),h(Ze.$$.fragment),Ii=f(),$=a("p"),Xr=r("When using "),ua=a("code"),Vr=r("enable_xformers_memory_efficient_attention"),xr=r(", please make sure to install "),ha=a("code"),Yr=r("xformers"),Ar=r(" by "),da=a("code"),Fr=r("pip install xformers"),Dr=r("."),Ni=f(),O=a("h2"),gt=a("a"),ma=a("span"),h(je.$$.fragment),Qr=f(),ba=a("span"),zr=r("Training on an 8 GB GPU"),ki=f(),vl=a("p"),Pr=r(`We have not exhaustively tested DeepSpeed support for ControlNet. While the configuration does
save memory, we have not confirmed whether the configuration trains successfully. You will very likely
have to make changes to the config to have a successful training run.`),Ci=f(),wl=a("p"),qr=r("Enable the following optimizations to train on a 8GB GPU:"),Si=f(),T=a("ul"),ya=a("li"),Lr=r("Gradient checkpointing"),Hr=f(),Ge=a("li"),Or=r("bitsandbyte\u2019s 8-bit optimizer (take a look at the [installation](("),We=a("a"),Kr=r("https://github.com/TimDettmers/bitsandbytes#requirements\u2014installation"),to=r(") instructions if you don\u2019t already have it installed)"),eo=f(),Re=a("li"),lo=r("xFormers (take a look at the "),$e=a("a"),ao=r("installation"),io=r(" instructions if you don\u2019t already have it installed)"),no=f(),Ml=a("li"),so=r("set gradients to "),ga=a("code"),ro=r("None"),oo=f(),_a=a("li"),po=r("DeepSpeed stage 2 with parameter and optimizer offloading"),co=f(),va=a("li"),fo=r("fp16 mixed precision"),Bi=f(),Ie=a("p"),Ne=a("a"),uo=r("DeepSpeed"),ho=r(` can offload tensors from VRAM to either
CPU or NVME. This requires significantly more RAM (about 25 GB).`),Xi=f(),_t=a("p"),mo=r("You\u2019ll have to configure your environment with "),wa=a("code"),bo=r("accelerate config"),yo=r(" to enable DeepSpeed stage 2."),Vi=f(),Ul=a("p"),go=r("The configuration file should look like this:"),xi=f(),h(ke.$$.fragment),Yi=f(),h(vt.$$.fragment),Ai=f(),wt=a("p"),_o=r(`Changing the default Adam optimizer to DeepSpeed\u2019s Adam
`),Ma=a("code"),vo=r("deepspeed.ops.adam.DeepSpeedCPUAdam"),wo=r(` gives a substantial speedup but
it requires a CUDA toolchain with the same version as PyTorch. 8-bit optimizer
does not seem to be compatible with DeepSpeed at the moment.`),Fi=f(),h(Ce.$$.fragment),Di=f(),K=a("h2"),Mt=a("a"),Ua=a("span"),h(Se.$$.fragment),Mo=f(),Ta=a("span"),Uo=r("Inference"),Qi=f(),E=a("p"),To=r("The trained model can be run with the "),Tl=a("a"),Eo=r("StableDiffusionControlNetPipeline"),Jo=r(`.
Set `),Ea=a("code"),Zo=r("base_model_path"),jo=r(" and "),Ja=a("code"),Go=r("controlnet_path"),Wo=r(" to the values "),Za=a("code"),Ro=r("--pretrained_model_name_or_path"),$o=r(` and
`),ja=a("code"),Io=r("--output_dir"),No=r(" were respectively set to in the training script."),zi=f(),h(Be.$$.fragment),Pi=f(),tt=a("h2"),Ut=a("a"),Ga=a("span"),h(Xe.$$.fragment),ko=f(),Wa=a("span"),Co=r("Stable Diffusion XL"),qi=f(),I=a("p"),So=r("Training with "),Ve=a("a"),Bo=r("Stable Diffusion XL"),Xo=r(" is also supported via the "),Ra=a("code"),Vo=r("train_controlnet_sdxl.py"),xo=r(" script. Please refer to the docs "),xe=a("a"),Yo=r("here"),Ao=r("."),this.h()},l(t){const s=df('[data-svelte="svelte-1phssyn"]',document.head);_=i(s,"META",{name:!0,content:!0}),s.forEach(l),G=u(t),v=i(t,"H1",{class:!0});var Ye=n(v);U=i(Ye,"A",{id:!0,class:!0,href:!0});var $a=n(U);Z=i($a,"SPAN",{});var ap=n(Z);d(w.$$.fragment,ap),ap.forEach(l),$a.forEach(l),M=u(Ye),C=i(Ye,"SPAN",{});var ip=n(C);Nn=o(ip,"ControlNet"),ip.forEach(l),Ye.forEach(l),Ia=u(t),Rt=i(t,"P",{});var Fo=n(Rt);$t=i(Fo,"A",{href:!0,rel:!0});var np=n($t);kn=o(np,"Adding Conditional Control to Text-to-Image Diffusion Models"),np.forEach(l),Cn=o(Fo," (ControlNet) by Lvmin Zhang and Maneesh Agrawala."),Fo.forEach(l),Na=u(t),V=i(t,"P",{});var El=n(V);Sn=o(El,"This example is based on the "),It=i(El,"A",{href:!0,rel:!0});var sp=n(It);Bn=o(sp,"training example in the original ControlNet repository"),sp.forEach(l),Xn=o(El,". It trains a ControlNet to fill circles using a "),Nt=i(El,"A",{href:!0,rel:!0});var rp=n(Nt);Vn=o(rp,"small synthetic dataset"),rp.forEach(l),xn=o(El,"."),El.forEach(l),ka=u(t),A=i(t,"H2",{class:!0});var Hi=n(A);et=i(Hi,"A",{id:!0,class:!0,href:!0});var op=n(et);jl=i(op,"SPAN",{});var pp=n(jl);d(kt.$$.fragment,pp),pp.forEach(l),op.forEach(l),Yn=u(Hi),Gl=i(Hi,"SPAN",{});var cp=n(Gl);An=o(cp,"Installing the dependencies"),cp.forEach(l),Hi.forEach(l),Ca=u(t),De=i(t,"P",{});var fp=n(De);Fn=o(fp,"Before running the scripts, make sure to install the library\u2019s training dependencies."),fp.forEach(l),Sa=u(t),d(lt.$$.fragment,t),Ba=u(t),Qe=i(t,"P",{});var up=n(Qe);Dn=o(up,"To do this, execute the following steps in a new virtual environment:"),up.forEach(l),Xa=u(t),d(Ct.$$.fragment,t),Va=u(t),St=i(t,"P",{});var Do=n(St);Qn=o(Do,"Then navigate into the "),Bt=i(Do,"A",{href:!0,rel:!0});var hp=n(Bt);zn=o(hp,"example folder"),hp.forEach(l),Do.forEach(l),xa=u(t),d(Xt.$$.fragment,t),Ya=u(t),ze=i(t,"P",{});var dp=n(ze);Pn=o(dp,"Now run:"),dp.forEach(l),Aa=u(t),d(Vt.$$.fragment,t),Fa=u(t),at=i(t,"P",{});var Oi=n(at);qn=o(Oi,"And initialize an "),xt=i(Oi,"A",{href:!0,rel:!0});var mp=n(xt);Ln=o(mp,"\u{1F917}Accelerate"),mp.forEach(l),Hn=o(Oi," environment with:"),Oi.forEach(l),Da=u(t),d(Yt.$$.fragment,t),Qa=u(t),Pe=i(t,"P",{});var bp=n(Pe);On=o(bp,"Or for a default \u{1F917}Accelerate configuration without answering questions about your environment:"),bp.forEach(l),za=u(t),d(At.$$.fragment,t),Pa=u(t),qe=i(t,"P",{});var yp=n(qe);Kn=o(yp,"Or if your environment doesn\u2019t support an interactive shell like a notebook:"),yp.forEach(l),qa=u(t),d(Ft.$$.fragment,t),La=u(t),F=i(t,"H2",{class:!0});var Ki=n(F);it=i(Ki,"A",{id:!0,class:!0,href:!0});var gp=n(it);Wl=i(gp,"SPAN",{});var _p=n(Wl);d(Dt.$$.fragment,_p),_p.forEach(l),gp.forEach(l),ts=u(Ki),Rl=i(Ki,"SPAN",{});var vp=n(Rl);es=o(vp,"Circle filling dataset"),vp.forEach(l),Ki.forEach(l),Ha=u(t),x=i(t,"P",{});var Jl=n(x);ls=o(Jl,"The original dataset is hosted in the ControlNet "),Qt=i(Jl,"A",{href:!0,rel:!0});var wp=n(Qt);as=o(wp,"repo"),wp.forEach(l),is=o(Jl,", but we re-uploaded it "),zt=i(Jl,"A",{href:!0,rel:!0});var Mp=n(zt);ns=o(Mp,"here"),Mp.forEach(l),ss=o(Jl," to be compatible with \u{1F917} Datasets so that it can handle the data loading within the training script."),Jl.forEach(l),Oa=u(t),W=i(t,"P",{});var Tt=n(W);rs=o(Tt,"Our training examples use "),Pt=i(Tt,"A",{href:!0,rel:!0});var Up=n(Pt);$l=i(Up,"CODE",{});var Tp=n($l);os=o(Tp,"runwayml/stable-diffusion-v1-5"),Tp.forEach(l),Up.forEach(l),ps=o(Tt," because that is what the original set of ControlNet models was trained on. However, ControlNet can be trained to augment any compatible Stable Diffusion model (such as "),qt=i(Tt,"A",{href:!0,rel:!0});var Ep=n(qt);Il=i(Ep,"CODE",{});var Jp=n(Il);cs=o(Jp,"CompVis/stable-diffusion-v1-4"),Jp.forEach(l),Ep.forEach(l),fs=o(Tt,") or "),Lt=i(Tt,"A",{href:!0,rel:!0});var Zp=n(Lt);Nl=i(Zp,"CODE",{});var jp=n(Nl);us=o(jp,"stabilityai/stable-diffusion-2-1"),jp.forEach(l),Zp.forEach(l),hs=o(Tt,"."),Tt.forEach(l),Ka=u(t),nt=i(t,"P",{});var tn=n(nt);ds=o(tn,"To use your own dataset, take a look at the "),Le=i(tn,"A",{href:!0});var Gp=n(Le);ms=o(Gp,"Create a dataset for training"),Gp.forEach(l),bs=o(tn," guide."),tn.forEach(l),ti=u(t),D=i(t,"H2",{class:!0});var en=n(D);st=i(en,"A",{id:!0,class:!0,href:!0});var Wp=n(st);kl=i(Wp,"SPAN",{});var Rp=n(kl);d(Ht.$$.fragment,Rp),Rp.forEach(l),Wp.forEach(l),ys=u(en),Cl=i(en,"SPAN",{});var $p=n(Cl);gs=o($p,"Training"),$p.forEach(l),en.forEach(l),ei=u(t),He=i(t,"P",{});var Ip=n(He);_s=o(Ip,"Download the following images to condition our training with:"),Ip.forEach(l),li=u(t),d(Ot.$$.fragment,t),ai=u(t),Y=i(t,"P",{});var Zl=n(Y);vs=o(Zl,"Specify the "),Sl=i(Zl,"CODE",{});var Np=n(Sl);ws=o(Np,"MODEL_NAME"),Np.forEach(l),Ms=o(Zl," environment variable (either a Hub model repository id or a path to the directory containing the model weights) and pass it to the "),Kt=i(Zl,"A",{href:!0,rel:!0});var kp=n(Kt);Bl=i(kp,"CODE",{});var Cp=n(Bl);Us=o(Cp,"pretrained_model_name_or_path"),Cp.forEach(l),kp.forEach(l),Ts=o(Zl," argument."),Zl.forEach(l),ii=u(t),rt=i(t,"P",{});var ln=n(rt);Es=o(ln,"The training script creates and saves a "),Xl=i(ln,"CODE",{});var Sp=n(Xl);Js=o(Sp,"diffusion_pytorch_model.bin"),Sp.forEach(l),Zs=o(ln," file in your repository."),ln.forEach(l),ni=u(t),d(te.$$.fragment,t),si=u(t),Oe=i(t,"P",{});var Bp=n(Oe);js=o(Bp,"This default configuration requires ~38GB VRAM."),Bp.forEach(l),ri=u(t),ot=i(t,"P",{});var an=n(ot);Gs=o(an,"By default, the training script logs outputs to tensorboard. Pass "),Vl=i(an,"CODE",{});var Xp=n(Vl);Ws=o(Xp,"--report_to wandb"),Xp.forEach(l),Rs=o(an,` to use Weights &
Biases.`),an.forEach(l),oi=u(t),Ke=i(t,"P",{});var Vp=n(Ke);$s=o(Vp,"Gradient accumulation with a smaller batch size can be used to reduce training requirements to ~20 GB VRAM."),Vp.forEach(l),pi=u(t),d(ee.$$.fragment,t),ci=u(t),Q=i(t,"H2",{class:!0});var nn=n(Q);pt=i(nn,"A",{id:!0,class:!0,href:!0});var xp=n(pt);xl=i(xp,"SPAN",{});var Yp=n(xl);d(le.$$.fragment,Yp),Yp.forEach(l),xp.forEach(l),Is=u(nn),Yl=i(nn,"SPAN",{});var Ap=n(Yl);Ns=o(Ap,"Training with multiple GPUs"),Ap.forEach(l),nn.forEach(l),fi=u(t),S=i(t,"P",{});var Ae=n(S);Al=i(Ae,"CODE",{});var Fp=n(Al);ks=o(Fp,"accelerate"),Fp.forEach(l),Cs=o(Ae," allows for seamless multi-GPU training. Follow the instructions "),ae=i(Ae,"A",{href:!0,rel:!0});var Dp=n(ae);Ss=o(Dp,"here"),Dp.forEach(l),Bs=o(Ae,`
for running distributed training with `),Fl=i(Ae,"CODE",{});var Qp=n(Fl);Xs=o(Qp,"accelerate"),Qp.forEach(l),Vs=o(Ae,". Here is an example command:"),Ae.forEach(l),ui=u(t),d(ie.$$.fragment,t),hi=u(t),z=i(t,"H2",{class:!0});var sn=n(z);ct=i(sn,"A",{id:!0,class:!0,href:!0});var zp=n(ct);Dl=i(zp,"SPAN",{});var Pp=n(Dl);d(ne.$$.fragment,Pp),Pp.forEach(l),zp.forEach(l),xs=u(sn),Ql=i(sn,"SPAN",{});var qp=n(Ql);Ys=o(qp,"Example results"),qp.forEach(l),sn.forEach(l),di=u(t),P=i(t,"H4",{class:!0});var rn=n(P);ft=i(rn,"A",{id:!0,class:!0,href:!0});var Lp=n(ft);zl=i(Lp,"SPAN",{});var Hp=n(zl);d(se.$$.fragment,Hp),Hp.forEach(l),Lp.forEach(l),As=u(rn),Pl=i(rn,"SPAN",{});var Op=n(Pl);Fs=o(Op,"After 300 steps with batch size 8"),Op.forEach(l),rn.forEach(l),mi=u(t),ut=i(t,"TABLE",{});var on=n(ut);ql=i(on,"THEAD",{});var Kp=n(ql);re=i(Kp,"TR",{});var pn=n(re);bi=i(pn,"TH",{}),n(bi).forEach(l),Ds=u(pn),Ll=i(pn,"TH",{align:!0}),n(Ll).forEach(l),pn.forEach(l),Kp.forEach(l),Qs=u(on),B=i(on,"TBODY",{});var Et=n(B);oe=i(Et,"TR",{});var cn=n(oe);yi=i(cn,"TD",{}),n(yi).forEach(l),zs=u(cn),tl=i(cn,"TD",{align:!0});var tc=n(tl);Ps=o(tc,"red circle with blue background"),tc.forEach(l),cn.forEach(l),qs=u(Et),pe=i(Et,"TR",{});var fn=n(pe);Hl=i(fn,"TD",{});var ec=n(Hl);el=i(ec,"IMG",{src:!0,alt:!0}),ec.forEach(l),Ls=u(fn),ll=i(fn,"TD",{align:!0});var lc=n(ll);al=i(lc,"IMG",{src:!0,alt:!0}),lc.forEach(l),fn.forEach(l),Hs=u(Et),ce=i(Et,"TR",{});var un=n(ce);gi=i(un,"TD",{}),n(gi).forEach(l),Os=u(un),il=i(un,"TD",{align:!0});var ac=n(il);Ks=o(ac,"cyan circle with brown floral background"),ac.forEach(l),un.forEach(l),tr=u(Et),fe=i(Et,"TR",{});var hn=n(fe);Ol=i(hn,"TD",{});var ic=n(Ol);nl=i(ic,"IMG",{src:!0,alt:!0}),ic.forEach(l),er=u(hn),sl=i(hn,"TD",{align:!0});var nc=n(sl);rl=i(nc,"IMG",{src:!0,alt:!0}),nc.forEach(l),hn.forEach(l),Et.forEach(l),on.forEach(l),_i=u(t),q=i(t,"H4",{class:!0});var dn=n(q);ht=i(dn,"A",{id:!0,class:!0,href:!0});var sc=n(ht);Kl=i(sc,"SPAN",{});var rc=n(Kl);d(ue.$$.fragment,rc),rc.forEach(l),sc.forEach(l),lr=u(dn),ta=i(dn,"SPAN",{});var oc=n(ta);ar=o(oc,"After 6000 steps with batch size 8:"),oc.forEach(l),dn.forEach(l),vi=u(t),dt=i(t,"TABLE",{});var mn=n(dt);ea=i(mn,"THEAD",{});var pc=n(ea);he=i(pc,"TR",{});var bn=n(he);wi=i(bn,"TH",{}),n(wi).forEach(l),ir=u(bn),la=i(bn,"TH",{align:!0}),n(la).forEach(l),bn.forEach(l),pc.forEach(l),nr=u(mn),X=i(mn,"TBODY",{});var Jt=n(X);de=i(Jt,"TR",{});var yn=n(de);Mi=i(yn,"TD",{}),n(Mi).forEach(l),sr=u(yn),ol=i(yn,"TD",{align:!0});var cc=n(ol);rr=o(cc,"red circle with blue background"),cc.forEach(l),yn.forEach(l),or=u(Jt),me=i(Jt,"TR",{});var gn=n(me);aa=i(gn,"TD",{});var fc=n(aa);pl=i(fc,"IMG",{src:!0,alt:!0}),fc.forEach(l),pr=u(gn),cl=i(gn,"TD",{align:!0});var uc=n(cl);fl=i(uc,"IMG",{src:!0,alt:!0}),uc.forEach(l),gn.forEach(l),cr=u(Jt),be=i(Jt,"TR",{});var _n=n(be);Ui=i(_n,"TD",{}),n(Ui).forEach(l),fr=u(_n),ul=i(_n,"TD",{align:!0});var hc=n(ul);ur=o(hc,"cyan circle with brown floral background"),hc.forEach(l),_n.forEach(l),hr=u(Jt),ye=i(Jt,"TR",{});var vn=n(ye);ia=i(vn,"TD",{});var dc=n(ia);hl=i(dc,"IMG",{src:!0,alt:!0}),dc.forEach(l),dr=u(vn),dl=i(vn,"TD",{align:!0});var mc=n(dl);ml=i(mc,"IMG",{src:!0,alt:!0}),mc.forEach(l),vn.forEach(l),Jt.forEach(l),mn.forEach(l),Ti=u(t),L=i(t,"H2",{class:!0});var wn=n(L);mt=i(wn,"A",{id:!0,class:!0,href:!0});var bc=n(mt);na=i(bc,"SPAN",{});var yc=n(na);d(ge.$$.fragment,yc),yc.forEach(l),bc.forEach(l),mr=u(wn),sa=i(wn,"SPAN",{});var gc=n(sa);br=o(gc,"Training on a 16 GB GPU"),gc.forEach(l),wn.forEach(l),Ei=u(t),bl=i(t,"P",{});var _c=n(bl);yr=o(_c,"Enable the following optimizations to train on a 16GB GPU:"),_c.forEach(l),Ji=u(t),bt=i(t,"UL",{});var Mn=n(bt);ra=i(Mn,"LI",{});var vc=n(ra);gr=o(vc,"Gradient checkpointing"),vc.forEach(l),_r=u(Mn),_e=i(Mn,"LI",{});var Un=n(_e);vr=o(Un,"bitsandbyte\u2019s 8-bit optimizer (take a look at the [installation](("),ve=i(Un,"A",{href:!0,rel:!0});var wc=n(ve);wr=o(wc,"https://github.com/TimDettmers/bitsandbytes#requirements\u2014installation"),wc.forEach(l),Mr=o(Un,") instructions if you don\u2019t already have it installed)"),Un.forEach(l),Mn.forEach(l),Zi=u(t),yl=i(t,"P",{});var Mc=n(yl);Ur=o(Mc,"Now you can launch the training script:"),Mc.forEach(l),ji=u(t),d(we.$$.fragment,t),Gi=u(t),H=i(t,"H2",{class:!0});var Tn=n(H);yt=i(Tn,"A",{id:!0,class:!0,href:!0});var Uc=n(yt);oa=i(Uc,"SPAN",{});var Tc=n(oa);d(Me.$$.fragment,Tc),Tc.forEach(l),Uc.forEach(l),Tr=u(Tn),pa=i(Tn,"SPAN",{});var Ec=n(pa);Er=o(Ec,"Training on a 12 GB GPU"),Ec.forEach(l),Tn.forEach(l),Wi=u(t),gl=i(t,"P",{});var Jc=n(gl);Jr=o(Jc,"Enable the following optimizations to train on a 12GB GPU:"),Jc.forEach(l),Ri=u(t),R=i(t,"UL",{});var Zt=n(R);ca=i(Zt,"LI",{});var Zc=n(ca);Zr=o(Zc,"Gradient checkpointing"),Zc.forEach(l),jr=u(Zt),Ue=i(Zt,"LI",{});var En=n(Ue);Gr=o(En,"bitsandbyte\u2019s 8-bit optimizer (take a look at the [installation](("),Te=i(En,"A",{href:!0,rel:!0});var jc=n(Te);Wr=o(jc,"https://github.com/TimDettmers/bitsandbytes#requirements\u2014installation"),jc.forEach(l),Rr=o(En,") instructions if you don\u2019t already have it installed)"),En.forEach(l),$r=u(Zt),Ee=i(Zt,"LI",{});var Jn=n(Ee);Ir=o(Jn,"xFormers (take a look at the "),Je=i(Jn,"A",{href:!0,rel:!0});var Gc=n(Je);Nr=o(Gc,"installation"),Gc.forEach(l),kr=o(Jn," instructions if you don\u2019t already have it installed)"),Jn.forEach(l),Cr=u(Zt),_l=i(Zt,"LI",{});var Qo=n(_l);Sr=o(Qo,"set gradients to "),fa=i(Qo,"CODE",{});var Wc=n(fa);Br=o(Wc,"None"),Wc.forEach(l),Qo.forEach(l),Zt.forEach(l),$i=u(t),d(Ze.$$.fragment,t),Ii=u(t),$=i(t,"P",{});var jt=n($);Xr=o(jt,"When using "),ua=i(jt,"CODE",{});var Rc=n(ua);Vr=o(Rc,"enable_xformers_memory_efficient_attention"),Rc.forEach(l),xr=o(jt,", please make sure to install "),ha=i(jt,"CODE",{});var $c=n(ha);Yr=o($c,"xformers"),$c.forEach(l),Ar=o(jt," by "),da=i(jt,"CODE",{});var Ic=n(da);Fr=o(Ic,"pip install xformers"),Ic.forEach(l),Dr=o(jt,"."),jt.forEach(l),Ni=u(t),O=i(t,"H2",{class:!0});var Zn=n(O);gt=i(Zn,"A",{id:!0,class:!0,href:!0});var Nc=n(gt);ma=i(Nc,"SPAN",{});var kc=n(ma);d(je.$$.fragment,kc),kc.forEach(l),Nc.forEach(l),Qr=u(Zn),ba=i(Zn,"SPAN",{});var Cc=n(ba);zr=o(Cc,"Training on an 8 GB GPU"),Cc.forEach(l),Zn.forEach(l),ki=u(t),vl=i(t,"P",{});var Sc=n(vl);Pr=o(Sc,`We have not exhaustively tested DeepSpeed support for ControlNet. While the configuration does
save memory, we have not confirmed whether the configuration trains successfully. You will very likely
have to make changes to the config to have a successful training run.`),Sc.forEach(l),Ci=u(t),wl=i(t,"P",{});var Bc=n(wl);qr=o(Bc,"Enable the following optimizations to train on a 8GB GPU:"),Bc.forEach(l),Si=u(t),T=i(t,"UL",{});var N=n(T);ya=i(N,"LI",{});var Xc=n(ya);Lr=o(Xc,"Gradient checkpointing"),Xc.forEach(l),Hr=u(N),Ge=i(N,"LI",{});var jn=n(Ge);Or=o(jn,"bitsandbyte\u2019s 8-bit optimizer (take a look at the [installation](("),We=i(jn,"A",{href:!0,rel:!0});var Vc=n(We);Kr=o(Vc,"https://github.com/TimDettmers/bitsandbytes#requirements\u2014installation"),Vc.forEach(l),to=o(jn,") instructions if you don\u2019t already have it installed)"),jn.forEach(l),eo=u(N),Re=i(N,"LI",{});var Gn=n(Re);lo=o(Gn,"xFormers (take a look at the "),$e=i(Gn,"A",{href:!0,rel:!0});var xc=n($e);ao=o(xc,"installation"),xc.forEach(l),io=o(Gn," instructions if you don\u2019t already have it installed)"),Gn.forEach(l),no=u(N),Ml=i(N,"LI",{});var zo=n(Ml);so=o(zo,"set gradients to "),ga=i(zo,"CODE",{});var Yc=n(ga);ro=o(Yc,"None"),Yc.forEach(l),zo.forEach(l),oo=u(N),_a=i(N,"LI",{});var Ac=n(_a);po=o(Ac,"DeepSpeed stage 2 with parameter and optimizer offloading"),Ac.forEach(l),co=u(N),va=i(N,"LI",{});var Fc=n(va);fo=o(Fc,"fp16 mixed precision"),Fc.forEach(l),N.forEach(l),Bi=u(t),Ie=i(t,"P",{});var Po=n(Ie);Ne=i(Po,"A",{href:!0,rel:!0});var Dc=n(Ne);uo=o(Dc,"DeepSpeed"),Dc.forEach(l),ho=o(Po,` can offload tensors from VRAM to either
CPU or NVME. This requires significantly more RAM (about 25 GB).`),Po.forEach(l),Xi=u(t),_t=i(t,"P",{});var Wn=n(_t);mo=o(Wn,"You\u2019ll have to configure your environment with "),wa=i(Wn,"CODE",{});var Qc=n(wa);bo=o(Qc,"accelerate config"),Qc.forEach(l),yo=o(Wn," to enable DeepSpeed stage 2."),Wn.forEach(l),Vi=u(t),Ul=i(t,"P",{});var zc=n(Ul);go=o(zc,"The configuration file should look like this:"),zc.forEach(l),xi=u(t),d(ke.$$.fragment,t),Yi=u(t),d(vt.$$.fragment,t),Ai=u(t),wt=i(t,"P",{});var Rn=n(wt);_o=o(Rn,`Changing the default Adam optimizer to DeepSpeed\u2019s Adam
`),Ma=i(Rn,"CODE",{});var Pc=n(Ma);vo=o(Pc,"deepspeed.ops.adam.DeepSpeedCPUAdam"),Pc.forEach(l),wo=o(Rn,` gives a substantial speedup but
it requires a CUDA toolchain with the same version as PyTorch. 8-bit optimizer
does not seem to be compatible with DeepSpeed at the moment.`),Rn.forEach(l),Fi=u(t),d(Ce.$$.fragment,t),Di=u(t),K=i(t,"H2",{class:!0});var $n=n(K);Mt=i($n,"A",{id:!0,class:!0,href:!0});var qc=n(Mt);Ua=i(qc,"SPAN",{});var Lc=n(Ua);d(Se.$$.fragment,Lc),Lc.forEach(l),qc.forEach(l),Mo=u($n),Ta=i($n,"SPAN",{});var Hc=n(Ta);Uo=o(Hc,"Inference"),Hc.forEach(l),$n.forEach(l),Qi=u(t),E=i(t,"P",{});var k=n(E);To=o(k,"The trained model can be run with the "),Tl=i(k,"A",{href:!0});var Oc=n(Tl);Eo=o(Oc,"StableDiffusionControlNetPipeline"),Oc.forEach(l),Jo=o(k,`.
Set `),Ea=i(k,"CODE",{});var Kc=n(Ea);Zo=o(Kc,"base_model_path"),Kc.forEach(l),jo=o(k," and "),Ja=i(k,"CODE",{});var tf=n(Ja);Go=o(tf,"controlnet_path"),tf.forEach(l),Wo=o(k," to the values "),Za=i(k,"CODE",{});var ef=n(Za);Ro=o(ef,"--pretrained_model_name_or_path"),ef.forEach(l),$o=o(k,` and
`),ja=i(k,"CODE",{});var lf=n(ja);Io=o(lf,"--output_dir"),lf.forEach(l),No=o(k," were respectively set to in the training script."),k.forEach(l),zi=u(t),d(Be.$$.fragment,t),Pi=u(t),tt=i(t,"H2",{class:!0});var In=n(tt);Ut=i(In,"A",{id:!0,class:!0,href:!0});var af=n(Ut);Ga=i(af,"SPAN",{});var nf=n(Ga);d(Xe.$$.fragment,nf),nf.forEach(l),af.forEach(l),ko=u(In),Wa=i(In,"SPAN",{});var sf=n(Wa);Co=o(sf,"Stable Diffusion XL"),sf.forEach(l),In.forEach(l),qi=u(t),I=i(t,"P",{});var Gt=n(I);So=o(Gt,"Training with "),Ve=i(Gt,"A",{href:!0,rel:!0});var rf=n(Ve);Bo=o(rf,"Stable Diffusion XL"),rf.forEach(l),Xo=o(Gt," is also supported via the "),Ra=i(Gt,"CODE",{});var of=n(Ra);Vo=o(of,"train_controlnet_sdxl.py"),of.forEach(l),xo=o(Gt," script. Please refer to the docs "),xe=i(Gt,"A",{href:!0,rel:!0});var pf=n(xe);Yo=o(pf,"here"),pf.forEach(l),Ao=o(Gt,"."),Gt.forEach(l),this.h()},h(){p(_,"name","hf:doc:metadata"),p(_,"content",JSON.stringify(_f)),p(U,"id","controlnet"),p(U,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(U,"href","#controlnet"),p(v,"class","relative group"),p($t,"href","https://arxiv.org/abs/2302.05543"),p($t,"rel","nofollow"),p(It,"href","https://github.com/lllyasviel/ControlNet/blob/main/docs/train.md"),p(It,"rel","nofollow"),p(Nt,"href","https://huggingface.co/datasets/fusing/fill50k"),p(Nt,"rel","nofollow"),p(et,"id","installing-the-dependencies"),p(et,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(et,"href","#installing-the-dependencies"),p(A,"class","relative group"),p(Bt,"href","https://github.com/huggingface/diffusers/tree/main/examples/controlnet"),p(Bt,"rel","nofollow"),p(xt,"href","https://github.com/huggingface/accelerate/"),p(xt,"rel","nofollow"),p(it,"id","circle-filling-dataset"),p(it,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(it,"href","#circle-filling-dataset"),p(F,"class","relative group"),p(Qt,"href","https://huggingface.co/lllyasviel/ControlNet/blob/main/training/fill50k.zip"),p(Qt,"rel","nofollow"),p(zt,"href","https://huggingface.co/datasets/fusing/fill50k"),p(zt,"rel","nofollow"),p(Pt,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),p(Pt,"rel","nofollow"),p(qt,"href","https://huggingface.co/CompVis/stable-diffusion-v1-4"),p(qt,"rel","nofollow"),p(Lt,"href","https://huggingface.co/stabilityai/stable-diffusion-2-1"),p(Lt,"rel","nofollow"),p(Le,"href","create_dataset"),p(st,"id","training"),p(st,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(st,"href","#training"),p(D,"class","relative group"),p(Kt,"href","https://huggingface.co/docs/diffusers/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path"),p(Kt,"rel","nofollow"),p(pt,"id","training-with-multiple-gpus"),p(pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(pt,"href","#training-with-multiple-gpus"),p(Q,"class","relative group"),p(ae,"href","https://huggingface.co/docs/accelerate/basic_tutorials/launch"),p(ae,"rel","nofollow"),p(ct,"id","example-results"),p(ct,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ct,"href","#example-results"),p(z,"class","relative group"),p(ft,"id","after-300-steps-with-batch-size-8"),p(ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ft,"href","#after-300-steps-with-batch-size-8"),p(P,"class","relative group"),p(Ll,"align","center"),p(tl,"align","center"),Wt(el.src,qo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_1.png")||p(el,"src",qo),p(el,"alt","conditioning image"),Wt(al.src,Lo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/red_circle_with_blue_background_300_steps.png")||p(al,"src",Lo),p(al,"alt","red circle with blue background"),p(ll,"align","center"),p(il,"align","center"),Wt(nl.src,Ho="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_2.png")||p(nl,"src",Ho),p(nl,"alt","conditioning image"),Wt(rl.src,Oo="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/cyan_circle_with_brown_floral_background_300_steps.png")||p(rl,"src",Oo),p(rl,"alt","cyan circle with brown floral background"),p(sl,"align","center"),p(ht,"id","after-6000-steps-with-batch-size-8"),p(ht,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ht,"href","#after-6000-steps-with-batch-size-8"),p(q,"class","relative group"),p(la,"align","center"),p(ol,"align","center"),Wt(pl.src,Ko="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_1.png")||p(pl,"src",Ko),p(pl,"alt","conditioning image"),Wt(fl.src,tp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/red_circle_with_blue_background_6000_steps.png")||p(fl,"src",tp),p(fl,"alt","red circle with blue background"),p(cl,"align","center"),p(ul,"align","center"),Wt(hl.src,ep="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/conditioning_image_2.png")||p(hl,"src",ep),p(hl,"alt","conditioning image"),Wt(ml.src,lp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/controlnet_training/cyan_circle_with_brown_floral_background_6000_steps.png")||p(ml,"src",lp),p(ml,"alt","cyan circle with brown floral background"),p(dl,"align","center"),p(mt,"id","training-on-a-16-gb-gpu"),p(mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(mt,"href","#training-on-a-16-gb-gpu"),p(L,"class","relative group"),p(ve,"href","https://github.com/TimDettmers/bitsandbytes#requirements--installation"),p(ve,"rel","nofollow"),p(yt,"id","training-on-a-12-gb-gpu"),p(yt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(yt,"href","#training-on-a-12-gb-gpu"),p(H,"class","relative group"),p(Te,"href","https://github.com/TimDettmers/bitsandbytes#requirements--installation"),p(Te,"rel","nofollow"),p(Je,"href","https://huggingface.co/docs/diffusers/training/optimization/xformers"),p(Je,"rel","nofollow"),p(gt,"id","training-on-an-8-gb-gpu"),p(gt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(gt,"href","#training-on-an-8-gb-gpu"),p(O,"class","relative group"),p(We,"href","https://github.com/TimDettmers/bitsandbytes#requirements--installation"),p(We,"rel","nofollow"),p($e,"href","https://huggingface.co/docs/diffusers/training/optimization/xformers"),p($e,"rel","nofollow"),p(Ne,"href","https://www.deepspeed.ai/"),p(Ne,"rel","nofollow"),p(Mt,"id","inference"),p(Mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Mt,"href","#inference"),p(K,"class","relative group"),p(Tl,"href","/docs/diffusers/main/en/api/pipelines/controlnet#diffusers.StableDiffusionControlNetPipeline"),p(Ut,"id","stable-diffusion-xl"),p(Ut,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ut,"href","#stable-diffusion-xl"),p(tt,"class","relative group"),p(Ve,"href","https://huggingface.co/papers/2307.01952"),p(Ve,"rel","nofollow"),p(xe,"href","https://github.com/huggingface/diffusers/blob/main/examples/controlnet/README_sdxl.md"),p(xe,"rel","nofollow")},m(t,s){e(document.head,_),c(t,G,s),c(t,v,s),e(v,U),e(U,Z),m(w,Z,null),e(v,M),e(v,C),e(C,Nn),c(t,Ia,s),c(t,Rt,s),e(Rt,$t),e($t,kn),e(Rt,Cn),c(t,Na,s),c(t,V,s),e(V,Sn),e(V,It),e(It,Bn),e(V,Xn),e(V,Nt),e(Nt,Vn),e(V,xn),c(t,ka,s),c(t,A,s),e(A,et),e(et,jl),m(kt,jl,null),e(A,Yn),e(A,Gl),e(Gl,An),c(t,Ca,s),c(t,De,s),e(De,Fn),c(t,Sa,s),m(lt,t,s),c(t,Ba,s),c(t,Qe,s),e(Qe,Dn),c(t,Xa,s),m(Ct,t,s),c(t,Va,s),c(t,St,s),e(St,Qn),e(St,Bt),e(Bt,zn),c(t,xa,s),m(Xt,t,s),c(t,Ya,s),c(t,ze,s),e(ze,Pn),c(t,Aa,s),m(Vt,t,s),c(t,Fa,s),c(t,at,s),e(at,qn),e(at,xt),e(xt,Ln),e(at,Hn),c(t,Da,s),m(Yt,t,s),c(t,Qa,s),c(t,Pe,s),e(Pe,On),c(t,za,s),m(At,t,s),c(t,Pa,s),c(t,qe,s),e(qe,Kn),c(t,qa,s),m(Ft,t,s),c(t,La,s),c(t,F,s),e(F,it),e(it,Wl),m(Dt,Wl,null),e(F,ts),e(F,Rl),e(Rl,es),c(t,Ha,s),c(t,x,s),e(x,ls),e(x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ps),e(B,qs),e(B,pe),e(pe,Hl),e(Hl,el),e(pe,Ls),e(pe,ll),e(ll,al),e(B,Hs),e(B,ce),e(ce,gi),e(ce,Os),e(ce,il),e(il,Ks),e(B,tr),e(B,fe),e(fe,Ol),e(Ol,nl),e(fe,er),e(fe,sl),e(sl,rl),c(t,_i,s),c(t,q,s),e(q,ht),e(ht,Kl),m(ue,Kl,null),e(q,lr),e(q,ta),e(ta,ar),c(t,vi,s),c(t,dt,s),e(dt,ea),e(ea,he),e(he,wi),e(he,ir),e(he,la),e(dt,nr),e(dt,X),e(X,de),e(de,Mi),e(de,sr),e(de,ol),e(ol,rr),e(X,or),e(X,me),e(me,aa),e(aa,pl),e(me,pr),e(me,cl),e(cl,fl),e(X,cr),e(X,be),e(be,Ui),e(be,fr),e(be,ul),e(ul,ur),e(X,hr),e(X,ye),e(ye,ia),e(ia,hl),e(ye,dr),e(ye,dl),e(dl,ml),c(t,Ti,s),c(t,L,s),e(L,mt),e(mt,na),m(ge,na,null),e(L,mr),e(L,sa),e(sa,br),c(t,Ei,s),c(t,bl,s),e(bl,yr),c(t,Ji,s),c(t,bt,s),e(bt,ra),e(ra,gr),e(bt,_r),e(bt,_e),e(_e,vr),e(_e,ve),e(ve,wr),e(_e,Mr),c(t,Zi,s),c(t,yl,s),e(yl,Ur),c(t,ji,s),m(we,t,s),c(t,Gi,s),c(t,H,s),e(H,yt),e(yt,oa),m(Me,oa,null),e(H,Tr),e(H,pa),e(pa,Er),c(t,Wi,s),c(t,gl,s),e(gl,Jr),c(t,Ri,s),c(t,R,s),e(R,ca),e(ca,Zr),e(R,jr),e(R,Ue),e(Ue,Gr),e(Ue,Te),e(Te,Wr),e(Ue,Rr),e(R,$r),e(R,Ee),e(Ee,Ir),e(Ee,Je),e(Je,Nr),e(Ee,kr),e(R,Cr),e(R,_l),e(_l,Sr),e(_l,fa),e(fa,Br),c(t,$i,s),m(Ze,t,s),c(t,Ii,s),c(t,$,s),e($,Xr),e($,ua),e(ua,Vr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p(t,[s]){const Ye={};s&2&&(Ye.$$scope={dirty:s,ctx:t}),lt.$set(Ye);const $a={};s&2&&($a.$$scope={dirty:s,ctx:t}),vt.$set($a)},i(t){Li||(b(w.$$.fragment,t),b(kt.$$.fragment,t),b(lt.$$.fragment,t),b(Ct.$$.fragment,t),b(Xt.$$.fragment,t),b(Vt.$$.fragment,t),b(Yt.$$.fragment,t),b(At.$$.fragment,t),b(Ft.$$.fragment,t),b(Dt.$$.fragment,t),b(Ht.$$.fragment,t),b(Ot.$$.fragment,t),b(te.$$.fragment,t),b(ee.$$.fragment,t),b(le.$$.fragment,t),b(ie.$$.fragment,t),b(ne.$$.fragment,t),b(se.$$.fragment,t),b(ue.$$.fragment,t),b(ge.$$.fragment,t),b(we.$$.fragment,t),b(Me.$$.fragment,t),b(Ze.$$.fragment,t),b(je.$$.fragment,t),b(ke.$$.fragment,t),b(vt.$$.fragment,t),b(Ce.$$.fragment,t),b(Se.$$.fragment,t),b(Be.$$.fragment,t),b(Xe.$$.fragment,t),Li=!0)},o(t){y(w.$$.fragment,t),y(kt.$$.fragment,t),y(lt.$$.fragment,t),y(Ct.$$.fragment,t),y(Xt.$$.fragment,t),y(Vt.$$.fragment,t),y(Yt.$$.fragment,t),y(At.$$.fragment,t),y(Ft.$$.fragment,t),y(Dt.$$.fragment,t),y(Ht.$$.fragment,t),y(Ot.$$.fragment,t),y(te.$$.fragment,t),y(ee.$$.fragment,t),y(le.$$.fragment,t),y(ie.$$.fragment,t),y(ne.$$.fragment,t),y(se.$$.fragment,t),y(ue.$$.fragment,t),y(ge.$$.fragment,t),y(we.$$.fragment,t),y(Me.$$.fragment,t),y(Ze.$$.fragment,t),y(je.$$.fragment,t),y(ke.$$.fragment,t),y(vt.$$.fragment,t),y(Ce.$$.fragment,t),y(Se.$$.fragment,t),y(Be.$$.fragment,t),y(Xe.$$.fragment,t),Li=!1},d(t){l(_),t&&l(G),t&&l(v),g(w),t&&l(Ia),t&&l(Rt),t&&l(Na),t&&l(V),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),t&&l(Pi),t&&l(tt),g(Xe),t&&l(qi),t&&l(I)}}}const _f={local:"controlnet",sections:[{local:"installing-the-dependencies",title:"Installing the dependencies"},{local:"circle-filling-dataset",title:"Circle filling dataset"},{local:"training",title:"Training"},{local:"training-with-multiple-gpus",title:"Training with multiple GPUs"},{local:"example-results",sections:[{local:"after-300-steps-with-batch-size-8",title:"After 300 steps with batch size 8"},{local:"after-6000-steps-with-batch-size-8",title:"After 6000 steps with batch size 8:"}],title:"Example results"},{local:"training-on-a-16-gb-gpu",title:"Training on a 16 GB GPU"},{local:"training-on-a-12-gb-gpu",title:"Training on a 12 GB GPU"},{local:"training-on-an-8-gb-gpu",title:"Training on an 8 GB GPU"},{local:"inference",title:"Inference"},{local:"stable-diffusion-xl",title:"Stable Diffusion XL"}],title:"ControlNet"};function vf(Fe){return mf(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ef extends ff{constructor(_){super();uf(this,_,vf,gf,hf,{})}}export{Ef as default,_f as metadata};
