import{s as je,n as Xe,o as Je}from"../chunks/scheduler.8c3d61f6.js";import{S as Re,i as He,g as i,s,r as f,A as Be,h as d,f as o,c as r,j as N,u as m,x as u,k as w,y as n,a as c,v as p,d as _,t as h,w as g}from"../chunks/index.da70eac4.js";import{D as Z}from"../chunks/Docstring.c021b19a.js";import{C as We}from"../chunks/CodeBlock.a9c4becf.js";import{H as Me,E as Oe}from"../chunks/getInferenceSnippets.725ed3d4.js";function Ee(Ue){let A,Q,z,Y,x,ee,M,Te="ControlNetUnionModel is an implementation of ControlNet for Stable Diffusion XL.",oe,U,$e='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.',te,T,ke="<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>",ne,$,se,k,De='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>.',re,D,ie,F,de,a,L,_e,X,Fe="A ControlNetUnion model.",he,y,q,ge,J,Le='The <a href="/docs/diffusers/main/en/api/models/controlnet_union#diffusers.ControlNetUnionModel">ControlNetUnionModel</a> forward method.',be,C,I,Ae,R,qe='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>.',ye,b,G,Ce,H,Ie="Enable sliced attention computation.",Pe,B,Ge=`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.`,ve,P,S,Ne,W,Se="Sets the attention processor to use to compute attention.",we,v,V,xe,O,Ve="Disables custom attention processors and sets the default attention implementation.",ae,j,ce,K,le;return x=new Me({props:{title:"ControlNetUnionModel",local:"controlnetunionmodel",headingTag:"h1"}}),$=new Me({props:{title:"Loading",local:"loading",headingTag:"h2"}}),D=new We({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}}),F=new Me({props:{title:"ControlNetUnionModel",local:"diffusers.ControlNetUnionModel",headingTag:"h2"}}),L=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"}}),q=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>
`}}),I=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"}}),G=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"}}),S=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"}}),V=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"}}),j=new Oe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/controlnet_union.md"}}),{c(){A=i("meta"),Q=s(),z=i("p"),Y=s(),f(x.$$.fragment),ee=s(),M=i("p"),M.textContent=Te,oe=s(),U=i("p"),U.innerHTML=$e,te=s(),T=i("p"),T.innerHTML=ke,ne=s(),f($.$$.fragment),se=s(),k=i("p"),k.innerHTML=De,re=s(),f(D.$$.fragment),ie=s(),f(F.$$.fragment),de=s(),a=i("div"),f(L.$$.fragment),_e=s(),X=i("p"),X.textContent=Fe,he=s(),y=i("div"),f(q.$$.fragment),ge=s(),J=i("p"),J.innerHTML=Le,be=s(),C=i("div"),f(I.$$.fragment),Ae=s(),R=i("p"),R.innerHTML=qe,ye=s(),b=i("div"),f(G.$$.fragment),Ce=s(),H=i("p"),H.textContent=Ie,Pe=s(),B=i("p"),B.textContent=Ge,ve=s(),P=i("div"),f(S.$$.fragment),Ne=s(),W=i("p"),W.textContent=Se,we=s(),v=i("div"),f(V.$$.fragment),xe=s(),O=i("p"),O.textContent=Ve,ae=s(),f(j.$$.fragment),ce=s(),K=i("p"),this.h()},l(e){const t=Be("svelte-u9bgzb",document.head);A=d(t,"META",{name:!0,content:!0}),t.forEach(o),Q=r(e),z=d(e,"P",{}),N(z).forEach(o),Y=r(e),m(x.$$.fragment,e),ee=r(e),M=d(e,"P",{"data-svelte-h":!0}),u(M)!=="svelte-3qwqxp"&&(M.textContent=Te),oe=r(e),U=d(e,"P",{"data-svelte-h":!0}),u(U)!=="svelte-1uo8sal"&&(U.innerHTML=$e),te=r(e),T=d(e,"P",{"data-svelte-h":!0}),u(T)!=="svelte-1nmdtkp"&&(T.innerHTML=ke),ne=r(e),m($.$$.fragment,e),se=r(e),k=d(e,"P",{"data-svelte-h":!0}),u(k)!=="svelte-1jebso6"&&(k.innerHTML=De),re=r(e),m(D.$$.fragment,e),ie=r(e),m(F.$$.fragment,e),de=r(e),a=d(e,"DIV",{class:!0});var l=N(a);m(L.$$.fragment,l),_e=r(l),X=d(l,"P",{"data-svelte-h":!0}),u(X)!=="svelte-1up8inn"&&(X.textContent=Fe),he=r(l),y=d(l,"DIV",{class:!0});var fe=N(y);m(q.$$.fragment,fe),ge=r(fe),J=d(fe,"P",{"data-svelte-h":!0}),u(J)!=="svelte-1r91u8l"&&(J.innerHTML=Le),fe.forEach(o),be=r(l),C=d(l,"DIV",{class:!0});var me=N(C);m(I.$$.fragment,me),Ae=r(me),R=d(me,"P",{"data-svelte-h":!0}),u(R)!=="svelte-1jb5v16"&&(R.innerHTML=qe),me.forEach(o),ye=r(l),b=d(l,"DIV",{class:!0});var E=N(b);m(G.$$.fragment,E),Ce=r(E),H=d(E,"P",{"data-svelte-h":!0}),u(H)!=="svelte-7fahc0"&&(H.textContent=Ie),Pe=r(E),B=d(E,"P",{"data-svelte-h":!0}),u(B)!=="svelte-1yjwkav"&&(B.textContent=Ge),E.forEach(o),ve=r(l),P=d(l,"DIV",{class:!0});var ue=N(P);m(S.$$.fragment,ue),Ne=r(ue),W=d(ue,"P",{"data-svelte-h":!0}),u(W)!=="svelte-1o77hl2"&&(W.textContent=Se),ue.forEach(o),we=r(l),v=d(l,"DIV",{class:!0});var pe=N(v);m(V.$$.fragment,pe),xe=r(pe),O=d(pe,"P",{"data-svelte-h":!0}),u(O)!=="svelte-1lxcwhv"&&(O.textContent=Ve),pe.forEach(o),l.forEach(o),ae=r(e),m(j.$$.fragment,e),ce=r(e),K=d(e,"P",{}),N(K).forEach(o),this.h()},h(){w(A,"name","hf:doc:metadata"),w(A,"content",Ze),w(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),w(a,"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){n(document.head,A),c(e,Q,t),c(e,z,t),c(e,Y,t),p(x,e,t),c(e,ee,t),c(e,M,t),c(e,oe,t),c(e,U,t),c(e,te,t),c(e,T,t),c(e,ne,t),p($,e,t),c(e,se,t),c(e,k,t),c(e,re,t),p(D,e,t),c(e,ie,t),p(F,e,t),c(e,de,t),c(e,a,t),p(L,a,null),n(a,_e),n(a,X),n(a,he),n(a,y),p(q,y,null),n(y,ge),n(y,J),n(a,be),n(a,C),p(I,C,null),n(C,Ae),n(C,R),n(a,ye),n(a,b),p(G,b,null),n(b,Ce),n(b,H),n(b,Pe),n(b,B),n(a,ve),n(a,P),p(S,P,null),n(P,Ne),n(P,W),n(a,we),n(a,v),p(V,v,null),n(v,xe),n(v,O),c(e,ae,t),p(j,e,t),c(e,ce,t),c(e,K,t),le=!0},p:Xe,i(e){le||(_(x.$$.fragment,e),_($.$$.fragment,e),_(D.$$.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),le=!0)},o(e){h(x.$$.fragment,e),h($.$$.fragment,e),h(D.$$.fragment,e),h(F.$$.fragment,e),h(L.$$.fragment,e),h(q.$$.fragment,e),h(I.$$.fragment,e),h(G.$$.fragment,e),h(S.$$.fragment,e),h(V.$$.fragment,e),h(j.$$.fragment,e),le=!1},d(e){e&&(o(Q),o(z),o(Y),o(ee),o(M),o(oe),o(U),o(te),o(T),o(ne),o(se),o(k),o(re),o(ie),o(de),o(a),o(ae),o(ce),o(K)),o(A),g(x,e),g($,e),g(D,e),g(F,e),g(L),g(q),g(I),g(G),g(S),g(V),g(j,e)}}}const Ze='{"title":"ControlNetUnionModel","local":"controlnetunionmodel","sections":[{"title":"Loading","local":"loading","sections":[],"depth":2},{"title":"ControlNetUnionModel","local":"diffusers.ControlNetUnionModel","sections":[],"depth":2}],"depth":1}';function ze(Ue){return Je(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class to extends Re{constructor(A){super(),He(this,A,ze,Ee,je,{})}}export{to as component};
