import{S as qc,i as Lc,s as Hc,e as a,k as f,w as h,t as r,M as Oc,c as i,d as l,m as u,a as n,x as d,h as o,b as c,N as Jt,G as e,g as p,y as m,q as b,o as y,B as g,v as Kc}from"../../chunks/vendor-hf-doc-builder.js";import{T as tf}from"../../chunks/Tip-hf-doc-builder.js";import{I as R}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as U}from"../../chunks/CodeBlock-hf-doc-builder.js";function ef(Ta){let _,H,M,E,X;return{c(){_=a("p"),H=r("To successfully run the latest versions of the example scripts, we highly recommend "),M=a("strong"),E=r("installing from source"),X=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 k=n(_);H=o(k,"To successfully run the latest versions of the example scripts, we highly recommend "),M=i(k,"STRONG",{});var O=n(M);E=o(O,"installing from source"),O.forEach(l),X=o(k," and keeping the installation up to date. We update the example scripts frequently and install example-specific requirements."),k.forEach(l)},m(T,k){p(T,_,k),e(_,H),e(_,M),e(M,E),e(_,X)},d(T){T&&l(_)}}}function lf(Ta){let _,H,M,E,X,T,k,O,Jn,Ea,Zt,jt,Zn,jn,Ja,B,Gn,Gt,Wn,Rn,Wt,$n,In,Za,S,K,Ul,Rt,Nn,Tl,kn,ja,Ve,Bn,Ga,tt,Wa,Xe,Cn,Ra,$t,$a,It,Vn,Nt,Xn,Ia,kt,Na,Se,Sn,ka,Bt,Ba,et,Yn,Ct,xn,Fn,Ca,Vt,Va,Ye,An,Xa,Xt,Sa,xe,Dn,Ya,St,xa,Y,lt,El,Yt,Qn,Jl,zn,Fa,C,Pn,xt,qn,Ln,Ft,Hn,On,Aa,J,Kn,At,Zl,ts,es,Dt,jl,ls,as,Qt,Gl,is,ns,Da,at,ss,Fe,rs,os,Qa,x,it,Wl,zt,ps,Rl,cs,za,Ae,fs,Pa,Pt,qa,V,us,$l,hs,ds,qt,Il,ms,bs,La,nt,ys,Nl,gs,_s,Ha,Lt,Oa,De,vs,Ka,st,ws,kl,Ms,Us,ti,Qe,Ts,ei,Ht,li,F,rt,Bl,Ot,Es,Cl,Js,ai,$,Vl,Zs,js,Kt,Gs,Ws,Xl,Rs,$s,ii,te,ni,A,ot,Sl,ee,Is,Yl,Ns,si,D,pt,xl,le,ks,Fl,Bs,ri,ct,Al,ae,oi,Cs,Dl,Vs,I,ie,pi,Xs,ze,Ss,Ys,ne,Ql,Pe,Co,xs,qe,Le,Vo,Fs,se,ci,As,He,Ds,Qs,re,zl,Oe,Xo,zs,Ke,tl,So,fi,Q,ft,Pl,oe,Ps,ql,qs,ui,ut,Ll,pe,hi,Ls,Hl,Hs,N,ce,di,Os,el,Ks,tr,fe,Ol,ll,Yo,er,al,il,xo,lr,ue,mi,ar,nl,ir,nr,he,Kl,sl,Fo,sr,rl,ol,Ao,bi,z,ht,ta,de,rr,ea,or,yi,pl,pr,gi,dt,la,cr,fr,me,ur,be,hr,dr,_i,cl,mr,vi,ye,wi,P,mt,aa,ge,br,ia,yr,Mi,fl,gr,Ui,Z,na,_r,vr,_e,wr,ve,Mr,Ur,Tr,we,Er,Me,Jr,Zr,jr,ul,Gr,sa,Wr,Ti,Ue,Ei,j,Rr,ra,$r,Ir,oa,Nr,kr,pa,Br,Cr,Ji,q,bt,ca,Te,Vr,fa,Xr,Zi,hl,Sr,ji,dl,Yr,Gi,v,ua,xr,Fr,Ee,Ar,Je,Dr,Qr,zr,Ze,Pr,je,qr,Lr,Hr,ml,Or,ha,Kr,to,da,eo,lo,ma,ao,Wi,Ge,We,io,no,Ri,yt,so,ba,ro,oo,$i,bl,po,Ii,Re,Ni,yl,co,ki,gt,fo,$e,uo,ho,Bi,gl,mo,Ci,_t,bo,ya,yo,go,Vi,Ie,Xi,L,vt,ga,Ne,_o,_a,vo,Si,w,wo,_l,Mo,Uo,va,To,Eo,wa,Jo,Zo,Ma,jo,Go,Ua,Wo,Ro,Yi,ke,xi;return T=new R({}),Rt=new R({}),tt=new tf({props:{warning:!0,$$slots:{default:[ef]},$$scope:{ctx:Ta}}}),$t=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 .`}}),kt=new U({props:{code:"Y2QlMjBleGFtcGxlcyUyRmNvbnRyb2xuZXQ=",highlighted:'<span class="hljs-built_in">cd</span> examples/controlnet'}}),Bt=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt"}}),Vt=new U({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config"}}),Xt=new U({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default"}}),St=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()`}}),Yt=new R({}),zt=new R({}),Pt=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`}}),Lt=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`}}),Ht=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`}}),Ot=new R({}),te=new U({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`}}),ee=new R({}),le=new R({}),oe=new R({}),de=new R({}),ye=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`}}),ge=new R({}),Ue=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`}}),Te=new R({}),Re=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>`}}),Ie=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`}}),Ne=new R({}),ke=new U({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkNvbnRyb2xOZXRQaXBlbGluZSUyQyUyMENvbnRyb2xOZXRNb2RlbCUyQyUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWJhc2VfbW9kZWxfcGF0aCUyMCUzRCUyMCUyMnBhdGglMjB0byUyMG1vZGVsJTIyJTBBY29udHJvbG5ldF9wYXRoJTIwJTNEJTIwJTIycGF0aCUyMHRvJTIwY29udHJvbG5ldCUyMiUwQSUwQWNvbnRyb2xuZXQlMjAlM0QlMjBDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKGNvbnRyb2xuZXRfcGF0aCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uQ29udHJvbE5ldFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBiYXNlX21vZGVsX3BhdGglMkMlMjBjb250cm9sbmV0JTNEY29udHJvbG5ldCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEElMEElMjMlMjBzcGVlZCUyMHVwJTIwZGlmZnVzaW9uJTIwcHJvY2VzcyUyMHdpdGglMjBmYXN0ZXIlMjBzY2hlZHVsZXIlMjBhbmQlMjBtZW1vcnklMjBvcHRpbWl6YXRpb24lMEFwaXBlLnNjaGVkdWxlciUyMCUzRCUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyklMEElMjMlMjByZW1vdmUlMjBmb2xsb3dpbmclMjBsaW5lJTIwaWYlMjB4Zm9ybWVycyUyMGlzJTIwbm90JTIwaW5zdGFsbGVkJTBBcGlwZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKSUwQSUwQXBpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFjb250cm9sX2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSglMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyKSUwQXByb21wdCUyMCUzRCUyMCUyMnBhbGUlMjBnb2xkZW4lMjByb2QlMjBjaXJjbGUlMjB3aXRoJTIwb2xkJTIwbGFjZSUyMGJhY2tncm91bmQlMjIlMEElMEElMjMlMjBnZW5lcmF0ZSUyMGltYWdlJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2gubWFudWFsX3NlZWQoMCklMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTIwaW1hZ2UlM0Rjb250cm9sX2ltYWdlKS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjIuJTJGb3V0cHV0LnBuZyUyMik=",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)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    base_model_path, controlnet=controlnet, torch_dtype=torch.float16
)

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