import{s as gl,o as Ml,n as Yt}from"../chunks/scheduler.53228c21.js";import{S as yl,i as wl,e as r,s as i,c as h,h as Tl,a as p,d as l,b as a,f as bl,g as b,j as m,k as Ye,l as Jl,m as n,n as g,t as M,o as y,p as w}from"../chunks/index.100fac89.js";import{C as $l}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{C as U}from"../chunks/CodeBlock.d30a6509.js";import{H as Ne,E as _l}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";import{H as Zl,a as Bt}from"../chunks/HfOption.fad27e59.js";function Ul(R){let f,v="On a 16GB GPU, you can use bitsandbytes 8-bit optimizer and gradient checkpointing to optimize your training run. Install bitsandbytes:",T,c,J,d,o="Then, add the following parameter to your training command:",$,_,x;return c=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGJpdHNhbmRieXRlcw==",highlighted:"pip install bitsandbytes",wrap:!1}}),_=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLXVzZV84Yml0X2FkYW0lMjAlNUM=",highlighted:`accelerate launch train_controlnet.py \\
  --gradient_checkpointing \\
  --use_8bit_adam \\`,wrap:!1}}),{c(){f=r("p"),f.textContent=v,T=i(),h(c.$$.fragment),J=i(),d=r("p"),d.textContent=o,$=i(),h(_.$$.fragment)},l(u){f=p(u,"P",{"data-svelte-h":!0}),m(f)!=="svelte-izoj73"&&(f.textContent=v),T=a(u),b(c.$$.fragment,u),J=a(u),d=p(u,"P",{"data-svelte-h":!0}),m(d)!=="svelte-1rkm1uq"&&(d.textContent=o),$=a(u),b(_.$$.fragment,u)},m(u,Z){n(u,f,Z),n(u,T,Z),g(c,u,Z),n(u,J,Z),n(u,d,Z),n(u,$,Z),g(_,u,Z),x=!0},p:Yt,i(u){x||(M(c.$$.fragment,u),M(_.$$.fragment,u),x=!0)},o(u){y(c.$$.fragment,u),y(_.$$.fragment,u),x=!1},d(u){u&&(l(f),l(T),l(J),l(d),l($)),w(c,u),w(_,u)}}}function vl(R){let f,v="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.",T,c,J;return c=new U({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(){f=r("p"),f.innerHTML=v,T=i(),h(c.$$.fragment)},l(d){f=p(d,"P",{"data-svelte-h":!0}),m(f)!=="svelte-13zq302"&&(f.innerHTML=v),T=a(d),b(c.$$.fragment,d)},m(d,o){n(d,f,o),n(d,T,o),g(c,d,o),J=!0},p:Yt,i(d){J||(M(c.$$.fragment,d),J=!0)},o(d){y(c.$$.fragment,d),J=!1},d(d){d&&(l(f),l(T)),w(c,d)}}}function jl(R){let f,v='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.',T,c,J="Run the following command to configure your 🤗 Accelerate environment:",d,o,$,_,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:',u,Z,V,C,X='You should also change the default Adam optimizer to DeepSpeed’s optimized version of Adam <a href="https://deepspeed.readthedocs.io/en/latest/optimizers.html#adam-cpu" rel="nofollow"><code>deepspeed.ops.adam.DeepSpeedCPUAdam</code></a> for a substantial speedup. Enabling <code>DeepSpeedCPUAdam</code> requires your system’s CUDA toolchain version to be the same as the one installed with PyTorch.',E,W,I="bitsandbytes 8-bit optimizers don’t seem to be compatible with DeepSpeed at the moment.",z,G,k="That’s it! You don’t need to add any additional parameters to your training command.",N;return o=new U({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Z=new U({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(){f=r("p"),f.innerHTML=v,T=i(),c=r("p"),c.textContent=J,d=i(),h(o.$$.fragment),$=i(),_=r("p"),_.innerHTML=x,u=i(),h(Z.$$.fragment),V=i(),C=r("p"),C.innerHTML=X,E=i(),W=r("p"),W.textContent=I,z=i(),G=r("p"),G.textContent=k},l(s){f=p(s,"P",{"data-svelte-h":!0}),m(f)!=="svelte-1tq9cba"&&(f.innerHTML=v),T=a(s),c=p(s,"P",{"data-svelte-h":!0}),m(c)!=="svelte-1fx999v"&&(c.textContent=J),d=a(s),b(o.$$.fragment,s),$=a(s),_=p(s,"P",{"data-svelte-h":!0}),m(_)!=="svelte-184kffk"&&(_.innerHTML=x),u=a(s),b(Z.$$.fragment,s),V=a(s),C=p(s,"P",{"data-svelte-h":!0}),m(C)!=="svelte-14m6rf5"&&(C.innerHTML=X),E=a(s),W=p(s,"P",{"data-svelte-h":!0}),m(W)!=="svelte-z8cdsf"&&(W.textContent=I),z=a(s),G=p(s,"P",{"data-svelte-h":!0}),m(G)!=="svelte-lwtx0u"&&(G.textContent=k)},m(s,j){n(s,f,j),n(s,T,j),n(s,c,j),n(s,d,j),g(o,s,j),n(s,$,j),n(s,_,j),n(s,u,j),g(Z,s,j),n(s,V,j),n(s,C,j),n(s,E,j),n(s,W,j),n(s,z,j),n(s,G,j),N=!0},p:Yt,i(s){N||(M(o.$$.fragment,s),M(Z.$$.fragment,s),N=!0)},o(s){y(o.$$.fragment,s),y(Z.$$.fragment,s),N=!1},d(s){s&&(l(f),l(T),l(c),l(d),l($),l(_),l(u),l(V),l(C),l(E),l(W),l(z),l(G)),w(o,s),w(Z,s)}}}function xl(R){let f,v,T,c,J,d;return f=new Bt({props:{id:"gpu-select",option:"16GB",$$slots:{default:[Ul]},$$scope:{ctx:R}}}),T=new Bt({props:{id:"gpu-select",option:"12GB",$$slots:{default:[vl]},$$scope:{ctx:R}}}),J=new Bt({props:{id:"gpu-select",option:"8GB",$$slots:{default:[jl]},$$scope:{ctx:R}}}),{c(){h(f.$$.fragment),v=i(),h(T.$$.fragment),c=i(),h(J.$$.fragment)},l(o){b(f.$$.fragment,o),v=a(o),b(T.$$.fragment,o),c=a(o),b(J.$$.fragment,o)},m(o,$){g(f,o,$),n(o,v,$),g(T,o,$),n(o,c,$),g(J,o,$),d=!0},p(o,$){const _={};$&2&&(_.$$scope={dirty:$,ctx:o}),f.$set(_);const x={};$&2&&(x.$$scope={dirty:$,ctx:o}),T.$set(x);const u={};$&2&&(u.$$scope={dirty:$,ctx:o}),J.$set(u)},i(o){d||(M(f.$$.fragment,o),M(T.$$.fragment,o),M(J.$$.fragment,o),d=!0)},o(o){y(f.$$.fragment,o),y(T.$$.fragment,o),y(J.$$.fragment,o),d=!1},d(o){o&&(l(v),l(c)),w(f,o),w(T,o),w(J,o)}}}function Cl(R){let f,v,T,c,J,d,o,$,_,x='<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.',u,Z,V='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>.',C,X,E='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.',W,I,z="Before running the script, make sure you install the library from source:",G,k,N,s,j="Then navigate to the example folder containing the training script and install the required dependencies for the script you’re using:",Le,F,He,B,Lt='<p>🤗 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.</p>',Ve,A,Ht="Initialize an 🤗 Accelerate environment:",Ee,S,ze,Q,Vt="To setup a default 🤗 Accelerate environment without choosing any configurations:",Fe,P,Ae,q,Et="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",Se,D,Qe,O,zt='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.',Pe,Y,Ft='<p>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.</p>',qe,K,De,ee,At='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.',Oe,te,St="For example, to speedup training with mixed precision using the fp16 format, add the <code>--mixed_precision</code> parameter to the training command:",Ke,le,et,ne,Qt='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:',tt,ie,Pt="<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>",lt,ae,nt,oe,qt='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.',it,se,Dt="Add the <code>--snr_gamma</code> parameter and set it to the recommended value of 5.0:",at,re,ot,pe,st,me,Ot='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.',rt,fe,Kt='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.',pt,L,el='<p>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>.</p>',mt,ue,ft,de,tl='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:',ut,ce,dt,he,ll='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:',ct,be,ht,ge,nl='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:',bt,Me,gt,ye,il='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.',Mt,we,yt,Te,al="Now you’re ready to launch the training script! 🚀",wt,Je,ol='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).',Tt,$e,sl="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.",Jt,_e,rl="Download the following images to condition your training with:",$t,Ze,_t,Ue,pl="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.",Zt,H,Ut,ve,vt,je,ml="Once training is complete, you can use your newly trained model for inference!",jt,xe,xt,Ce,Ct,We,fl='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.',Wt,Ge,ul='The SDXL training script is discussed in more detail in the <a href="sdxl">SDXL training</a> guide.',Gt,Re,Rt,Xe,dl="Congratulations on training your own ControlNet! To learn more about how to use your new model, the following guides may be helpful:",Xt,Ie,cl='<li>Learn how to <a href="../using-diffusers/controlnet">use a ControlNet</a> for inference on a variety of tasks.</li>',It,ke,kt,Be,Nt;return J=new $l({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),o=new Ne({props:{title:"ControlNet",local:"controlnet",headingTag:"h1"}}),k=new U({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}}),F=new U({props:{code:"Y2QlMjBleGFtcGxlcyUyRmNvbnRyb2xuZXQlMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/controlnet
pip install -r requirements.txt`,wrap:!1}}),S=new U({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),P=new U({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default",wrap:!1}}),D=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()`,wrap:!1}}),K=new Ne({props:{title:"Script parameters",local:"script-parameters",headingTag:"h2"}}),le=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjI=",highlighted:`accelerate launch train_controlnet.py \\
  --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span>`,wrap:!1}}),ae=new Ne({props:{title:"Min-SNR weighting",local:"min-snr-weighting",headingTag:"h3"}}),re=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX2NvbnRyb2xuZXQucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_controlnet.py \\
  --snr_gamma=5.0`,wrap:!1}}),pe=new Ne({props:{title:"Training script",local:"training-script",headingTag:"h2"}}),ue=new U({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}}),ce=new U({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}}),be=new U({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}}),Me=new U({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"}}),Ze=new U({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}}),H=new Zl({props:{id:"gpu-select",options:["16GB","12GB","8GB"],$$slots:{default:[xl]},$$scope:{ctx:R}}}),ve=new U({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}}),xe=new U({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}}),Ce=new Ne({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),Re=new Ne({props:{title:"Next steps",local:"next-steps",headingTag:"h2"}}),ke=new _l({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/training/controlnet.md"}}),{c(){f=r("meta"),v=i(),T=r("p"),c=i(),h(J.$$.fragment),d=i(),h(o.$$.fragment),$=i(),_=r("p"),_.innerHTML=x,u=i(),Z=r("p"),Z.innerHTML=V,C=i(),X=r("p"),X.innerHTML=E,W=i(),I=r("p"),I.textContent=z,G=i(),h(k.$$.fragment),N=i(),s=r("p"),s.textContent=j,Le=i(),h(F.$$.fragment),He=i(),B=r("blockquote"),B.innerHTML=Lt,Ve=i(),A=r("p"),A.textContent=Ht,Ee=i(),h(S.$$.fragment),ze=i(),Q=r("p"),Q.textContent=Vt,Fe=i(),h(P.$$.fragment),Ae=i(),q=r("p"),q.textContent=Et,Se=i(),h(D.$$.fragment),Qe=i(),O=r("p"),O.innerHTML=zt,Pe=i(),Y=r("blockquote"),Y.innerHTML=Ft,qe=i(),h(K.$$.fragment),De=i(),ee=r("p"),ee.innerHTML=At,Oe=i(),te=r("p"),te.innerHTML=St,Ke=i(),h(le.$$.fragment),et=i(),ne=r("p"),ne.innerHTML=Qt,tt=i(),ie=r("ul"),ie.innerHTML=Pt,lt=i(),h(ae.$$.fragment),nt=i(),oe=r("p"),oe.innerHTML=qt,it=i(),se=r("p"),se.innerHTML=Dt,at=i(),h(re.$$.fragment),ot=i(),h(pe.$$.fragment),st=i(),me=r("p"),me.innerHTML=Ot,rt=i(),fe=r("p"),fe.innerHTML=Kt,pt=i(),L=r("blockquote"),L.innerHTML=el,mt=i(),h(ue.$$.fragment),ft=i(),de=r("p"),de.innerHTML=tl,ut=i(),h(ce.$$.fragment),dt=i(),he=r("p"),he.innerHTML=ll,ct=i(),h(be.$$.fragment),ht=i(),ge=r("p"),ge.innerHTML=nl,bt=i(),h(Me.$$.fragment),gt=i(),ye=r("p"),ye.innerHTML=il,Mt=i(),h(we.$$.fragment),yt=i(),Te=r("p"),Te.textContent=al,wt=i(),Je=r("p"),Je.innerHTML=ol,Tt=i(),$e=r("p"),$e.innerHTML=sl,Jt=i(),_e=r("p"),_e.textContent=rl,$t=i(),h(Ze.$$.fragment),_t=i(),Ue=r("p"),Ue.innerHTML=pl,Zt=i(),h(H.$$.fragment),Ut=i(),h(ve.$$.fragment),vt=i(),je=r("p"),je.textContent=ml,jt=i(),h(xe.$$.fragment),xt=i(),h(Ce.$$.fragment),Ct=i(),We=r("p"),We.innerHTML=fl,Wt=i(),Ge=r("p"),Ge.innerHTML=ul,Gt=i(),h(Re.$$.fragment),Rt=i(),Xe=r("p"),Xe.textContent=dl,Xt=i(),Ie=r("ul"),Ie.innerHTML=cl,It=i(),h(ke.$$.fragment),kt=i(),Be=r("p"),this.h()},l(e){const t=Tl("svelte-u9bgzb",document.head);f=p(t,"META",{name:!0,content:!0}),t.forEach(l),v=a(e),T=p(e,"P",{}),bl(T).forEach(l),c=a(e),b(J.$$.fragment,e),d=a(e),b(o.$$.fragment,e),$=a(e),_=p(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-q2o66i"&&(_.innerHTML=x),u=a(e),Z=p(e,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-nx8a15"&&(Z.innerHTML=V),C=a(e),X=p(e,"P",{"data-svelte-h":!0}),m(X)!=="svelte-sp8ken"&&(X.innerHTML=E),W=a(e),I=p(e,"P",{"data-svelte-h":!0}),m(I)!=="svelte-l7dm2q"&&(I.textContent=z),G=a(e),b(k.$$.fragment,e),N=a(e),s=p(e,"P",{"data-svelte-h":!0}),m(s)!=="svelte-z4z0b9"&&(s.textContent=j),Le=a(e),b(F.$$.fragment,e),He=a(e),B=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),m(B)!=="svelte-1in84qc"&&(B.innerHTML=Lt),Ve=a(e),A=p(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-60q53m"&&(A.textContent=Ht),Ee=a(e),b(S.$$.fragment,e),ze=a(e),Q=p(e,"P",{"data-svelte-h":!0}),m(Q)!=="svelte-di6juu"&&(Q.textContent=Vt),Fe=a(e),b(P.$$.fragment,e),Ae=a(e),q=p(e,"P",{"data-svelte-h":!0}),m(q)!=="svelte-tsz4qp"&&(q.textContent=Et),Se=a(e),b(D.$$.fragment,e),Qe=a(e),O=p(e,"P",{"data-svelte-h":!0}),m(O)!=="svelte-1fkfdql"&&(O.innerHTML=zt),Pe=a(e),Y=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),m(Y)!=="svelte-jld06v"&&(Y.innerHTML=Ft),qe=a(e),b(K.$$.fragment,e),De=a(e),ee=p(e,"P",{"data-svelte-h":!0}),m(ee)!=="svelte-bw2u91"&&(ee.innerHTML=At),Oe=a(e),te=p(e,"P",{"data-svelte-h":!0}),m(te)!=="svelte-1r0bv1x"&&(te.innerHTML=St),Ke=a(e),b(le.$$.fragment,e),et=a(e),ne=p(e,"P",{"data-svelte-h":!0}),m(ne)!=="svelte-1s0tjh8"&&(ne.innerHTML=Qt),tt=a(e),ie=p(e,"UL",{"data-svelte-h":!0}),m(ie)!=="svelte-9wifrj"&&(ie.innerHTML=Pt),lt=a(e),b(ae.$$.fragment,e),nt=a(e),oe=p(e,"P",{"data-svelte-h":!0}),m(oe)!=="svelte-1x34p4w"&&(oe.innerHTML=qt),it=a(e),se=p(e,"P",{"data-svelte-h":!0}),m(se)!=="svelte-tp3kp"&&(se.innerHTML=Dt),at=a(e),b(re.$$.fragment,e),ot=a(e),b(pe.$$.fragment,e),st=a(e),me=p(e,"P",{"data-svelte-h":!0}),m(me)!=="svelte-1ca6n8s"&&(me.innerHTML=Ot),rt=a(e),fe=p(e,"P",{"data-svelte-h":!0}),m(fe)!=="svelte-yhtkem"&&(fe.innerHTML=Kt),pt=a(e),L=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),m(L)!=="svelte-1ad5yln"&&(L.innerHTML=el),mt=a(e),b(ue.$$.fragment,e),ft=a(e),de=p(e,"P",{"data-svelte-h":!0}),m(de)!=="svelte-1t15wny"&&(de.innerHTML=tl),ut=a(e),b(ce.$$.fragment,e),dt=a(e),he=p(e,"P",{"data-svelte-h":!0}),m(he)!=="svelte-1rtudr1"&&(he.innerHTML=ll),ct=a(e),b(be.$$.fragment,e),ht=a(e),ge=p(e,"P",{"data-svelte-h":!0}),m(ge)!=="svelte-ane16q"&&(ge.innerHTML=nl),bt=a(e),b(Me.$$.fragment,e),gt=a(e),ye=p(e,"P",{"data-svelte-h":!0}),m(ye)!=="svelte-6gmbd2"&&(ye.innerHTML=il),Mt=a(e),b(we.$$.fragment,e),yt=a(e),Te=p(e,"P",{"data-svelte-h":!0}),m(Te)!=="svelte-rsq2yy"&&(Te.textContent=al),wt=a(e),Je=p(e,"P",{"data-svelte-h":!0}),m(Je)!=="svelte-87boqf"&&(Je.innerHTML=ol),Tt=a(e),$e=p(e,"P",{"data-svelte-h":!0}),m($e)!=="svelte-11t01x0"&&($e.innerHTML=sl),Jt=a(e),_e=p(e,"P",{"data-svelte-h":!0}),m(_e)!=="svelte-1uo0m2d"&&(_e.textContent=rl),$t=a(e),b(Ze.$$.fragment,e),_t=a(e),Ue=p(e,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-1wlzzvk"&&(Ue.innerHTML=pl),Zt=a(e),b(H.$$.fragment,e),Ut=a(e),b(ve.$$.fragment,e),vt=a(e),je=p(e,"P",{"data-svelte-h":!0}),m(je)!=="svelte-1x6in5t"&&(je.textContent=ml),jt=a(e),b(xe.$$.fragment,e),xt=a(e),b(Ce.$$.fragment,e),Ct=a(e),We=p(e,"P",{"data-svelte-h":!0}),m(We)!=="svelte-t1l7wa"&&(We.innerHTML=fl),Wt=a(e),Ge=p(e,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-6dxtva"&&(Ge.innerHTML=ul),Gt=a(e),b(Re.$$.fragment,e),Rt=a(e),Xe=p(e,"P",{"data-svelte-h":!0}),m(Xe)!=="svelte-s6fbj8"&&(Xe.textContent=dl),Xt=a(e),Ie=p(e,"UL",{"data-svelte-h":!0}),m(Ie)!=="svelte-jinr48"&&(Ie.innerHTML=cl),It=a(e),b(ke.$$.fragment,e),kt=a(e),Be=p(e,"P",{}),bl(Be).forEach(l),this.h()},h(){Ye(f,"name","hf:doc:metadata"),Ye(f,"content",Wl),Ye(B,"class","tip"),Ye(Y,"class","tip"),Ye(L,"class","tip")},m(e,t){Jl(document.head,f),n(e,v,t),n(e,T,t),n(e,c,t),g(J,e,t),n(e,d,t),g(o,e,t),n(e,$,t),n(e,_,t),n(e,u,t),n(e,Z,t),n(e,C,t),n(e,X,t),n(e,W,t),n(e,I,t),n(e,G,t),g(k,e,t),n(e,N,t),n(e,s,t),n(e,Le,t),g(F,e,t),n(e,He,t),n(e,B,t),n(e,Ve,t),n(e,A,t),n(e,Ee,t),g(S,e,t),n(e,ze,t),n(e,Q,t),n(e,Fe,t),g(P,e,t),n(e,Ae,t),n(e,q,t),n(e,Se,t),g(D,e,t),n(e,Qe,t),n(e,O,t),n(e,Pe,t),n(e,Y,t),n(e,qe,t),g(K,e,t),n(e,De,t),n(e,ee,t),n(e,Oe,t),n(e,te,t),n(e,Ke,t),g(le,e,t),n(e,et,t),n(e,ne,t),n(e,tt,t),n(e,ie,t),n(e,lt,t),g(ae,e,t),n(e,nt,t),n(e,oe,t),n(e,it,t),n(e,se,t),n(e,at,t),g(re,e,t),n(e,ot,t),g(pe,e,t),n(e,st,t),n(e,me,t),n(e,rt,t),n(e,fe,t),n(e,pt,t),n(e,L,t),n(e,mt,t),g(ue,e,t),n(e,ft,t),n(e,de,t),n(e,ut,t),g(ce,e,t),n(e,dt,t),n(e,he,t),n(e,ct,t),g(be,e,t),n(e,ht,t),n(e,ge,t),n(e,bt,t),g(Me,e,t),n(e,gt,t),n(e,ye,t),n(e,Mt,t),g(we,e,t),n(e,yt,t),n(e,Te,t),n(e,wt,t),n(e,Je,t),n(e,Tt,t),n(e,$e,t),n(e,Jt,t),n(e,_e,t),n(e,$t,t),g(Ze,e,t),n(e,_t,t),n(e,Ue,t),n(e,Zt,t),g(H,e,t),n(e,Ut,t),g(ve,e,t),n(e,vt,t),n(e,je,t),n(e,jt,t),g(xe,e,t),n(e,xt,t),g(Ce,e,t),n(e,Ct,t),n(e,We,t),n(e,Wt,t),n(e,Ge,t),n(e,Gt,t),g(Re,e,t),n(e,Rt,t),n(e,Xe,t),n(e,Xt,t),n(e,Ie,t),n(e,It,t),g(ke,e,t),n(e,kt,t),n(e,Be,t),Nt=!0},p(e,[t]){const hl={};t&2&&(hl.$$scope={dirty:t,ctx:e}),H.$set(hl)},i(e){Nt||(M(J.$$.fragment,e),M(o.$$.fragment,e),M(k.$$.fragment,e),M(F.$$.fragment,e),M(S.$$.fragment,e),M(P.$$.fragment,e),M(D.$$.fragment,e),M(K.$$.fragment,e),M(le.$$.fragment,e),M(ae.$$.fragment,e),M(re.$$.fragment,e),M(pe.$$.fragment,e),M(ue.$$.fragment,e),M(ce.$$.fragment,e),M(be.$$.fragment,e),M(Me.$$.fragment,e),M(we.$$.fragment,e),M(Ze.$$.fragment,e),M(H.$$.fragment,e),M(ve.$$.fragment,e),M(xe.$$.fragment,e),M(Ce.$$.fragment,e),M(Re.$$.fragment,e),M(ke.$$.fragment,e),Nt=!0)},o(e){y(J.$$.fragment,e),y(o.$$.fragment,e),y(k.$$.fragment,e),y(F.$$.fragment,e),y(S.$$.fragment,e),y(P.$$.fragment,e),y(D.$$.fragment,e),y(K.$$.fragment,e),y(le.$$.fragment,e),y(ae.$$.fragment,e),y(re.$$.fragment,e),y(pe.$$.fragment,e),y(ue.$$.fragment,e),y(ce.$$.fragment,e),y(be.$$.fragment,e),y(Me.$$.fragment,e),y(we.$$.fragment,e),y(Ze.$$.fragment,e),y(H.$$.fragment,e),y(ve.$$.fragment,e),y(xe.$$.fragment,e),y(Ce.$$.fragment,e),y(Re.$$.fragment,e),y(ke.$$.fragment,e),Nt=!1},d(e){e&&(l(v),l(T),l(c),l(d),l($),l(_),l(u),l(Z),l(C),l(X),l(W),l(I),l(G),l(N),l(s),l(Le),l(He),l(B),l(Ve),l(A),l(Ee),l(ze),l(Q),l(Fe),l(Ae),l(q),l(Se),l(Qe),l(O),l(Pe),l(Y),l(qe),l(De),l(ee),l(Oe),l(te),l(Ke),l(et),l(ne),l(tt),l(ie),l(lt),l(nt),l(oe),l(it),l(se),l(at),l(ot),l(st),l(me),l(rt),l(fe),l(pt),l(L),l(mt),l(ft),l(de),l(ut),l(dt),l(he),l(ct),l(ht),l(ge),l(bt),l(gt),l(ye),l(Mt),l(yt),l(Te),l(wt),l(Je),l(Tt),l($e),l(Jt),l(_e),l($t),l(_t),l(Ue),l(Zt),l(Ut),l(vt),l(je),l(jt),l(xt),l(Ct),l(We),l(Wt),l(Ge),l(Gt),l(Rt),l(Xe),l(Xt),l(Ie),l(It),l(kt),l(Be)),l(f),w(J,e),w(o,e),w(k,e),w(F,e),w(S,e),w(P,e),w(D,e),w(K,e),w(le,e),w(ae,e),w(re,e),w(pe,e),w(ue,e),w(ce,e),w(be,e),w(Me,e),w(we,e),w(Ze,e),w(H,e),w(ve,e),w(xe,e),w(Ce,e),w(Re,e),w(ke,e)}}}const Wl='{"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 Gl(R){return Ml(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Yl extends yl{constructor(f){super(),wl(this,f,Gl,Cl,gl,{})}}export{Yl as component};
