import{s as gn,o as Mn,n as ke}from"../chunks/scheduler.8c3d61f6.js";import{S as wn,i as yn,g as m,s as i,r as b,A as $n,h as f,f as n,c as a,j as hn,u as g,x as u,k as bn,y as Tn,a as l,v as M,d as w,t as y,w as $}from"../chunks/index.da70eac4.js";import{T as Nt}from"../chunks/Tip.6f698f24.js";import{C as j}from"../chunks/CodeBlock.a9c4becf.js";import{H as Ne,E as Jn}from"../chunks/getInferenceSnippets.cb466318.js";import{H as _n,a as kt}from"../chunks/HfOption.6c3b4e77.js";function Zn(W){let o,J='🤗 Accelerate is a library for helping you train on multiple GPUs/TPUs or with mixed-precision. It’ll automatically configure your training setup based on your hardware and environment. Take a look at the 🤗 Accelerate <a href="https://huggingface.co/docs/accelerate/quicktour" rel="nofollow">Quick tour</a> to learn more.';return{c(){o=m("p"),o.innerHTML=J},l(r){o=f(r,"P",{"data-svelte-h":!0}),u(o)!=="svelte-1qbiqsn"&&(o.innerHTML=J)},m(r,d){l(r,o,d)},p:ke,d(r){r&&n(o)}}}function Un(W){let o,J='The following sections highlight parts of the training script that are important for understanding how to modify it, but it doesn’t cover every aspect of the script in detail. If you’re interested in learning more, feel free to read through the <a href="https://github.com/huggingface/diffusers/blob/main/examples/controlnet/train_controlnet.py" rel="nofollow">script</a> and let us know if you have any questions or concerns.';return{c(){o=m("p"),o.innerHTML=J},l(r){o=f(r,"P",{"data-svelte-h":!0}),u(o)!=="svelte-c8crv2"&&(o.innerHTML=J)},m(r,d){l(r,o,d)},p:ke,d(r){r&&n(o)}}}function vn(W){let o,J='If you’re streaming a dataset on a TPU, performance may be bottlenecked by the 🤗 Datasets library which is not optimized for images. To ensure maximum throughput, you’re encouraged to explore other dataset formats like <a href="https://webdataset.github.io/webdataset/" rel="nofollow">WebDataset</a>, <a href="https://github.com/pytorch/data" rel="nofollow">TorchData</a>, and <a href="https://www.tensorflow.org/datasets/tfless_tfds" rel="nofollow">TensorFlow Datasets</a>.';return{c(){o=m("p"),o.innerHTML=J},l(r){o=f(r,"P",{"data-svelte-h":!0}),u(o)!=="svelte-onyuom"&&(o.innerHTML=J)},m(r,d){l(r,o,d)},p:ke,d(r){r&&n(o)}}}function jn(W){let o,J="On a 16GB GPU, you can use bitsandbytes 8-bit optimizer and gradient checkpointing to optimize your training run. Install bitsandbytes:",r,d,T,c,s="Then, add the following parameter to your training command:",_,Z,x;return d=new j({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcw==",highlighted:"pip install bitsandbytes",wrap:!1}}),Z=new j({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUM=",highlighted:`accelerate launch train_controlnet.py \\
  --gradient_checkpointing \\
  --use_8bit_adam \\`,wrap:!1}}),{c(){o=m("p"),o.textContent=J,r=i(),b(d.$$.fragment),T=i(),c=m("p"),c.textContent=s,_=i(),b(Z.$$.fragment)},l(h){o=f(h,"P",{"data-svelte-h":!0}),u(o)!=="svelte-izoj73"&&(o.textContent=J),r=a(h),g(d.$$.fragment,h),T=a(h),c=f(h,"P",{"data-svelte-h":!0}),u(c)!=="svelte-1rkm1uq"&&(c.textContent=s),_=a(h),g(Z.$$.fragment,h)},m(h,v){l(h,o,v),l(h,r,v),M(d,h,v),l(h,T,v),l(h,c,v),l(h,_,v),M(Z,h,v),x=!0},p:ke,i(h){x||(w(d.$$.fragment,h),w(Z.$$.fragment,h),x=!0)},o(h){y(d.$$.fragment,h),y(Z.$$.fragment,h),x=!1},d(h){h&&(n(o),n(r),n(T),n(c),n(_)),$(d,h),$(Z,h)}}}function xn(W){let o,J="On a 12GB GPU, you’ll need bitsandbytes 8-bit optimizer, gradient checkpointing, xFormers, and set the gradients to <code>None</code> instead of zero to reduce your memory-usage.",r,d,T;return d=new j({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLWVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbiUyMCU1QyUwQSUyMCUyMC0tc2V0X2dyYWRzX3RvX25vbmUlMjAlNUM=",highlighted:`accelerate launch train_controlnet.py \\
  --use_8bit_adam \\
  --gradient_checkpointing \\
  --enable_xformers_memory_efficient_attention \\
  --set_grads_to_none \\`,wrap:!1}}),{c(){o=m("p"),o.innerHTML=J,r=i(),b(d.$$.fragment)},l(c){o=f(c,"P",{"data-svelte-h":!0}),u(o)!=="svelte-13zq302"&&(o.innerHTML=J),r=a(c),g(d.$$.fragment,c)},m(c,s){l(c,o,s),l(c,r,s),M(d,c,s),T=!0},p:ke,i(c){T||(w(d.$$.fragment,c),T=!0)},o(c){y(d.$$.fragment,c),T=!1},d(c){c&&(n(o),n(r)),$(d,c)}}}function Wn(W){let o,J='On a 8GB GPU, you’ll need to use <a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a> to offload some of the tensors from the vRAM to either the CPU or NVME to allow training with less GPU memory.',r,d,T="Run the following command to configure your 🤗 Accelerate environment:",c,s,_,Z,x='During configuration, confirm that you want to use DeepSpeed stage 2. Now it should be possible to train on under 8GB vRAM by combining DeepSpeed stage 2, fp16 mixed precision, and offloading the model parameters and the optimizer state to the CPU. The drawback is that this requires more system RAM (~25 GB). See the <a href="https://huggingface.co/docs/accelerate/usage_guides/deepspeed" rel="nofollow">DeepSpeed documentation</a> for more configuration options. Your configuration file should look something like:',h,v,C,I,V='You should also change the default Adam optimizer to DeepSpeed’s optimized version of Adam <a href="https://deepspeed.readthedocs.io/en/latest/optimizers.html#adam-cpu" rel="nofollow"><code>deepspeed.ops.adam.DeepSpeedCPUAdam</code></a> for a substantial speedup. Enabling <code>DeepSpeedCPUAdam</code> requires your system’s CUDA toolchain version to be the same as the one installed with PyTorch.',G,N,E="bitsandbytes 8-bit optimizers don’t seem to be compatible with DeepSpeed at the moment.",R,X,k="That’s it! You don’t need to add any additional parameters to your training command.",z;return s=new j({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),v=new j({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTBBJTIwJTIwZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNBJTIwNCUwQSUyMCUyMG9mZmxvYWRfb3B0aW1pemVyX2RldmljZSUzQSUyMGNwdSUwQSUyMCUyMG9mZmxvYWRfcGFyYW1fZGV2aWNlJTNBJTIwY3B1JTBBJTIwJTIwemVybzNfaW5pdF9mbGFnJTNBJTIwZmFsc2UlMEElMjAlMjB6ZXJvX3N0YWdlJTNBJTIwMiUwQWRpc3RyaWJ1dGVkX3R5cGUlM0ElMjBERUVQU1BFRUQ=",highlighted:`compute_environment: LOCAL_MACHINE
deepspeed_config:
  gradient_accumulation_steps: 4
  offload_optimizer_device: cpu
  offload_param_device: cpu
  zero3_init_flag: <span class="hljs-literal">false</span>
  zero_stage: 2
distributed_type: DEEPSPEED`,wrap:!1}}),{c(){o=m("p"),o.innerHTML=J,r=i(),d=m("p"),d.textContent=T,c=i(),b(s.$$.fragment),_=i(),Z=m("p"),Z.innerHTML=x,h=i(),b(v.$$.fragment),C=i(),I=m("p"),I.innerHTML=V,G=i(),N=m("p"),N.textContent=E,R=i(),X=m("p"),X.textContent=k},l(p){o=f(p,"P",{"data-svelte-h":!0}),u(o)!=="svelte-1tq9cba"&&(o.innerHTML=J),r=a(p),d=f(p,"P",{"data-svelte-h":!0}),u(d)!=="svelte-1fx999v"&&(d.textContent=T),c=a(p),g(s.$$.fragment,p),_=a(p),Z=f(p,"P",{"data-svelte-h":!0}),u(Z)!=="svelte-184kffk"&&(Z.innerHTML=x),h=a(p),g(v.$$.fragment,p),C=a(p),I=f(p,"P",{"data-svelte-h":!0}),u(I)!=="svelte-14m6rf5"&&(I.innerHTML=V),G=a(p),N=f(p,"P",{"data-svelte-h":!0}),u(N)!=="svelte-z8cdsf"&&(N.textContent=E),R=a(p),X=f(p,"P",{"data-svelte-h":!0}),u(X)!=="svelte-lwtx0u"&&(X.textContent=k)},m(p,U){l(p,o,U),l(p,r,U),l(p,d,U),l(p,c,U),M(s,p,U),l(p,_,U),l(p,Z,U),l(p,h,U),M(v,p,U),l(p,C,U),l(p,I,U),l(p,G,U),l(p,N,U),l(p,R,U),l(p,X,U),z=!0},p:ke,i(p){z||(w(s.$$.fragment,p),w(v.$$.fragment,p),z=!0)},o(p){y(s.$$.fragment,p),y(v.$$.fragment,p),z=!1},d(p){p&&(n(o),n(r),n(d),n(c),n(_),n(Z),n(h),n(C),n(I),n(G),n(N),n(R),n(X)),$(s,p),$(v,p)}}}function Cn(W){let o,J,r,d,T,c;return o=new kt({props:{id:"gpu-select",option:"16GB",$$slots:{default:[jn]},$$scope:{ctx:W}}}),r=new kt({props:{id:"gpu-select",option:"12GB",$$slots:{default:[xn]},$$scope:{ctx:W}}}),T=new kt({props:{id:"gpu-select",option:"8GB",$$slots:{default:[Wn]},$$scope:{ctx:W}}}),{c(){b(o.$$.fragment),J=i(),b(r.$$.fragment),d=i(),b(T.$$.fragment)},l(s){g(o.$$.fragment,s),J=a(s),g(r.$$.fragment,s),d=a(s),g(T.$$.fragment,s)},m(s,_){M(o,s,_),l(s,J,_),M(r,s,_),l(s,d,_),M(T,s,_),c=!0},p(s,_){const Z={};_&2&&(Z.$$scope={dirty:_,ctx:s}),o.$set(Z);const x={};_&2&&(x.$$scope={dirty:_,ctx:s}),r.$set(x);const h={};_&2&&(h.$$scope={dirty:_,ctx:s}),T.$set(h)},i(s){c||(w(o.$$.fragment,s),w(r.$$.fragment,s),w(T.$$.fragment,s),c=!0)},o(s){y(o.$$.fragment,s),y(r.$$.fragment,s),y(T.$$.fragment,s),c=!1},d(s){s&&(n(J),n(d)),$(o,s),$(r,s),$(T,s)}}}function Gn(W){let o,J,r,d,T,c,s,_='<a href="https://hf.co/papers/2302.05543" rel="nofollow">ControlNet</a> models are adapters trained on top of another pretrained model. It allows for a greater degree of control over image generation by conditioning the model with an additional input image. The input image can be a canny edge, depth map, human pose, and many more.',Z,x,h='If you’re training on a GPU with limited vRAM, you should try enabling the <code>gradient_checkpointing</code>, <code>gradient_accumulation_steps</code>, and <code>mixed_precision</code> parameters in the training command. You can also reduce your memory footprint by using memory-efficient attention with <a href="../optimization/xformers">xFormers</a>.',v,C,I='This guide will explore the <a href="https://github.com/huggingface/diffusers/blob/main/examples/controlnet/train_controlnet.py" rel="nofollow">train_controlnet.py</a> training script to help you become familiar with it, and how you can adapt it for your own use-case.',V,G,N="Before running the script, make sure you install the library from source:",E,R,X,k,z="Then navigate to the example folder containing the training script and install the required dependencies for the script you’re using:",p,U,Be,Y,He,A,Yt="Initialize an 🤗 Accelerate environment:",Le,F,Ve,S,Bt="To setup a default 🤗 Accelerate environment without choosing any configurations:",Ee,P,ze,Q,Ht="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",Ae,q,Fe,D,Lt='Lastly, if you want to train a model on your own dataset, take a look at the <a href="create_dataset">Create a dataset for training</a> guide to learn how to create a dataset that works with the training script.',Se,B,Pe,O,Qe,K,Vt='The training script provides many parameters to help you customize your training run. All of the parameters and their descriptions are found in the <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/controlnet/train_controlnet.py#L231" rel="nofollow"><code>parse_args()</code></a> function. This function provides default values for each parameter, such as the training batch size and learning rate, but you can also set your own values in the training command if you’d like.',qe,ee,Et="For example, to speedup training with mixed precision using the fp16 format, add the <code>--mixed_precision</code> parameter to the training command:",De,te,Oe,ne,zt='Many of the basic and important parameters are described in the <a href="text2image#script-parameters">Text-to-image</a> training guide, so this guide just focuses on the relevant parameters for ControlNet:',Ke,le,At="<li><code>--max_train_samples</code>: the number of training samples; this can be lowered for faster training, but if you want to stream really large datasets, you’ll need to include this parameter and the <code>--streaming</code> parameter in your training command</li> <li><code>--gradient_accumulation_steps</code>: number of update steps to accumulate before the backward pass; this allows you to train with a bigger batch size than your GPU memory can typically handle</li>",et,ie,tt,ae,Ft='The <a href="https://huggingface.co/papers/2303.09556" rel="nofollow">Min-SNR</a> weighting strategy can help with training by rebalancing the loss to achieve faster convergence. The training script supports predicting <code>epsilon</code> (noise) or <code>v_prediction</code>, but Min-SNR is compatible with both prediction types. This weighting strategy is only supported by PyTorch.',nt,oe,St="Add the <code>--snr_gamma</code> parameter and set it to the recommended value of 5.0:",lt,se,it,re,at,pe,Pt='As with the script parameters, a general walkthrough of the training script is provided in the <a href="text2image#training-script">Text-to-image</a> training guide. Instead, this guide takes a look at the relevant parts of the ControlNet script.',ot,me,Qt='The training script has a <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/controlnet/train_controlnet.py#L582" rel="nofollow"><code>make_train_dataset</code></a> function for preprocessing the dataset with image transforms and caption tokenization. You’ll see that in addition to the usual caption tokenization and image transforms, the script also includes transforms for the conditioning image.',st,H,rt,fe,pt,ue,qt='Within the <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/controlnet/train_controlnet.py#L713" rel="nofollow"><code>main()</code></a> function, you’ll find the code for loading the tokenizer, text encoder, scheduler and models. This is also where the ControlNet model is loaded either from existing weights or randomly initialized from a UNet:',mt,de,ft,ce,Dt='The <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/controlnet/train_controlnet.py#L871" rel="nofollow">optimizer</a> is set up to update the ControlNet parameters:',ut,he,dt,be,Ot='Finally, in the <a href="https://github.com/huggingface/diffusers/blob/64603389da01082055a901f2883c4810d1144edb/examples/controlnet/train_controlnet.py#L943" rel="nofollow">training loop</a>, the conditioning text embeddings and image are passed to the down and mid-blocks of the ControlNet model:',ct,ge,ht,Me,Kt='If you want to learn more about how the training loop works, check out the <a href="../using-diffusers/write_own_pipeline">Understanding pipelines, models and schedulers</a> tutorial which breaks down the basic pattern of the denoising process.',bt,we,gt,ye,en="Now you’re ready to launch the training script! 🚀",Mt,$e,tn='This guide uses the <a href="https://huggingface.co/datasets/fusing/fill50k" rel="nofollow">fusing/fill50k</a> dataset, but remember, you can create and use your own dataset if you want (see the <a href="create_dataset">Create a dataset for training</a> guide).',wt,Te,nn="Set the environment variable <code>MODEL_NAME</code> to a model id on the Hub or a path to a local model and <code>OUTPUT_DIR</code> to where you want to save the model.",yt,Je,ln="Download the following images to condition your training with:",$t,_e,Tt,Ze,an="One more thing before you launch the script! Depending on the GPU you have, you may need to enable certain optimizations to train a ControlNet. The default configuration in this script requires ~38GB of vRAM. If you’re training on more than one GPU, add the <code>--multi_gpu</code> parameter to the <code>accelerate launch</code> command.",Jt,L,_t,Ue,Zt,ve,on="Once training is complete, you can use your newly trained model for inference!",Ut,je,vt,xe,jt,We,sn='Stable Diffusion XL (SDXL) is a powerful text-to-image model that generates high-resolution images, and it adds a second text-encoder to its architecture. Use the <a href="https://github.com/huggingface/diffusers/blob/main/examples/controlnet/train_controlnet_sdxl.py" rel="nofollow"><code>train_controlnet_sdxl.py</code></a> script to train a ControlNet adapter for the SDXL model.',xt,Ce,rn='The SDXL training script is discussed in more detail in the <a href="sdxl">SDXL training</a> guide.',Wt,Ge,Ct,Re,pn="Congratulations on training your own ControlNet! To learn more about how to use your new model, the following guides may be helpful:",Gt,Xe,mn='<li>Learn how to <a href="../using-diffusers/controlnet">use a ControlNet</a> for inference on a variety of tasks.</li>',Rt,Ie,Xt,Ye,It;return T=new Ne({props:{title:"ControlNet",local:"controlnet",headingTag:"h1"}}),R=new j({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install .`,wrap:!1}}),U=new j({props:{code:"Y2QlMjBleGFtcGxlcyUyRmNvbnRyb2xuZXQlMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/controlnet
pip install -r requirements.txt`,wrap:!1}}),Y=new Nt({props:{$$slots:{default:[Zn]},$$scope:{ctx:W}}}),F=new j({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),P=new j({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),q=new j({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`<span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> write_basic_config

write_basic_config()`,wrap:!1}}),B=new Nt({props:{$$slots:{default:[Un]},$$scope:{ctx:W}}}),O=new Ne({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),te=new j({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjI=",highlighted:`accelerate launch train_controlnet.py \\
  --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span>`,wrap:!1}}),ie=new Ne({props:{title:"Min-SNR weighting",local:"min-snr-weighting",headingTag:"h3"}}),se=new j({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_controlnet.py \\
  --snr_gamma=5.0`,wrap:!1}}),re=new Ne({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),H=new Nt({props:{$$slots:{default:[vn]},$$scope:{ctx:W}}}),fe=new j({props:{code:"Y29uZGl0aW9uaW5nX2ltYWdlX3RyYW5zZm9ybXMlMjAlM0QlMjB0cmFuc2Zvcm1zLkNvbXBvc2UoJTBBJTIwJTIwJTIwJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdHJhbnNmb3Jtcy5SZXNpemUoYXJncy5yZXNvbHV0aW9uJTJDJTIwaW50ZXJwb2xhdGlvbiUzRHRyYW5zZm9ybXMuSW50ZXJwb2xhdGlvbk1vZGUuQklMSU5FQVIpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdHJhbnNmb3Jtcy5DZW50ZXJDcm9wKGFyZ3MucmVzb2x1dGlvbiklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cmFuc2Zvcm1zLlRvVGVuc29yKCklMkMlMEElMjAlMjAlMjAlMjAlNUQlMEEp",highlighted:`conditioning_image_transforms = transforms.Compose(
    [
        transforms.Resize(args.resolution, interpolation=transforms.InterpolationMode.BILINEAR),
        transforms.CenterCrop(args.resolution),
        transforms.ToTensor(),
    ]
)`,wrap:!1}}),de=new j({props:{code:"aWYlMjBhcmdzLmNvbnRyb2xuZXRfbW9kZWxfbmFtZV9vcl9wYXRoJTNBJTBBJTIwJTIwJTIwJTIwbG9nZ2VyLmluZm8oJTIyTG9hZGluZyUyMGV4aXN0aW5nJTIwY29udHJvbG5ldCUyMHdlaWdodHMlMjIpJTBBJTIwJTIwJTIwJTIwY29udHJvbG5ldCUyMCUzRCUyMENvbnRyb2xOZXRNb2RlbC5mcm9tX3ByZXRyYWluZWQoYXJncy5jb250cm9sbmV0X21vZGVsX25hbWVfb3JfcGF0aCklMEFlbHNlJTNBJTBBJTIwJTIwJTIwJTIwbG9nZ2VyLmluZm8oJTIySW5pdGlhbGl6aW5nJTIwY29udHJvbG5ldCUyMHdlaWdodHMlMjBmcm9tJTIwdW5ldCUyMiklMEElMjAlMjAlMjAlMjBjb250cm9sbmV0JTIwJTNEJTIwQ29udHJvbE5ldE1vZGVsLmZyb21fdW5ldCh1bmV0KQ==",highlighted:`<span class="hljs-keyword">if</span> args.controlnet_model_name_or_path:
    logger.info(<span class="hljs-string">&quot;Loading existing controlnet weights&quot;</span>)
    controlnet = ControlNetModel.from_pretrained(args.controlnet_model_name_or_path)
<span class="hljs-keyword">else</span>:
    logger.info(<span class="hljs-string">&quot;Initializing controlnet weights from unet&quot;</span>)
    controlnet = ControlNetModel.from_unet(unet)`,wrap:!1}}),he=new j({props:{code:"cGFyYW1zX3RvX29wdGltaXplJTIwJTNEJTIwY29udHJvbG5ldC5wYXJhbWV0ZXJzKCklMEFvcHRpbWl6ZXIlMjAlM0QlMjBvcHRpbWl6ZXJfY2xhc3MoJTBBJTIwJTIwJTIwJTIwcGFyYW1zX3RvX29wdGltaXplJTJDJTBBJTIwJTIwJTIwJTIwbHIlM0RhcmdzLmxlYXJuaW5nX3JhdGUlMkMlMEElMjAlMjAlMjAlMjBiZXRhcyUzRChhcmdzLmFkYW1fYmV0YTElMkMlMjBhcmdzLmFkYW1fYmV0YTIpJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X2RlY2F5JTNEYXJncy5hZGFtX3dlaWdodF9kZWNheSUyQyUwQSUyMCUyMCUyMCUyMGVwcyUzRGFyZ3MuYWRhbV9lcHNpbG9uJTJDJTBBKQ==",highlighted:`params_to_optimize = controlnet.parameters()
optimizer = optimizer_class(
    params_to_optimize,
    lr=args.learning_rate,
    betas=(args.adam_beta1, args.adam_beta2),
    weight_decay=args.adam_weight_decay,
    eps=args.adam_epsilon,
)`,wrap:!1}}),ge=new j({props:{code:"ZW5jb2Rlcl9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwdGV4dF9lbmNvZGVyKGJhdGNoJTVCJTIyaW5wdXRfaWRzJTIyJTVEKSU1QjAlNUQlMEFjb250cm9sbmV0X2ltYWdlJTIwJTNEJTIwYmF0Y2glNUIlMjJjb25kaXRpb25pbmdfcGl4ZWxfdmFsdWVzJTIyJTVELnRvKGR0eXBlJTNEd2VpZ2h0X2R0eXBlKSUwQSUwQWRvd25fYmxvY2tfcmVzX3NhbXBsZXMlMkMlMjBtaWRfYmxvY2tfcmVzX3NhbXBsZSUyMCUzRCUyMGNvbnRyb2xuZXQoJTBBJTIwJTIwJTIwJTIwbm9pc3lfbGF0ZW50cyUyQyUwQSUyMCUyMCUyMCUyMHRpbWVzdGVwcyUyQyUwQSUyMCUyMCUyMCUyMGVuY29kZXJfaGlkZGVuX3N0YXRlcyUzRGVuY29kZXJfaGlkZGVuX3N0YXRlcyUyQyUwQSUyMCUyMCUyMCUyMGNvbnRyb2xuZXRfY29uZCUzRGNvbnRyb2xuZXRfaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fZGljdCUzREZhbHNlJTJDJTBBKQ==",highlighted:`encoder_hidden_states = text_encoder(batch[<span class="hljs-string">&quot;input_ids&quot;</span>])[<span class="hljs-number">0</span>]
controlnet_image = batch[<span class="hljs-string">&quot;conditioning_pixel_values&quot;</span>].to(dtype=weight_dtype)

down_block_res_samples, mid_block_res_sample = controlnet(
    noisy_latents,
    timesteps,
    encoder_hidden_states=encoder_hidden_states,
    controlnet_cond=controlnet_image,
    return_dict=<span class="hljs-literal">False</span>,
)`,wrap:!1}}),we=new Ne({props:{title:"Launch the script",local:"launch-the-script",headingTag:"h2"}}),_e=new j({props:{code:"d2dldCUyMGh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmRpZmZ1c2VycyUyRmNvbnRyb2xuZXRfdHJhaW5pbmclMkZjb25kaXRpb25pbmdfaW1hZ2VfMS5wbmclMEF3Z2V0JTIwaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGZGlmZnVzZXJzJTJGY29udHJvbG5ldF90cmFpbmluZyUyRmNvbmRpdGlvbmluZ19pbWFnZV8yLnBuZw==",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`,wrap:!1}}),L=new _n({props:{id:"gpu-select",options:["16GB","12GB","8GB"],$$slots:{default:[Cn]},$$scope:{ctx:W}}}),Ue=new j({props:{code:"ZXhwb3J0JTIwTU9ERUxfRElSJTNEJTIyc3RhYmxlLWRpZmZ1c2lvbi12MS01JTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwT1VUUFVUX0RJUiUzRCUyMnBhdGglMkZ0byUyRnNhdmUlMkZtb2RlbCUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjB0cmFpbl9jb250cm9sbmV0LnB5JTIwJTVDJTBBJTIwLS1wcmV0cmFpbmVkX21vZGVsX25hbWVfb3JfcGF0aCUzRCUyNE1PREVMX0RJUiUyMCU1QyUwQSUyMC0tb3V0cHV0X2RpciUzRCUyNE9VVFBVVF9ESVIlMjAlNUMlMEElMjAtLWRhdGFzZXRfbmFtZSUzRGZ1c2luZyUyRmZpbGw1MGslMjAlNUMlMEElMjAtLXJlc29sdXRpb24lM0Q1MTIlMjAlNUMlMEElMjAtLWxlYXJuaW5nX3JhdGUlM0QxZS01JTIwJTVDJTBBJTIwLS12YWxpZGF0aW9uX2ltYWdlJTIwJTIyLiUyRmNvbmRpdGlvbmluZ19pbWFnZV8xLnBuZyUyMiUyMCUyMi4lMkZjb25kaXRpb25pbmdfaW1hZ2VfMi5wbmclMjIlMjAlNUMlMEElMjAtLXZhbGlkYXRpb25fcHJvbXB0JTIwJTIycmVkJTIwY2lyY2xlJTIwd2l0aCUyMGJsdWUlMjBiYWNrZ3JvdW5kJTIyJTIwJTIyY3lhbiUyMGNpcmNsZSUyMHdpdGglMjBicm93biUyMGZsb3JhbCUyMGJhY2tncm91bmQlMjIlMjAlNUMlMEElMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTIwJTVDJTBBJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`<span class="hljs-built_in">export</span> MODEL_DIR=<span class="hljs-string">&quot;stable-diffusion-v1-5/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`,wrap:!1}}),je=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkNvbnRyb2xOZXRQaXBlbGluZSUyQyUyMENvbnRyb2xOZXRNb2RlbCUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBaW1wb3J0JTIwdG9yY2glMEElMEFjb250cm9sbmV0JTIwJTNEJTIwQ29udHJvbE5ldE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJwYXRoJTJGdG8lMkZjb250cm9sbmV0JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uQ29udHJvbE5ldFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJwYXRoJTJGdG8lMkZiYXNlJTJGbW9kZWwlMjIlMkMlMjBjb250cm9sbmV0JTNEY29udHJvbG5ldCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFjb250cm9sX2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSglMjIuJTJGY29uZGl0aW9uaW5nX2ltYWdlXzEucG5nJTIyKSUwQXByb21wdCUyMCUzRCUyMCUyMnBhbGUlMjBnb2xkZW4lMjByb2QlMjBjaXJjbGUlMjB3aXRoJTIwb2xkJTIwbGFjZSUyMGJhY2tncm91bmQlMjIlMEElMEFnZW5lcmF0b3IlMjAlM0QlMjB0b3JjaC5tYW51YWxfc2VlZCgwKSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDIwJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTIwaW1hZ2UlM0Rjb250cm9sX2ltYWdlKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjIuJTJGb3V0cHV0LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionControlNetPipeline, ControlNetModel
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

controlnet = ControlNetModel.from_pretrained(<span class="hljs-string">&quot;path/to/controlnet&quot;</span>, torch_dtype=torch.float16)
pipeline = StableDiffusionControlNetPipeline.from_pretrained(
    <span class="hljs-string">&quot;path/to/base/model&quot;</span>, controlnet=controlnet, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

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>

generator = torch.manual_seed(<span class="hljs-number">0</span>)
image = pipeline(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>)`,wrap:!1}}),xe=new Ne({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),Ge=new Ne({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),Ie=new Jn({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/training/controlnet.md"}}),{c(){o=m("meta"),J=i(),r=m("p"),d=i(),b(T.$$.fragment),c=i(),s=m("p"),s.innerHTML=_,Z=i(),x=m("p"),x.innerHTML=h,v=i(),C=m("p"),C.innerHTML=I,V=i(),G=m("p"),G.textContent=N,E=i(),b(R.$$.fragment),X=i(),k=m("p"),k.textContent=z,p=i(),b(U.$$.fragment),Be=i(),b(Y.$$.fragment),He=i(),A=m("p"),A.textContent=Yt,Le=i(),b(F.$$.fragment),Ve=i(),S=m("p"),S.textContent=Bt,Ee=i(),b(P.$$.fragment),ze=i(),Q=m("p"),Q.textContent=Ht,Ae=i(),b(q.$$.fragment),Fe=i(),D=m("p"),D.innerHTML=Lt,Se=i(),b(B.$$.fragment),Pe=i(),b(O.$$.fragment),Qe=i(),K=m("p"),K.innerHTML=Vt,qe=i(),ee=m("p"),ee.innerHTML=Et,De=i(),b(te.$$.fragment),Oe=i(),ne=m("p"),ne.innerHTML=zt,Ke=i(),le=m("ul"),le.innerHTML=At,et=i(),b(ie.$$.fragment),tt=i(),ae=m("p"),ae.innerHTML=Ft,nt=i(),oe=m("p"),oe.innerHTML=St,lt=i(),b(se.$$.fragment),it=i(),b(re.$$.fragment),at=i(),pe=m("p"),pe.innerHTML=Pt,ot=i(),me=m("p"),me.innerHTML=Qt,st=i(),b(H.$$.fragment),rt=i(),b(fe.$$.fragment),pt=i(),ue=m("p"),ue.innerHTML=qt,mt=i(),b(de.$$.fragment),ft=i(),ce=m("p"),ce.innerHTML=Dt,ut=i(),b(he.$$.fragment),dt=i(),be=m("p"),be.innerHTML=Ot,ct=i(),b(ge.$$.fragment),ht=i(),Me=m("p"),Me.innerHTML=Kt,bt=i(),b(we.$$.fragment),gt=i(),ye=m("p"),ye.textContent=en,Mt=i(),$e=m("p"),$e.innerHTML=tn,wt=i(),Te=m("p"),Te.innerHTML=nn,yt=i(),Je=m("p"),Je.textContent=ln,$t=i(),b(_e.$$.fragment),Tt=i(),Ze=m("p"),Ze.innerHTML=an,Jt=i(),b(L.$$.fragment),_t=i(),b(Ue.$$.fragment),Zt=i(),ve=m("p"),ve.textContent=on,Ut=i(),b(je.$$.fragment),vt=i(),b(xe.$$.fragment),jt=i(),We=m("p"),We.innerHTML=sn,xt=i(),Ce=m("p"),Ce.innerHTML=rn,Wt=i(),b(Ge.$$.fragment),Ct=i(),Re=m("p"),Re.textContent=pn,Gt=i(),Xe=m("ul"),Xe.innerHTML=mn,Rt=i(),b(Ie.$$.fragment),Xt=i(),Ye=m("p"),this.h()},l(e){const t=$n("svelte-u9bgzb",document.head);o=f(t,"META",{name:!0,content:!0}),t.forEach(n),J=a(e),r=f(e,"P",{}),hn(r).forEach(n),d=a(e),g(T.$$.fragment,e),c=a(e),s=f(e,"P",{"data-svelte-h":!0}),u(s)!=="svelte-q2o66i"&&(s.innerHTML=_),Z=a(e),x=f(e,"P",{"data-svelte-h":!0}),u(x)!=="svelte-nx8a15"&&(x.innerHTML=h),v=a(e),C=f(e,"P",{"data-svelte-h":!0}),u(C)!=="svelte-sp8ken"&&(C.innerHTML=I),V=a(e),G=f(e,"P",{"data-svelte-h":!0}),u(G)!=="svelte-l7dm2q"&&(G.textContent=N),E=a(e),g(R.$$.fragment,e),X=a(e),k=f(e,"P",{"data-svelte-h":!0}),u(k)!=="svelte-z4z0b9"&&(k.textContent=z),p=a(e),g(U.$$.fragment,e),Be=a(e),g(Y.$$.fragment,e),He=a(e),A=f(e,"P",{"data-svelte-h":!0}),u(A)!=="svelte-60q53m"&&(A.textContent=Yt),Le=a(e),g(F.$$.fragment,e),Ve=a(e),S=f(e,"P",{"data-svelte-h":!0}),u(S)!=="svelte-di6juu"&&(S.textContent=Bt),Ee=a(e),g(P.$$.fragment,e),ze=a(e),Q=f(e,"P",{"data-svelte-h":!0}),u(Q)!=="svelte-tsz4qp"&&(Q.textContent=Ht),Ae=a(e),g(q.$$.fragment,e),Fe=a(e),D=f(e,"P",{"data-svelte-h":!0}),u(D)!=="svelte-1fkfdql"&&(D.innerHTML=Lt),Se=a(e),g(B.$$.fragment,e),Pe=a(e),g(O.$$.fragment,e),Qe=a(e),K=f(e,"P",{"data-svelte-h":!0}),u(K)!=="svelte-bw2u91"&&(K.innerHTML=Vt),qe=a(e),ee=f(e,"P",{"data-svelte-h":!0}),u(ee)!=="svelte-1r0bv1x"&&(ee.innerHTML=Et),De=a(e),g(te.$$.fragment,e),Oe=a(e),ne=f(e,"P",{"data-svelte-h":!0}),u(ne)!=="svelte-1s0tjh8"&&(ne.innerHTML=zt),Ke=a(e),le=f(e,"UL",{"data-svelte-h":!0}),u(le)!=="svelte-9wifrj"&&(le.innerHTML=At),et=a(e),g(ie.$$.fragment,e),tt=a(e),ae=f(e,"P",{"data-svelte-h":!0}),u(ae)!=="svelte-1x34p4w"&&(ae.innerHTML=Ft),nt=a(e),oe=f(e,"P",{"data-svelte-h":!0}),u(oe)!=="svelte-tp3kp"&&(oe.innerHTML=St),lt=a(e),g(se.$$.fragment,e),it=a(e),g(re.$$.fragment,e),at=a(e),pe=f(e,"P",{"data-svelte-h":!0}),u(pe)!=="svelte-1ca6n8s"&&(pe.innerHTML=Pt),ot=a(e),me=f(e,"P",{"data-svelte-h":!0}),u(me)!=="svelte-yhtkem"&&(me.innerHTML=Qt),st=a(e),g(H.$$.fragment,e),rt=a(e),g(fe.$$.fragment,e),pt=a(e),ue=f(e,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-1t15wny"&&(ue.innerHTML=qt),mt=a(e),g(de.$$.fragment,e),ft=a(e),ce=f(e,"P",{"data-svelte-h":!0}),u(ce)!=="svelte-1rtudr1"&&(ce.innerHTML=Dt),ut=a(e),g(he.$$.fragment,e),dt=a(e),be=f(e,"P",{"data-svelte-h":!0}),u(be)!=="svelte-ane16q"&&(be.innerHTML=Ot),ct=a(e),g(ge.$$.fragment,e),ht=a(e),Me=f(e,"P",{"data-svelte-h":!0}),u(Me)!=="svelte-6gmbd2"&&(Me.innerHTML=Kt),bt=a(e),g(we.$$.fragment,e),gt=a(e),ye=f(e,"P",{"data-svelte-h":!0}),u(ye)!=="svelte-rsq2yy"&&(ye.textContent=en),Mt=a(e),$e=f(e,"P",{"data-svelte-h":!0}),u($e)!=="svelte-87boqf"&&($e.innerHTML=tn),wt=a(e),Te=f(e,"P",{"data-svelte-h":!0}),u(Te)!=="svelte-11t01x0"&&(Te.innerHTML=nn),yt=a(e),Je=f(e,"P",{"data-svelte-h":!0}),u(Je)!=="svelte-1uo0m2d"&&(Je.textContent=ln),$t=a(e),g(_e.$$.fragment,e),Tt=a(e),Ze=f(e,"P",{"data-svelte-h":!0}),u(Ze)!=="svelte-1wlzzvk"&&(Ze.innerHTML=an),Jt=a(e),g(L.$$.fragment,e),_t=a(e),g(Ue.$$.fragment,e),Zt=a(e),ve=f(e,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-1x6in5t"&&(ve.textContent=on),Ut=a(e),g(je.$$.fragment,e),vt=a(e),g(xe.$$.fragment,e),jt=a(e),We=f(e,"P",{"data-svelte-h":!0}),u(We)!=="svelte-t1l7wa"&&(We.innerHTML=sn),xt=a(e),Ce=f(e,"P",{"data-svelte-h":!0}),u(Ce)!=="svelte-6dxtva"&&(Ce.innerHTML=rn),Wt=a(e),g(Ge.$$.fragment,e),Ct=a(e),Re=f(e,"P",{"data-svelte-h":!0}),u(Re)!=="svelte-s6fbj8"&&(Re.textContent=pn),Gt=a(e),Xe=f(e,"UL",{"data-svelte-h":!0}),u(Xe)!=="svelte-jinr48"&&(Xe.innerHTML=mn),Rt=a(e),g(Ie.$$.fragment,e),Xt=a(e),Ye=f(e,"P",{}),hn(Ye).forEach(n),this.h()},h(){bn(o,"name","hf:doc:metadata"),bn(o,"content",Rn)},m(e,t){Tn(document.head,o),l(e,J,t),l(e,r,t),l(e,d,t),M(T,e,t),l(e,c,t),l(e,s,t),l(e,Z,t),l(e,x,t),l(e,v,t),l(e,C,t),l(e,V,t),l(e,G,t),l(e,E,t),M(R,e,t),l(e,X,t),l(e,k,t),l(e,p,t),M(U,e,t),l(e,Be,t),M(Y,e,t),l(e,He,t),l(e,A,t),l(e,Le,t),M(F,e,t),l(e,Ve,t),l(e,S,t),l(e,Ee,t),M(P,e,t),l(e,ze,t),l(e,Q,t),l(e,Ae,t),M(q,e,t),l(e,Fe,t),l(e,D,t),l(e,Se,t),M(B,e,t),l(e,Pe,t),M(O,e,t),l(e,Qe,t),l(e,K,t),l(e,qe,t),l(e,ee,t),l(e,De,t),M(te,e,t),l(e,Oe,t),l(e,ne,t),l(e,Ke,t),l(e,le,t),l(e,et,t),M(ie,e,t),l(e,tt,t),l(e,ae,t),l(e,nt,t),l(e,oe,t),l(e,lt,t),M(se,e,t),l(e,it,t),M(re,e,t),l(e,at,t),l(e,pe,t),l(e,ot,t),l(e,me,t),l(e,st,t),M(H,e,t),l(e,rt,t),M(fe,e,t),l(e,pt,t),l(e,ue,t),l(e,mt,t),M(de,e,t),l(e,ft,t),l(e,ce,t),l(e,ut,t),M(he,e,t),l(e,dt,t),l(e,be,t),l(e,ct,t),M(ge,e,t),l(e,ht,t),l(e,Me,t),l(e,bt,t),M(we,e,t),l(e,gt,t),l(e,ye,t),l(e,Mt,t),l(e,$e,t),l(e,wt,t),l(e,Te,t),l(e,yt,t),l(e,Je,t),l(e,$t,t),M(_e,e,t),l(e,Tt,t),l(e,Ze,t),l(e,Jt,t),M(L,e,t),l(e,_t,t),M(Ue,e,t),l(e,Zt,t),l(e,ve,t),l(e,Ut,t),M(je,e,t),l(e,vt,t),M(xe,e,t),l(e,jt,t),l(e,We,t),l(e,xt,t),l(e,Ce,t),l(e,Wt,t),M(Ge,e,t),l(e,Ct,t),l(e,Re,t),l(e,Gt,t),l(e,Xe,t),l(e,Rt,t),M(Ie,e,t),l(e,Xt,t),l(e,Ye,t),It=!0},p(e,[t]){const fn={};t&2&&(fn.$$scope={dirty:t,ctx:e}),Y.$set(fn);const un={};t&2&&(un.$$scope={dirty:t,ctx:e}),B.$set(un);const dn={};t&2&&(dn.$$scope={dirty:t,ctx:e}),H.$set(dn);const cn={};t&2&&(cn.$$scope={dirty:t,ctx:e}),L.$set(cn)},i(e){It||(w(T.$$.fragment,e),w(R.$$.fragment,e),w(U.$$.fragment,e),w(Y.$$.fragment,e),w(F.$$.fragment,e),w(P.$$.fragment,e),w(q.$$.fragment,e),w(B.$$.fragment,e),w(O.$$.fragment,e),w(te.$$.fragment,e),w(ie.$$.fragment,e),w(se.$$.fragment,e),w(re.$$.fragment,e),w(H.$$.fragment,e),w(fe.$$.fragment,e),w(de.$$.fragment,e),w(he.$$.fragment,e),w(ge.$$.fragment,e),w(we.$$.fragment,e),w(_e.$$.fragment,e),w(L.$$.fragment,e),w(Ue.$$.fragment,e),w(je.$$.fragment,e),w(xe.$$.fragment,e),w(Ge.$$.fragment,e),w(Ie.$$.fragment,e),It=!0)},o(e){y(T.$$.fragment,e),y(R.$$.fragment,e),y(U.$$.fragment,e),y(Y.$$.fragment,e),y(F.$$.fragment,e),y(P.$$.fragment,e),y(q.$$.fragment,e),y(B.$$.fragment,e),y(O.$$.fragment,e),y(te.$$.fragment,e),y(ie.$$.fragment,e),y(se.$$.fragment,e),y(re.$$.fragment,e),y(H.$$.fragment,e),y(fe.$$.fragment,e),y(de.$$.fragment,e),y(he.$$.fragment,e),y(ge.$$.fragment,e),y(we.$$.fragment,e),y(_e.$$.fragment,e),y(L.$$.fragment,e),y(Ue.$$.fragment,e),y(je.$$.fragment,e),y(xe.$$.fragment,e),y(Ge.$$.fragment,e),y(Ie.$$.fragment,e),It=!1},d(e){e&&(n(J),n(r),n(d),n(c),n(s),n(Z),n(x),n(v),n(C),n(V),n(G),n(E),n(X),n(k),n(p),n(Be),n(He),n(A),n(Le),n(Ve),n(S),n(Ee),n(ze),n(Q),n(Ae),n(Fe),n(D),n(Se),n(Pe),n(Qe),n(K),n(qe),n(ee),n(De),n(Oe),n(ne),n(Ke),n(le),n(et),n(tt),n(ae),n(nt),n(oe),n(lt),n(it),n(at),n(pe),n(ot),n(me),n(st),n(rt),n(pt),n(ue),n(mt),n(ft),n(ce),n(ut),n(dt),n(be),n(ct),n(ht),n(Me),n(bt),n(gt),n(ye),n(Mt),n($e),n(wt),n(Te),n(yt),n(Je),n($t),n(Tt),n(Ze),n(Jt),n(_t),n(Zt),n(ve),n(Ut),n(vt),n(jt),n(We),n(xt),n(Ce),n(Wt),n(Ct),n(Re),n(Gt),n(Xe),n(Rt),n(Xt),n(Ye)),n(o),$(T,e),$(R,e),$(U,e),$(Y,e),$(F,e),$(P,e),$(q,e),$(B,e),$(O,e),$(te,e),$(ie,e),$(se,e),$(re,e),$(H,e),$(fe,e),$(de,e),$(he,e),$(ge,e),$(we,e),$(_e,e),$(L,e),$(Ue,e),$(je,e),$(xe,e),$(Ge,e),$(Ie,e)}}}const Rn='{"title":"ControlNet","local":"controlnet","sections":[{"title":"Script parameters","local":"script-parameters","sections":[{"title":"Min-SNR weighting","local":"min-snr-weighting","sections":[],"depth":3}],"depth":2},{"title":"Training script","local":"training-script","sections":[],"depth":2},{"title":"Launch the script","local":"launch-the-script","sections":[],"depth":2},{"title":"Stable Diffusion XL","local":"stable-diffusion-xl","sections":[],"depth":2},{"title":"Next steps","local":"next-steps","sections":[],"depth":2}],"depth":1}';function Xn(W){return Mn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ln extends wn{constructor(o){super(),yn(this,o,Xn,Gn,gn,{})}}export{Ln as component};
