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