import{s as We,n as Ye,o as Oe}from"../chunks/scheduler.8c3d61f6.js";import{S as Ke,i as Qe,g as a,s,r as p,A as eo,h as d,f as o,c as n,j as y,u as f,x as h,k as C,y as r,a as i,v as m,d as u,t as _,w as g}from"../chunks/index.da70eac4.js";import{D as Z}from"../chunks/Docstring.367be9ed.js";import{C as oo}from"../chunks/CodeBlock.a9c4becf.js";import{H as ve,E as to}from"../chunks/getInferenceSnippets.cb466318.js";function so(Je){let A,te,ee,se,T,ne,x,Le='SparseControlNetModel is an implementation of ControlNet for <a href="https://huggingface.co/papers/2307.04725" rel="nofollow">AnimateDiff</a>.',re,N,Ue='ControlNet was introduced in <a href="https://huggingface.co/papers/2302.05543" rel="nofollow">Adding Conditional Control to Text-to-Image Diffusion Models</a> by Lvmin Zhang, Anyi Rao, and Maneesh Agrawala.',ie,S,Be='The SparseCtrl version of ControlNet was introduced in <a href="https://huggingface.co/papers/2311.16933" rel="nofollow">SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion Models</a> for achieving controlled generation in text-to-video diffusion models by Yuwei Guo, Ceyuan Yang, Anyi Rao, Maneesh Agrawala, Dahua Lin, and Bo Dai.',ae,$,Ge="The abstract from the paper is:",de,k,Ve='<em>The development of text-to-video (T2V), i.e., generating videos with a given text prompt, has been significantly advanced in recent years. However, relying solely on text prompts often results in ambiguous frame composition due to spatial uncertainty. The research community thus leverages the dense structure signals, e.g., per-frame depth/edge sequences, to enhance controllability, whose collection accordingly increases the burden of inference. In this work, we present SparseCtrl to enable flexible structure control with temporally sparse signals, requiring only one or a few inputs, as shown in Figure 1. It incorporates an additional condition encoder to process these sparse signals while leaving the pre-trained T2V model untouched. The proposed approach is compatible with various modalities, including sketches, depth maps, and RGB images, providing more practical control for video generation and promoting applications such as storyboarding, depth rendering, keyframe animation, and interpolation. Extensive experiments demonstrate the generalization of SparseCtrl on both original and personalized T2V generators. Codes and models will be publicly available at <a href="https://guoyww.github.io/projects/SparseCtrl" rel="nofollow">this https URL</a>.</em>',le,F,ce,D,pe,I,fe,l,J,Pe,X,je=`A SparseControlNet model as described in <a href="https://huggingface.co/papers/2311.16933" rel="nofollow">SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion
Models</a>.`,Me,v,L,we,z,qe='The <a href="/docs/diffusers/main/en/api/models/controlnet_sparsectrl#diffusers.SparseControlNetModel">SparseControlNetModel</a> forward method.',Te,P,U,xe,E,He='Instantiate a <a href="/docs/diffusers/main/en/api/models/controlnet_sparsectrl#diffusers.SparseControlNetModel">SparseControlNetModel</a> from <a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>.',Ne,b,B,Se,W,Re="Enable sliced attention computation.",$e,Y,Ze=`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.`,ke,M,G,Fe,O,Xe="Sets the attention processor to use to compute attention.",De,w,V,Ie,K,ze="Disables custom attention processors and sets the default attention implementation.",me,j,ue,q,H,_e,R,ge,oe,he;return T=new ve({props:{title:"SparseControlNetModel",local:"sparsecontrolnetmodel",headingTag:"h1"}}),F=new ve({props:{title:"Example for loading SparseControlNetModel",local:"example-for-loading-sparsecontrolnetmodel",headingTag:"h2"}}),D=new oo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3BhcnNlQ29udHJvbE5ldE1vZGVsJTBBJTBBJTIzJTIwZnAzMiUyMHZhcmlhbnQlMjBpbiUyMGZsb2F0MTYlMEElMjMlMjAxLiUyMFNjcmliYmxlJTIwY2hlY2twb2ludCUwQWNvbnRyb2xuZXQlMjAlM0QlMjBTcGFyc2VDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmd1b3l3dyUyRmFuaW1hdGVkaWZmLXNwYXJzZWN0cmwtc2NyaWJibGUlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTBBJTIzJTIwMi4lMjBSR0IlMjBjaGVja3BvaW50JTBBY29udHJvbG5ldCUyMCUzRCUyMFNwYXJzZUNvbnRyb2xOZXRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ3VveXd3JTJGYW5pbWF0ZWRpZmYtc3BhcnNlY3RybC1yZ2IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTBBJTIzJTIwRm9yJTIwbG9hZGluZyUyMGZwMTYlMjB2YXJpYW50JTJDJTIwcGFzcyUyMCU2MHZhcmlhbnQlM0QlMjJmcDE2JTIyJTYwJTIwYXMlMjBhbiUyMGFkZGl0aW9uYWwlMjBwYXJhbWV0ZXI=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> SparseControlNetModel

<span class="hljs-comment"># fp32 variant in float16</span>
<span class="hljs-comment"># 1. Scribble checkpoint</span>
controlnet = SparseControlNetModel.from_pretrained(<span class="hljs-string">&quot;guoyww/animatediff-sparsectrl-scribble&quot;</span>, torch_dtype=torch.float16)

<span class="hljs-comment"># 2. RGB checkpoint</span>
controlnet = SparseControlNetModel.from_pretrained(<span class="hljs-string">&quot;guoyww/animatediff-sparsectrl-rgb&quot;</span>, torch_dtype=torch.float16)

<span class="hljs-comment"># For loading fp16 variant, pass \`variant=&quot;fp16&quot;\` as an additional parameter</span>`,wrap:!1}}),I=new ve({props:{title:"SparseControlNetModel",local:"diffusers.SparseControlNetModel",headingTag:"h2"}}),J=new Z({props:{name:"class diffusers.SparseControlNetModel",anchor:"diffusers.SparseControlNetModel",parameters:[{name:"in_channels",val:": int = 4"},{name:"conditioning_channels",val:": int = 4"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ('CrossAttnDownBlockMotion', 'CrossAttnDownBlockMotion', 'CrossAttnDownBlockMotion', 'DownBlockMotion')"},{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 = 768"},{name:"transformer_layers_per_block",val:": typing.Union[int, typing.Tuple[int, ...]] = 1"},{name:"transformer_layers_per_mid_block",val:": typing.Union[int, typing.Tuple[int], NoneType] = None"},{name:"temporal_transformer_layers_per_block",val:": typing.Union[int, typing.Tuple[int, ...]] = 1"},{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:"upcast_attention",val:": bool = False"},{name:"resnet_time_scale_shift",val:": str = 'default'"},{name:"conditioning_embedding_out_channels",val:": typing.Optional[typing.Tuple[int, ...]] = (16, 32, 96, 256)"},{name:"global_pool_conditions",val:": bool = False"},{name:"controlnet_conditioning_channel_order",val:": str = 'rgb'"},{name:"motion_max_seq_length",val:": int = 32"},{name:"motion_num_attention_heads",val:": int = 8"},{name:"concat_conditioning_mask",val:": bool = True"},{name:"use_simplified_condition_embedding",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.SparseControlNetModel.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.SparseControlNetModel.conditioning_channels",description:`<strong>conditioning_channels</strong> (<code>int</code>, defaults to 4) &#x2014;
The number of input channels in the controlnet conditional embedding module. If
<code>concat_condition_embedding</code> is True, the value provided here is incremented by 1.`,name:"conditioning_channels"},{anchor:"diffusers.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.transformer_layers_per_mid_block",description:`<strong>transformer_layers_per_mid_block</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of transformer layers to use in each layer in the middle block.`,name:"transformer_layers_per_mid_block"},{anchor:"diffusers.SparseControlNetModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code> or <code>Tuple[int]</code>, defaults to 8) &#x2014;
The dimension of the attention heads.`,name:"attention_head_dim"},{anchor:"diffusers.SparseControlNetModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>) &#x2014;
The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.SparseControlNetModel.use_linear_projection",description:"<strong>use_linear_projection</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;",name:"use_linear_projection"},{anchor:"diffusers.SparseControlNetModel.upcast_attention",description:"<strong>upcast_attention</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;",name:"upcast_attention"},{anchor:"diffusers.SparseControlNetModel.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.SparseControlNetModel.conditioning_embedding_out_channels",description:`<strong>conditioning_embedding_out_channels</strong> (<code>Tuple[int]</code>, defaults to <code>(16, 32, 96, 256)</code>) &#x2014;
The tuple of output channel for each block in the <code>conditioning_embedding</code> layer.`,name:"conditioning_embedding_out_channels"},{anchor:"diffusers.SparseControlNetModel.global_pool_conditions",description:`<strong>global_pool_conditions</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
TODO(Patrick) - unused parameter`,name:"global_pool_conditions"},{anchor:"diffusers.SparseControlNetModel.controlnet_conditioning_channel_order",description:"<strong>controlnet_conditioning_channel_order</strong> (<code>str</code>, defaults to <code>rgb</code>) &#x2014;",name:"controlnet_conditioning_channel_order"},{anchor:"diffusers.SparseControlNetModel.motion_max_seq_length",description:`<strong>motion_max_seq_length</strong> (<code>int</code>, defaults to <code>32</code>) &#x2014;
The maximum sequence length to use in the motion module.`,name:"motion_max_seq_length"},{anchor:"diffusers.SparseControlNetModel.motion_num_attention_heads",description:`<strong>motion_num_attention_heads</strong> (<code>int</code> or <code>Tuple[int]</code>, defaults to <code>8</code>) &#x2014;
The number of heads to use in each attention layer of the motion module.`,name:"motion_num_attention_heads"},{anchor:"diffusers.SparseControlNetModel.concat_conditioning_mask",description:"<strong>concat_conditioning_mask</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;",name:"concat_conditioning_mask"},{anchor:"diffusers.SparseControlNetModel.use_simplified_condition_embedding",description:"<strong>use_simplified_condition_embedding</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;",name:"use_simplified_condition_embedding"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_sparsectrl.py#L96"}}),L=new Z({props:{name:"forward",anchor:"diffusers.SparseControlNetModel.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:": Tensor"},{name:"conditioning_scale",val:": float = 1.0"},{name:"timestep_cond",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"cross_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"conditioning_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"guess_mode",val:": bool = False"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.SparseControlNetModel.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The noisy input tensor.`,name:"sample"},{anchor:"diffusers.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.forward.controlnet_cond",description:`<strong>controlnet_cond</strong> (<code>torch.Tensor</code>) &#x2014;
The conditional input tensor of shape <code>(batch_size, sequence_length, hidden_size)</code>.`,name:"controlnet_cond"},{anchor:"diffusers.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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.SparseControlNetModel.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_sparsectrl.py#L593",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>
`}}),U=new Z({props:{name:"from_unet",anchor:"diffusers.SparseControlNetModel.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"},{name:"conditioning_channels",val:": int = 3"}],parametersDescription:[{anchor:"diffusers.SparseControlNetModel.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_sparsectrl#diffusers.SparseControlNetModel">SparseControlNetModel</a>. All configuration options are also
copied where applicable.`,name:"unet"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_sparsectrl.py#L387"}}),B=new Z({props:{name:"set_attention_slice",anchor:"diffusers.SparseControlNetModel.set_attention_slice",parameters:[{name:"slice_size",val:": typing.Union[str, int, typing.List[int]]"}],parametersDescription:[{anchor:"diffusers.SparseControlNetModel.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_sparsectrl.py#L528"}}),G=new Z({props:{name:"set_attn_processor",anchor:"diffusers.SparseControlNetModel.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.SparseControlNetModel.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_sparsectrl.py#L477"}}),V=new Z({props:{name:"set_default_attn_processor",anchor:"diffusers.SparseControlNetModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnets/controlnet_sparsectrl.py#L512"}}),j=new ve({props:{title:"SparseControlNetOutput",local:"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput",headingTag:"h2"}}),H=new Z({props:{name:"class diffusers.models.controlnet_sparsectrl.SparseControlNetOutput",anchor:"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnet_sparsectrl.py#L30"}}),R=new to({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/controlnet_sparsectrl.md"}}),{c(){A=a("meta"),te=s(),ee=a("p"),se=s(),p(T.$$.fragment),ne=s(),x=a("p"),x.innerHTML=Le,re=s(),N=a("p"),N.innerHTML=Ue,ie=s(),S=a("p"),S.innerHTML=Be,ae=s(),$=a("p"),$.textContent=Ge,de=s(),k=a("p"),k.innerHTML=Ve,le=s(),p(F.$$.fragment),ce=s(),p(D.$$.fragment),pe=s(),p(I.$$.fragment),fe=s(),l=a("div"),p(J.$$.fragment),Pe=s(),X=a("p"),X.innerHTML=je,Me=s(),v=a("div"),p(L.$$.fragment),we=s(),z=a("p"),z.innerHTML=qe,Te=s(),P=a("div"),p(U.$$.fragment),xe=s(),E=a("p"),E.innerHTML=He,Ne=s(),b=a("div"),p(B.$$.fragment),Se=s(),W=a("p"),W.textContent=Re,$e=s(),Y=a("p"),Y.textContent=Ze,ke=s(),M=a("div"),p(G.$$.fragment),Fe=s(),O=a("p"),O.textContent=Xe,De=s(),w=a("div"),p(V.$$.fragment),Ie=s(),K=a("p"),K.textContent=ze,me=s(),p(j.$$.fragment),ue=s(),q=a("div"),p(H.$$.fragment),_e=s(),p(R.$$.fragment),ge=s(),oe=a("p"),this.h()},l(e){const t=eo("svelte-u9bgzb",document.head);A=d(t,"META",{name:!0,content:!0}),t.forEach(o),te=n(e),ee=d(e,"P",{}),y(ee).forEach(o),se=n(e),f(T.$$.fragment,e),ne=n(e),x=d(e,"P",{"data-svelte-h":!0}),h(x)!=="svelte-11my3xx"&&(x.innerHTML=Le),re=n(e),N=d(e,"P",{"data-svelte-h":!0}),h(N)!=="svelte-1v2xz23"&&(N.innerHTML=Ue),ie=n(e),S=d(e,"P",{"data-svelte-h":!0}),h(S)!=="svelte-1pcd88w"&&(S.innerHTML=Be),ae=n(e),$=d(e,"P",{"data-svelte-h":!0}),h($)!=="svelte-1cwsb16"&&($.textContent=Ge),de=n(e),k=d(e,"P",{"data-svelte-h":!0}),h(k)!=="svelte-uew8uc"&&(k.innerHTML=Ve),le=n(e),f(F.$$.fragment,e),ce=n(e),f(D.$$.fragment,e),pe=n(e),f(I.$$.fragment,e),fe=n(e),l=d(e,"DIV",{class:!0});var c=y(l);f(J.$$.fragment,c),Pe=n(c),X=d(c,"P",{"data-svelte-h":!0}),h(X)!=="svelte-1w3vs31"&&(X.innerHTML=je),Me=n(c),v=d(c,"DIV",{class:!0});var be=y(v);f(L.$$.fragment,be),we=n(be),z=d(be,"P",{"data-svelte-h":!0}),h(z)!=="svelte-ul1ug5"&&(z.innerHTML=qe),be.forEach(o),Te=n(c),P=d(c,"DIV",{class:!0});var Ae=y(P);f(U.$$.fragment,Ae),xe=n(Ae),E=d(Ae,"P",{"data-svelte-h":!0}),h(E)!=="svelte-24gfcg"&&(E.innerHTML=He),Ae.forEach(o),Ne=n(c),b=d(c,"DIV",{class:!0});var Q=y(b);f(B.$$.fragment,Q),Se=n(Q),W=d(Q,"P",{"data-svelte-h":!0}),h(W)!=="svelte-7fahc0"&&(W.textContent=Re),$e=n(Q),Y=d(Q,"P",{"data-svelte-h":!0}),h(Y)!=="svelte-1yjwkav"&&(Y.textContent=Ze),Q.forEach(o),ke=n(c),M=d(c,"DIV",{class:!0});var ye=y(M);f(G.$$.fragment,ye),Fe=n(ye),O=d(ye,"P",{"data-svelte-h":!0}),h(O)!=="svelte-1o77hl2"&&(O.textContent=Xe),ye.forEach(o),De=n(c),w=d(c,"DIV",{class:!0});var Ce=y(w);f(V.$$.fragment,Ce),Ie=n(Ce),K=d(Ce,"P",{"data-svelte-h":!0}),h(K)!=="svelte-1lxcwhv"&&(K.textContent=ze),Ce.forEach(o),c.forEach(o),me=n(e),f(j.$$.fragment,e),ue=n(e),q=d(e,"DIV",{class:!0});var Ee=y(q);f(H.$$.fragment,Ee),Ee.forEach(o),_e=n(e),f(R.$$.fragment,e),ge=n(e),oe=d(e,"P",{}),y(oe).forEach(o),this.h()},h(){C(A,"name","hf:doc:metadata"),C(A,"content",no),C(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(q,"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,A),i(e,te,t),i(e,ee,t),i(e,se,t),m(T,e,t),i(e,ne,t),i(e,x,t),i(e,re,t),i(e,N,t),i(e,ie,t),i(e,S,t),i(e,ae,t),i(e,$,t),i(e,de,t),i(e,k,t),i(e,le,t),m(F,e,t),i(e,ce,t),m(D,e,t),i(e,pe,t),m(I,e,t),i(e,fe,t),i(e,l,t),m(J,l,null),r(l,Pe),r(l,X),r(l,Me),r(l,v),m(L,v,null),r(v,we),r(v,z),r(l,Te),r(l,P),m(U,P,null),r(P,xe),r(P,E),r(l,Ne),r(l,b),m(B,b,null),r(b,Se),r(b,W),r(b,$e),r(b,Y),r(l,ke),r(l,M),m(G,M,null),r(M,Fe),r(M,O),r(l,De),r(l,w),m(V,w,null),r(w,Ie),r(w,K),i(e,me,t),m(j,e,t),i(e,ue,t),i(e,q,t),m(H,q,null),i(e,_e,t),m(R,e,t),i(e,ge,t),i(e,oe,t),he=!0},p:Ye,i(e){he||(u(T.$$.fragment,e),u(F.$$.fragment,e),u(D.$$.fragment,e),u(I.$$.fragment,e),u(J.$$.fragment,e),u(L.$$.fragment,e),u(U.$$.fragment,e),u(B.$$.fragment,e),u(G.$$.fragment,e),u(V.$$.fragment,e),u(j.$$.fragment,e),u(H.$$.fragment,e),u(R.$$.fragment,e),he=!0)},o(e){_(T.$$.fragment,e),_(F.$$.fragment,e),_(D.$$.fragment,e),_(I.$$.fragment,e),_(J.$$.fragment,e),_(L.$$.fragment,e),_(U.$$.fragment,e),_(B.$$.fragment,e),_(G.$$.fragment,e),_(V.$$.fragment,e),_(j.$$.fragment,e),_(H.$$.fragment,e),_(R.$$.fragment,e),he=!1},d(e){e&&(o(te),o(ee),o(se),o(ne),o(x),o(re),o(N),o(ie),o(S),o(ae),o($),o(de),o(k),o(le),o(ce),o(pe),o(fe),o(l),o(me),o(ue),o(q),o(_e),o(ge),o(oe)),o(A),g(T,e),g(F,e),g(D,e),g(I,e),g(J),g(L),g(U),g(B),g(G),g(V),g(j,e),g(H),g(R,e)}}}const no='{"title":"SparseControlNetModel","local":"sparsecontrolnetmodel","sections":[{"title":"Example for loading SparseControlNetModel","local":"example-for-loading-sparsecontrolnetmodel","sections":[],"depth":2},{"title":"SparseControlNetModel","local":"diffusers.SparseControlNetModel","sections":[],"depth":2},{"title":"SparseControlNetOutput","local":"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput","sections":[],"depth":2}],"depth":1}';function ro(Je){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fo extends Ke{constructor(A){super(),Qe(this,A,ro,so,We,{})}}export{fo as component};
