import{s as Je,n as Re,o as He}from"../chunks/scheduler.53228c21.js";import{S as Be,i as We,e as i,s as n,c as f,h as Oe,a as d,d as o,b as s,f as x,g as m,j as h,k as N,l as r,m as a,n as u,t as p,o as _,p as g}from"../chunks/index.100fac89.js";import{C as Ee}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{D as z}from"../chunks/Docstring.22cc8849.js";import{C as Ze}from"../chunks/CodeBlock.d30a6509.js";import{H as Te,E as ze}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";function Ke($e){let y,Y,K,ee,w,oe,M,te,U,ke="ControlNetUnionModel is an implementation of ControlNet for Stable Diffusion XL.",ne,T,De='The ControlNet model was introduced in <a href="https://github.com/xinsir6/ControlNetPlus" rel="nofollow">ControlNetPlus</a> by xinsir6. It supports multiple conditioning inputs without increasing computation.',se,$,Fe="<em>We design a new architecture that can support 10+ control types in condition text-to-image generation and can generate high resolution images visually comparable with midjourney. The network is based on the original ControlNet architecture, we propose two new modules to: 1 Extend the original ControlNet to support different image conditions using the same network parameter. 2 Support multiple conditions input without increasing computation offload, which is especially important for designers who want to edit image in detail, different conditions use the same condition encoder, without adding extra computations or parameters.</em>",re,k,ie,D,Le='By default the <a href="/docs/diffusers/main/en/api/models/controlnet_union#diffusers.ControlNetUnionModel">ControlNetUnionModel</a> should be loaded with <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin.from_pretrained">from_pretrained()</a>.',de,F,ae,L,ce,c,q,he,J,qe="A ControlNetUnion model.",be,A,I,ye,R,Ie='The <a href="/docs/diffusers/main/en/api/models/controlnet_union#diffusers.ControlNetUnionModel">ControlNetUnionModel</a> forward method.',Ae,C,G,Ce,H,Ge='Instantiate a <a href="/docs/diffusers/main/en/api/models/controlnet_union#diffusers.ControlNetUnionModel">ControlNetUnionModel</a> from <a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>.',Pe,b,S,ve,B,Se="Enable sliced attention computation.",xe,W,Ve=`When this option is enabled, the attention module splits the input tensor in slices to compute attention in
several steps. This is useful for saving some memory in exchange for a small decrease in speed.`,Ne,P,V,we,O,je="Sets the attention processor to use to compute attention.",Me,v,j,Ue,E,Xe="Disables custom attention processors and sets the default attention implementation.",le,X,fe,Q,me;return w=new Ee({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),M=new Te({props:{title:"ControlNetUnionModel",local:"controlnetunionmodel",headingTag:"h1"}}),k=new Te({props:{title:"Loading",local:"loading",headingTag:"h2"}}),F=new Ze({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMQ29udHJvbE5ldFVuaW9uUGlwZWxpbmUlMkMlMjBDb250cm9sTmV0VW5pb25Nb2RlbCUwQSUwQWNvbnRyb2xuZXQlMjAlM0QlMjBDb250cm9sTmV0VW5pb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyeGluc2lyJTJGY29udHJvbG5ldC11bmlvbi1zZHhsLTEuMCUyMiklMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExDb250cm9sTmV0VW5pb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwY29udHJvbG5ldCUzRGNvbnRyb2xuZXQp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLControlNetUnionPipeline, ControlNetUnionModel

controlnet = ControlNetUnionModel.from_pretrained(<span class="hljs-string">&quot;xinsir/controlnet-union-sdxl-1.0&quot;</span>)
pipe = StableDiffusionXLControlNetUnionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, controlnet=controlnet)`,wrap:!1}}),L=new Te({props:{title:"ControlNetUnionModel",local:"diffusers.ControlNetUnionModel",headingTag:"h2"}}),q=new z({props:{name:"class diffusers.ControlNetUnionModel",anchor:"diffusers.ControlNetUnionModel",parameters:[{name:"in_channels",val:": int = 4"},{name:"conditioning_channels",val:": int = 3"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ('CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'DownBlock2D')"},{name:"only_cross_attention",val:": typing.Union[bool, typing.Tuple[bool]] = False"},{name:"block_out_channels",val:": typing.Tuple[int, ...] = (320, 640, 1280, 1280)"},{name:"layers_per_block",val:": int = 2"},{name:"downsample_padding",val:": int = 1"},{name:"mid_block_scale_factor",val:": float = 1"},{name:"act_fn",val:": str = 'silu'"},{name:"norm_num_groups",val:": typing.Optional[int] = 32"},{name:"norm_eps",val:": float = 1e-05"},{name:"cross_attention_dim",val:": int = 1280"},{name:"transformer_layers_per_block",val:": typing.Union[int, typing.Tuple[int, ...]] = 1"},{name:"encoder_hid_dim",val:": typing.Optional[int] = None"},{name:"encoder_hid_dim_type",val:": typing.Optional[str] = None"},{name:"attention_head_dim",val:": typing.Union[int, typing.Tuple[int, ...]] = 8"},{name:"num_attention_heads",val:": typing.Union[int, typing.Tuple[int, ...], NoneType] = None"},{name:"use_linear_projection",val:": bool = False"},{name:"class_embed_type",val:": typing.Optional[str] = None"},{name:"addition_embed_type",val:": typing.Optional[str] = None"},{name:"addition_time_embed_dim",val:": typing.Optional[int] = None"},{name:"num_class_embeds",val:": typing.Optional[int] = None"},{name:"upcast_attention",val:": bool = False"},{name:"resnet_time_scale_shift",val:": str = 'default'"},{name:"projection_class_embeddings_input_dim",val:": typing.Optional[int] = None"},{name:"controlnet_conditioning_channel_order",val:": str = 'rgb'"},{name:"conditioning_embedding_out_channels",val:": typing.Optional[typing.Tuple[int, ...]] = (48, 96, 192, 384)"},{name:"global_pool_conditions",val:": bool = False"},{name:"addition_embed_type_num_heads",val:": int = 64"},{name:"num_control_type",val:": int = 6"},{name:"num_trans_channel",val:": int = 320"},{name:"num_trans_head",val:": int = 8"},{name:"num_trans_layer",val:": int = 1"},{name:"num_proj_channel",val:": int = 320"}],parametersDescription:[{anchor:"diffusers.ControlNetUnionModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to 4) &#x2014;
The number of channels in the input sample.`,name:"in_channels"},{anchor:"diffusers.ControlNetUnionModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.ControlNetUnionModel.freq_shift",description:`<strong>freq_shift</strong> (<code>int</code>, defaults to 0) &#x2014;
The frequency shift to apply to the time embedding.`,name:"freq_shift"},{anchor:"diffusers.ControlNetUnionModel.down_block_types",description:`<strong>down_block_types</strong> (<code>tuple[str]</code>, defaults to <code>(&quot;CrossAttnDownBlock2D&quot;, &quot;CrossAttnDownBlock2D&quot;, &quot;CrossAttnDownBlock2D&quot;, &quot;DownBlock2D&quot;)</code>) &#x2014;
The tuple of downsample blocks to use.`,name:"down_block_types"},{anchor:"diffusers.ControlNetUnionModel.only_cross_attention",description:"<strong>only_cross_attention</strong> (<code>Union[bool, Tuple[bool]]</code>, defaults to <code>False</code>) &#x2014;",name:"only_cross_attention"},{anchor:"diffusers.ControlNetUnionModel.block_out_channels",description:`<strong>block_out_channels</strong> (<code>tuple[int]</code>, defaults to <code>(320, 640, 1280, 1280)</code>) &#x2014;
The tuple of output channels for each block.`,name:"block_out_channels"},{anchor:"diffusers.ControlNetUnionModel.layers_per_block",description:`<strong>layers_per_block</strong> (<code>int</code>, defaults to 2) &#x2014;
The number of layers per block.`,name:"layers_per_block"},{anchor:"diffusers.ControlNetUnionModel.downsample_padding",description:`<strong>downsample_padding</strong> (<code>int</code>, defaults to 1) &#x2014;
The padding to use for the downsampling convolution.`,name:"downsample_padding"},{anchor:"diffusers.ControlNetUnionModel.mid_block_scale_factor",description:`<strong>mid_block_scale_factor</strong> (<code>float</code>, defaults to 1) &#x2014;
The scale factor to use for the mid block.`,name:"mid_block_scale_factor"},{anchor:"diffusers.ControlNetUnionModel.act_fn",description:`<strong>act_fn</strong> (<code>str</code>, defaults to &#x201C;silu&#x201D;) &#x2014;
The activation function to use.`,name:"act_fn"},{anchor:"diffusers.ControlNetUnionModel.norm_num_groups",description:`<strong>norm_num_groups</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of groups to use for the normalization. If None, normalization and activation layers is skipped
in post-processing.`,name:"norm_num_groups"},{anchor:"diffusers.ControlNetUnionModel.norm_eps",description:`<strong>norm_eps</strong> (<code>float</code>, defaults to 1e-5) &#x2014;
The epsilon to use for the normalization.`,name:"norm_eps"},{anchor:"diffusers.ControlNetUnionModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, defaults to 1280) &#x2014;
The dimension of the cross attention features.`,name:"cross_attention_dim"},{anchor:"diffusers.ControlNetUnionModel.transformer_layers_per_block",description:`<strong>transformer_layers_per_block</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of transformer blocks of type <code>BasicTransformerBlock</code>. Only relevant for
<code>~models.unet_2d_blocks.CrossAttnDownBlock2D</code>, <code>~models.unet_2d_blocks.CrossAttnUpBlock2D</code>,
<code>~models.unet_2d_blocks.UNetMidBlock2DCrossAttn</code>.`,name:"transformer_layers_per_block"},{anchor:"diffusers.ControlNetUnionModel.encoder_hid_dim",description:`<strong>encoder_hid_dim</strong> (<code>int</code>, <em>optional</em>, defaults to None) &#x2014;
If <code>encoder_hid_dim_type</code> is defined, <code>encoder_hidden_states</code> will be projected from <code>encoder_hid_dim</code>
dimension to <code>cross_attention_dim</code>.`,name:"encoder_hid_dim"},{anchor:"diffusers.ControlNetUnionModel.encoder_hid_dim_type",description:`<strong>encoder_hid_dim_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
If given, the <code>encoder_hidden_states</code> and potentially other embeddings are down-projected to text
embeddings of dimension <code>cross_attention</code> according to <code>encoder_hid_dim_type</code>.`,name:"encoder_hid_dim_type"},{anchor:"diffusers.ControlNetUnionModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>Union[int, Tuple[int]]</code>, defaults to 8) &#x2014;
The dimension of the attention heads.`,name:"attention_head_dim"},{anchor:"diffusers.ControlNetUnionModel.use_linear_projection",description:"<strong>use_linear_projection</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;",name:"use_linear_projection"},{anchor:"diffusers.ControlNetUnionModel.class_embed_type",description:`<strong>class_embed_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The type of class embedding to use which is ultimately summed with the time embeddings. Choose from None,
<code>&quot;timestep&quot;</code>, <code>&quot;identity&quot;</code>, <code>&quot;projection&quot;</code>, or <code>&quot;simple_projection&quot;</code>.`,name:"class_embed_type"},{anchor:"diffusers.ControlNetUnionModel.addition_embed_type",description:`<strong>addition_embed_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Configures an optional embedding which will be summed with the time embeddings. Choose from <code>None</code> or
&#x201C;text&#x201D;. &#x201C;text&#x201D; will use the <code>TextTimeEmbedding</code> layer.`,name:"addition_embed_type"},{anchor:"diffusers.ControlNetUnionModel.num_class_embeds",description:`<strong>num_class_embeds</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Input dimension of the learnable embedding matrix to be projected to <code>time_embed_dim</code>, when performing
class conditioning with <code>class_embed_type</code> equal to <code>None</code>.`,name:"num_class_embeds"},{anchor:"diffusers.ControlNetUnionModel.upcast_attention",description:"<strong>upcast_attention</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;",name:"upcast_attention"},{anchor:"diffusers.ControlNetUnionModel.resnet_time_scale_shift",description:`<strong>resnet_time_scale_shift</strong> (<code>str</code>, defaults to <code>&quot;default&quot;</code>) &#x2014;
Time scale shift config for ResNet blocks (see <code>ResnetBlock2D</code>). Choose from <code>default</code> or <code>scale_shift</code>.`,name:"resnet_time_scale_shift"},{anchor:"diffusers.ControlNetUnionModel.projection_class_embeddings_input_dim",description:`<strong>projection_class_embeddings_input_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The dimension of the <code>class_labels</code> input when <code>class_embed_type=&quot;projection&quot;</code>. Required when
<code>class_embed_type=&quot;projection&quot;</code>.`,name:"projection_class_embeddings_input_dim"},{anchor:"diffusers.ControlNetUnionModel.controlnet_conditioning_channel_order",description:`<strong>controlnet_conditioning_channel_order</strong> (<code>str</code>, defaults to <code>&quot;rgb&quot;</code>) &#x2014;
The channel order of conditional image. Will convert to <code>rgb</code> if it&#x2019;s <code>bgr</code>.`,name:"controlnet_conditioning_channel_order"},{anchor:"diffusers.ControlNetUnionModel.conditioning_embedding_out_channels",description:`<strong>conditioning_embedding_out_channels</strong> (<code>tuple[int]</code>, <em>optional</em>, defaults to <code>(48, 96, 192, 384)</code>) &#x2014;
The tuple of output channel for each block in the <code>conditioning_embedding</code> layer.`,name:"conditioning_embedding_out_channels"},{anchor:"diffusers.ControlNetUnionModel.global_pool_conditions",description:"<strong>global_pool_conditions</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;",name:"global_pool_conditions"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_union.py#L84"}}),I=new z({props:{name:"forward",anchor:"diffusers.ControlNetUnionModel.forward",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Union[torch.Tensor, float, int]"},{name:"encoder_hidden_states",val:": Tensor"},{name:"controlnet_cond",val:": typing.List[torch.Tensor]"},{name:"control_type",val:": Tensor"},{name:"control_type_idx",val:": typing.List[int]"},{name:"conditioning_scale",val:": typing.Union[float, typing.List[float]] = 1.0"},{name:"class_labels",val:": typing.Optional[torch.Tensor] = None"},{name:"timestep_cond",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"added_cond_kwargs",val:": typing.Optional[typing.Dict[str, torch.Tensor]] = None"},{name:"cross_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"from_multi",val:": bool = False"},{name:"guess_mode",val:": bool = False"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ControlNetUnionModel.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The noisy input tensor.`,name:"sample"},{anchor:"diffusers.ControlNetUnionModel.forward.timestep",description:`<strong>timestep</strong> (<code>Union[torch.Tensor, float, int]</code>) &#x2014;
The number of timesteps to denoise an input.`,name:"timestep"},{anchor:"diffusers.ControlNetUnionModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
The encoder hidden states.`,name:"encoder_hidden_states"},{anchor:"diffusers.ControlNetUnionModel.forward.controlnet_cond",description:`<strong>controlnet_cond</strong> (<code>List[torch.Tensor]</code>) &#x2014;
The conditional input tensors.`,name:"controlnet_cond"},{anchor:"diffusers.ControlNetUnionModel.forward.control_type",description:`<strong>control_type</strong> (<code>torch.Tensor</code>) &#x2014;
A tensor of shape <code>(batch, num_control_type)</code> with values <code>0</code> or <code>1</code> depending on whether the control
type is used.`,name:"control_type"},{anchor:"diffusers.ControlNetUnionModel.forward.control_type_idx",description:`<strong>control_type_idx</strong> (<code>List[int]</code>) &#x2014;
The indices of <code>control_type</code>.`,name:"control_type_idx"},{anchor:"diffusers.ControlNetUnionModel.forward.conditioning_scale",description:`<strong>conditioning_scale</strong> (<code>float</code>, defaults to <code>1.0</code>) &#x2014;
The scale factor for ControlNet outputs.`,name:"conditioning_scale"},{anchor:"diffusers.ControlNetUnionModel.forward.class_labels",description:`<strong>class_labels</strong> (<code>torch.Tensor</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Optional class labels for conditioning. Their embeddings will be summed with the timestep embeddings.`,name:"class_labels"},{anchor:"diffusers.ControlNetUnionModel.forward.timestep_cond",description:`<strong>timestep_cond</strong> (<code>torch.Tensor</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Additional conditional embeddings for timestep. If provided, the embeddings will be summed with the
timestep_embedding passed through the <code>self.time_embedding</code> layer to obtain the final timestep
embeddings.`,name:"timestep_cond"},{anchor:"diffusers.ControlNetUnionModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An attention mask of shape <code>(batch, key_tokens)</code> is applied to <code>encoder_hidden_states</code>. If <code>1</code> the mask
is kept, otherwise if <code>0</code> it is discarded. Mask will be converted into a bias, which adds large
negative values to the attention scores corresponding to &#x201C;discard&#x201D; tokens.`,name:"attention_mask"},{anchor:"diffusers.ControlNetUnionModel.forward.added_cond_kwargs",description:`<strong>added_cond_kwargs</strong> (<code>dict</code>) &#x2014;
Additional conditions for the Stable Diffusion XL UNet.`,name:"added_cond_kwargs"},{anchor:"diffusers.ControlNetUnionModel.forward.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict[str]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttnProcessor</code>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.ControlNetUnionModel.forward.from_multi",description:`<strong>from_multi</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Use standard scaling when called from <code>MultiControlNetUnionModel</code>.`,name:"from_multi"},{anchor:"diffusers.ControlNetUnionModel.forward.guess_mode",description:`<strong>guess_mode</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
In this mode, the ControlNet encoder tries its best to recognize the input content of the input even if
you remove all prompts. A <code>guidance_scale</code> between 3.0 and 5.0 is recommended.`,name:"guess_mode"},{anchor:"diffusers.ControlNetUnionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>ControlNetOutput</code> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_union.py#L600",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, a <code>ControlNetOutput</code> is returned, otherwise a tuple is
returned where the first element is the sample tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ControlNetOutput</code> <strong>or</strong> <code>tuple</code></p>
`}}),G=new z({props:{name:"from_unet",anchor:"diffusers.ControlNetUnionModel.from_unet",parameters:[{name:"unet",val:": UNet2DConditionModel"},{name:"controlnet_conditioning_channel_order",val:": str = 'rgb'"},{name:"conditioning_embedding_out_channels",val:": typing.Optional[typing.Tuple[int, ...]] = (16, 32, 96, 256)"},{name:"load_weights_from_unet",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ControlNetUnionModel.from_unet.unet",description:`<strong>unet</strong> (<code>UNet2DConditionModel</code>) &#x2014;
The UNet model weights to copy to the <a href="/docs/diffusers/main/en/api/models/controlnet_union#diffusers.ControlNetUnionModel">ControlNetUnionModel</a>. All configuration options are also
copied where applicable.`,name:"unet"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_union.py#L388"}}),S=new z({props:{name:"set_attention_slice",anchor:"diffusers.ControlNetUnionModel.set_attention_slice",parameters:[{name:"slice_size",val:": typing.Union[str, int, typing.List[int]]"}],parametersDescription:[{anchor:"diffusers.ControlNetUnionModel.set_attention_slice.slice_size",description:`<strong>slice_size</strong> (<code>str</code> or <code>int</code> or <code>list(int)</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
When <code>&quot;auto&quot;</code>, input to the attention heads is halved, so attention is computed in two steps. If
<code>&quot;max&quot;</code>, maximum amount of memory is saved by running only one slice at a time. If a number is
provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code>
must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_union.py#L535"}}),V=new z({props:{name:"set_attn_processor",anchor:"diffusers.ControlNetUnionModel.set_attn_processor",parameters:[{name:"processor",val:": typing.Union[diffusers.models.attention_processor.AttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor2_0, diffusers.models.attention_processor.JointAttnProcessor2_0, diffusers.models.attention_processor.PAGJointAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGJointAttnProcessor2_0, diffusers.models.attention_processor.FusedJointAttnProcessor2_0, diffusers.models.attention_processor.AllegroAttnProcessor2_0, diffusers.models.attention_processor.AuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FusedAuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.CogVideoXAttnProcessor2_0, diffusers.models.attention_processor.FusedCogVideoXAttnProcessor2_0, diffusers.models.attention_processor.XFormersAttnAddedKVProcessor, diffusers.models.attention_processor.XFormersAttnProcessor, diffusers.models.attention_processor.XLAFlashAttnProcessor2_0, diffusers.models.attention_processor.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_0, diffusers.models.attention_processor.MochiAttnProcessor2_0, diffusers.models.attention_processor.StableAudioAttnProcessor2_0, diffusers.models.attention_processor.HunyuanAttnProcessor2_0, diffusers.models.attention_processor.FusedHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.LuminaAttnProcessor2_0, diffusers.models.attention_processor.FusedAttnProcessor2_0, diffusers.models.attention_processor.CustomDiffusionXFormersAttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor2_0, diffusers.models.attention_processor.SlicedAttnProcessor, diffusers.models.attention_processor.SlicedAttnAddedKVProcessor, diffusers.models.attention_processor.SanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGSanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySanaLinearAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleLinearAttention, diffusers.models.attention_processor.SanaMultiscaleAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleAttentionProjection, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.SD3IPAdapterJointAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.LoRAAttnProcessor, diffusers.models.attention_processor.LoRAAttnProcessor2_0, diffusers.models.attention_processor.LoRAXFormersAttnProcessor, diffusers.models.attention_processor.LoRAAttnAddedKVProcessor, typing.Dict[str, typing.Union[diffusers.models.attention_processor.AttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor, diffusers.models.attention_processor.AttnAddedKVProcessor2_0, diffusers.models.attention_processor.JointAttnProcessor2_0, diffusers.models.attention_processor.PAGJointAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGJointAttnProcessor2_0, diffusers.models.attention_processor.FusedJointAttnProcessor2_0, diffusers.models.attention_processor.AllegroAttnProcessor2_0, diffusers.models.attention_processor.AuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FusedAuraFlowAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0, diffusers.models.attention_processor.FluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0, diffusers.models.attention_processor.FusedFluxAttnProcessor2_0_NPU, diffusers.models.attention_processor.CogVideoXAttnProcessor2_0, diffusers.models.attention_processor.FusedCogVideoXAttnProcessor2_0, diffusers.models.attention_processor.XFormersAttnAddedKVProcessor, diffusers.models.attention_processor.XFormersAttnProcessor, diffusers.models.attention_processor.XLAFlashAttnProcessor2_0, diffusers.models.attention_processor.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_0, diffusers.models.attention_processor.MochiAttnProcessor2_0, diffusers.models.attention_processor.StableAudioAttnProcessor2_0, diffusers.models.attention_processor.HunyuanAttnProcessor2_0, diffusers.models.attention_processor.FusedHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGHunyuanAttnProcessor2_0, diffusers.models.attention_processor.LuminaAttnProcessor2_0, diffusers.models.attention_processor.FusedAttnProcessor2_0, diffusers.models.attention_processor.CustomDiffusionXFormersAttnProcessor, diffusers.models.attention_processor.CustomDiffusionAttnProcessor2_0, diffusers.models.attention_processor.SlicedAttnProcessor, diffusers.models.attention_processor.SlicedAttnAddedKVProcessor, diffusers.models.attention_processor.SanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGSanaLinearAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySanaLinearAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleLinearAttention, diffusers.models.attention_processor.SanaMultiscaleAttnProcessor2_0, diffusers.models.attention_processor.SanaMultiscaleAttentionProjection, diffusers.models.attention_processor.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, diffusers.models.attention_processor.SD3IPAdapterJointAttnProcessor2_0, diffusers.models.attention_processor.PAGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.PAGCFGIdentitySelfAttnProcessor2_0, diffusers.models.attention_processor.LoRAAttnProcessor, diffusers.models.attention_processor.LoRAAttnProcessor2_0, diffusers.models.attention_processor.LoRAXFormersAttnProcessor, diffusers.models.attention_processor.LoRAAttnAddedKVProcessor]]]"}],parametersDescription:[{anchor:"diffusers.ControlNetUnionModel.set_attn_processor.processor",description:`<strong>processor</strong> (<code>dict</code> of <code>AttentionProcessor</code> or only <code>AttentionProcessor</code>) &#x2014;
The instantiated processor class or a dictionary of processor classes that will be set as the processor
for <strong>all</strong> <code>Attention</code> layers.</p>
<p>If <code>processor</code> is a dict, the key needs to define the path to the corresponding cross attention
processor. This is strongly recommended when setting trainable attention processors.`,name:"processor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_union.py#L484"}}),j=new z({props:{name:"set_default_attn_processor",anchor:"diffusers.ControlNetUnionModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_union.py#L519"}}),X=new ze({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/controlnet_union.md"}}),{c(){y=i("meta"),Y=n(),K=i("p"),ee=n(),f(w.$$.fragment),oe=n(),f(M.$$.fragment),te=n(),U=i("p"),U.textContent=ke,ne=n(),T=i("p"),T.innerHTML=De,se=n(),$=i("p"),$.innerHTML=Fe,re=n(),f(k.$$.fragment),ie=n(),D=i("p"),D.innerHTML=Le,de=n(),f(F.$$.fragment),ae=n(),f(L.$$.fragment),ce=n(),c=i("div"),f(q.$$.fragment),he=n(),J=i("p"),J.textContent=qe,be=n(),A=i("div"),f(I.$$.fragment),ye=n(),R=i("p"),R.innerHTML=Ie,Ae=n(),C=i("div"),f(G.$$.fragment),Ce=n(),H=i("p"),H.innerHTML=Ge,Pe=n(),b=i("div"),f(S.$$.fragment),ve=n(),B=i("p"),B.textContent=Se,xe=n(),W=i("p"),W.textContent=Ve,Ne=n(),P=i("div"),f(V.$$.fragment),we=n(),O=i("p"),O.textContent=je,Me=n(),v=i("div"),f(j.$$.fragment),Ue=n(),E=i("p"),E.textContent=Xe,le=n(),f(X.$$.fragment),fe=n(),Q=i("p"),this.h()},l(e){const t=Oe("svelte-u9bgzb",document.head);y=d(t,"META",{name:!0,content:!0}),t.forEach(o),Y=s(e),K=d(e,"P",{}),x(K).forEach(o),ee=s(e),m(w.$$.fragment,e),oe=s(e),m(M.$$.fragment,e),te=s(e),U=d(e,"P",{"data-svelte-h":!0}),h(U)!=="svelte-3qwqxp"&&(U.textContent=ke),ne=s(e),T=d(e,"P",{"data-svelte-h":!0}),h(T)!=="svelte-1uo8sal"&&(T.innerHTML=De),se=s(e),$=d(e,"P",{"data-svelte-h":!0}),h($)!=="svelte-1nmdtkp"&&($.innerHTML=Fe),re=s(e),m(k.$$.fragment,e),ie=s(e),D=d(e,"P",{"data-svelte-h":!0}),h(D)!=="svelte-1jebso6"&&(D.innerHTML=Le),de=s(e),m(F.$$.fragment,e),ae=s(e),m(L.$$.fragment,e),ce=s(e),c=d(e,"DIV",{class:!0});var l=x(c);m(q.$$.fragment,l),he=s(l),J=d(l,"P",{"data-svelte-h":!0}),h(J)!=="svelte-1up8inn"&&(J.textContent=qe),be=s(l),A=d(l,"DIV",{class:!0});var ue=x(A);m(I.$$.fragment,ue),ye=s(ue),R=d(ue,"P",{"data-svelte-h":!0}),h(R)!=="svelte-1r91u8l"&&(R.innerHTML=Ie),ue.forEach(o),Ae=s(l),C=d(l,"DIV",{class:!0});var pe=x(C);m(G.$$.fragment,pe),Ce=s(pe),H=d(pe,"P",{"data-svelte-h":!0}),h(H)!=="svelte-1jb5v16"&&(H.innerHTML=Ge),pe.forEach(o),Pe=s(l),b=d(l,"DIV",{class:!0});var Z=x(b);m(S.$$.fragment,Z),ve=s(Z),B=d(Z,"P",{"data-svelte-h":!0}),h(B)!=="svelte-7fahc0"&&(B.textContent=Se),xe=s(Z),W=d(Z,"P",{"data-svelte-h":!0}),h(W)!=="svelte-1yjwkav"&&(W.textContent=Ve),Z.forEach(o),Ne=s(l),P=d(l,"DIV",{class:!0});var _e=x(P);m(V.$$.fragment,_e),we=s(_e),O=d(_e,"P",{"data-svelte-h":!0}),h(O)!=="svelte-1o77hl2"&&(O.textContent=je),_e.forEach(o),Me=s(l),v=d(l,"DIV",{class:!0});var ge=x(v);m(j.$$.fragment,ge),Ue=s(ge),E=d(ge,"P",{"data-svelte-h":!0}),h(E)!=="svelte-1lxcwhv"&&(E.textContent=Xe),ge.forEach(o),l.forEach(o),le=s(e),m(X.$$.fragment,e),fe=s(e),Q=d(e,"P",{}),x(Q).forEach(o),this.h()},h(){N(y,"name","hf:doc:metadata"),N(y,"content",Qe),N(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){r(document.head,y),a(e,Y,t),a(e,K,t),a(e,ee,t),u(w,e,t),a(e,oe,t),u(M,e,t),a(e,te,t),a(e,U,t),a(e,ne,t),a(e,T,t),a(e,se,t),a(e,$,t),a(e,re,t),u(k,e,t),a(e,ie,t),a(e,D,t),a(e,de,t),u(F,e,t),a(e,ae,t),u(L,e,t),a(e,ce,t),a(e,c,t),u(q,c,null),r(c,he),r(c,J),r(c,be),r(c,A),u(I,A,null),r(A,ye),r(A,R),r(c,Ae),r(c,C),u(G,C,null),r(C,Ce),r(C,H),r(c,Pe),r(c,b),u(S,b,null),r(b,ve),r(b,B),r(b,xe),r(b,W),r(c,Ne),r(c,P),u(V,P,null),r(P,we),r(P,O),r(c,Me),r(c,v),u(j,v,null),r(v,Ue),r(v,E),a(e,le,t),u(X,e,t),a(e,fe,t),a(e,Q,t),me=!0},p:Re,i(e){me||(p(w.$$.fragment,e),p(M.$$.fragment,e),p(k.$$.fragment,e),p(F.$$.fragment,e),p(L.$$.fragment,e),p(q.$$.fragment,e),p(I.$$.fragment,e),p(G.$$.fragment,e),p(S.$$.fragment,e),p(V.$$.fragment,e),p(j.$$.fragment,e),p(X.$$.fragment,e),me=!0)},o(e){_(w.$$.fragment,e),_(M.$$.fragment,e),_(k.$$.fragment,e),_(F.$$.fragment,e),_(L.$$.fragment,e),_(q.$$.fragment,e),_(I.$$.fragment,e),_(G.$$.fragment,e),_(S.$$.fragment,e),_(V.$$.fragment,e),_(j.$$.fragment,e),_(X.$$.fragment,e),me=!1},d(e){e&&(o(Y),o(K),o(ee),o(oe),o(te),o(U),o(ne),o(T),o(se),o($),o(re),o(ie),o(D),o(de),o(ae),o(ce),o(c),o(le),o(fe),o(Q)),o(y),g(w,e),g(M,e),g(k,e),g(F,e),g(L,e),g(q),g(I),g(G),g(S),g(V),g(j),g(X,e)}}}const Qe='{"title":"ControlNetUnionModel","local":"controlnetunionmodel","sections":[{"title":"Loading","local":"loading","sections":[],"depth":2},{"title":"ControlNetUnionModel","local":"diffusers.ControlNetUnionModel","sections":[],"depth":2}],"depth":1}';function Ye($e){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class io extends Be{constructor(y){super(),We(this,y,Ye,Ke,Je,{})}}export{io as component};
