import{s as Qe,n as Ke,o as eo}from"../chunks/scheduler.8c3d61f6.js";import{S as oo,i as to,g as i,s as n,r as p,A as no,h as l,f as o,c as s,j as C,u as m,x as f,k as M,y as r,a,v as u,d as _,t as h,w as g}from"../chunks/index.da70eac4.js";import{D as P}from"../chunks/Docstring.6b390b9a.js";import{C as so}from"../chunks/CodeBlock.00a903b3.js";import{H as Ne,E as ro}from"../chunks/EditOnGithub.1e64e623.js";function ao(Le){let v,ne,oe,se,k,re,$,Ze='SparseControlNetModel is an implementation of ControlNet for <a href="https://arxiv.org/abs/2307.04725" rel="nofollow">AnimateDiff</a>.',ae,S,ze='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,D,Oe='The SparseCtrl version of ControlNet was introduced in <a href="https://arxiv.org/abs/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.',le,B,He="The abstract from the paper is:",de,I,Fe='<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>',ce,J,pe,U,me,j,fe,d,q,xe,R,Ee=`A SparseControlNet model as described in <a href="https://arxiv.org/abs/2311.16933" rel="nofollow">SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion
Models</a>.`,ye,T,A,ke,V,Pe='The <a href="/docs/diffusers/main/en/api/models/controlnet_sparsectrl#diffusers.SparseControlNetModel">SparseControlNetModel</a> forward method.',$e,N,L,Se,W,Re='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>.',De,b,Z,Be,Y,Ve="Enable sliced attention computation.",Ie,G,We=`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.`,Je,x,z,Ue,X,Ye="Sets the attention processor to use to compute attention.",je,y,O,qe,Q,Ge="Disables custom attention processors and sets the default attention implementation.",ue,H,_e,w,F,Ae,K,Xe='The output of <a href="/docs/diffusers/main/en/api/models/controlnet_sparsectrl#diffusers.SparseControlNetModel">SparseControlNetModel</a>.',he,E,ge,te,be;return k=new Ne({props:{title:"SparseControlNetModel",local:"sparsecontrolnetmodel",headingTag:"h1"}}),J=new Ne({props:{title:"Example for loading SparseControlNetModel",local:"example-for-loading-sparsecontrolnetmodel",headingTag:"h2"}}),U=new so({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}}),j=new Ne({props:{title:"SparseControlNetModel",local:"diffusers.SparseControlNetModel",headingTag:"h2"}}),q=new P({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:": Tuple = ('CrossAttnDownBlockMotion', 'CrossAttnDownBlockMotion', 'CrossAttnDownBlockMotion', 'DownBlockMotion')"},{name:"only_cross_attention",val:": Union = False"},{name:"block_out_channels",val:": Tuple = (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:": Optional = 32"},{name:"norm_eps",val:": float = 1e-05"},{name:"cross_attention_dim",val:": int = 768"},{name:"transformer_layers_per_block",val:": Union = 1"},{name:"transformer_layers_per_mid_block",val:": Union = None"},{name:"temporal_transformer_layers_per_block",val:": Union = 1"},{name:"attention_head_dim",val:": Union = 8"},{name:"num_attention_heads",val:": Union = 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:": Optional = (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/controlnet_sparsectrl.py#L96"}}),A=new P({props:{name:"forward",anchor:"diffusers.SparseControlNetModel.forward",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": Union"},{name:"encoder_hidden_states",val:": Tensor"},{name:"controlnet_cond",val:": Tensor"},{name:"conditioning_scale",val:": float = 1.0"},{name:"timestep_cond",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"cross_attention_kwargs",val:": Optional = None"},{name:"conditioning_mask",val:": Optional = 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 <a href="/docs/diffusers/main/en/api/models/controlnet#diffusers.models.controlnet.ControlNetOutput">ControlNetOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnet_sparsectrl.py#L597",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, a <a
  href="/docs/diffusers/main/en/api/models/controlnet#diffusers.models.controlnet.ControlNetOutput"
>ControlNetOutput</a> 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><a
  href="/docs/diffusers/main/en/api/models/controlnet#diffusers.models.controlnet.ControlNetOutput"
>ControlNetOutput</a> <strong>or</strong> <code>tuple</code></p>
`}}),L=new P({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:": Optional = (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/controlnet_sparsectrl.py#L387"}}),Z=new P({props:{name:"set_attention_slice",anchor:"diffusers.SparseControlNetModel.set_attention_slice",parameters:[{name:"slice_size",val:": Union"}],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/controlnet_sparsectrl.py#L528"}}),z=new P({props:{name:"set_attn_processor",anchor:"diffusers.SparseControlNetModel.set_attn_processor",parameters:[{name:"processor",val:": Union"}],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/controlnet_sparsectrl.py#L477"}}),O=new P({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/controlnet_sparsectrl.py#L512"}}),H=new Ne({props:{title:"SparseControlNetOutput",local:"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput",headingTag:"h2"}}),F=new P({props:{name:"class diffusers.models.controlnet_sparsectrl.SparseControlNetOutput",anchor:"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput",parameters:[{name:"down_block_res_samples",val:": Tuple"},{name:"mid_block_res_sample",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput.down_block_res_samples",description:`<strong>down_block_res_samples</strong> (<code>tuple[torch.Tensor]</code>) &#x2014;
A tuple of downsample activations at different resolutions for each downsampling block. Each tensor should
be of shape <code>(batch_size, channel * resolution, height //resolution, width // resolution)</code>. Output can be
used to condition the original UNet&#x2019;s downsampling activations.`,name:"down_block_res_samples"},{anchor:"diffusers.models.controlnet_sparsectrl.SparseControlNetOutput.mid_down_block_re_sample",description:`<strong>mid_down_block_re_sample</strong> (<code>torch.Tensor</code>) &#x2014;
The activation of the middle block (the lowest sample resolution). Each tensor should be of shape
<code>(batch_size, channel * lowest_resolution, height // lowest_resolution, width // lowest_resolution)</code>.
Output can be used to condition the original UNet&#x2019;s middle block activation.`,name:"mid_down_block_re_sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/controlnet_sparsectrl.py#L42"}}),E=new ro({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/controlnet_sparsectrl.md"}}),{c(){v=i("meta"),ne=n(),oe=i("p"),se=n(),p(k.$$.fragment),re=n(),$=i("p"),$.innerHTML=Ze,ae=n(),S=i("p"),S.innerHTML=ze,ie=n(),D=i("p"),D.innerHTML=Oe,le=n(),B=i("p"),B.textContent=He,de=n(),I=i("p"),I.innerHTML=Fe,ce=n(),p(J.$$.fragment),pe=n(),p(U.$$.fragment),me=n(),p(j.$$.fragment),fe=n(),d=i("div"),p(q.$$.fragment),xe=n(),R=i("p"),R.innerHTML=Ee,ye=n(),T=i("div"),p(A.$$.fragment),ke=n(),V=i("p"),V.innerHTML=Pe,$e=n(),N=i("div"),p(L.$$.fragment),Se=n(),W=i("p"),W.innerHTML=Re,De=n(),b=i("div"),p(Z.$$.fragment),Be=n(),Y=i("p"),Y.textContent=Ve,Ie=n(),G=i("p"),G.textContent=We,Je=n(),x=i("div"),p(z.$$.fragment),Ue=n(),X=i("p"),X.textContent=Ye,je=n(),y=i("div"),p(O.$$.fragment),qe=n(),Q=i("p"),Q.textContent=Ge,ue=n(),p(H.$$.fragment),_e=n(),w=i("div"),p(F.$$.fragment),Ae=n(),K=i("p"),K.innerHTML=Xe,he=n(),p(E.$$.fragment),ge=n(),te=i("p"),this.h()},l(e){const t=no("svelte-u9bgzb",document.head);v=l(t,"META",{name:!0,content:!0}),t.forEach(o),ne=s(e),oe=l(e,"P",{}),C(oe).forEach(o),se=s(e),m(k.$$.fragment,e),re=s(e),$=l(e,"P",{"data-svelte-h":!0}),f($)!=="svelte-3bkh7w"&&($.innerHTML=Ze),ae=s(e),S=l(e,"P",{"data-svelte-h":!0}),f(S)!=="svelte-1v2xz23"&&(S.innerHTML=ze),ie=s(e),D=l(e,"P",{"data-svelte-h":!0}),f(D)!=="svelte-1jv73o9"&&(D.innerHTML=Oe),le=s(e),B=l(e,"P",{"data-svelte-h":!0}),f(B)!=="svelte-1cwsb16"&&(B.textContent=He),de=s(e),I=l(e,"P",{"data-svelte-h":!0}),f(I)!=="svelte-uew8uc"&&(I.innerHTML=Fe),ce=s(e),m(J.$$.fragment,e),pe=s(e),m(U.$$.fragment,e),me=s(e),m(j.$$.fragment,e),fe=s(e),d=l(e,"DIV",{class:!0});var c=C(d);m(q.$$.fragment,c),xe=s(c),R=l(c,"P",{"data-svelte-h":!0}),f(R)!=="svelte-1kqamro"&&(R.innerHTML=Ee),ye=s(c),T=l(c,"DIV",{class:!0});var ve=C(T);m(A.$$.fragment,ve),ke=s(ve),V=l(ve,"P",{"data-svelte-h":!0}),f(V)!=="svelte-ul1ug5"&&(V.innerHTML=Pe),ve.forEach(o),$e=s(c),N=l(c,"DIV",{class:!0});var we=C(N);m(L.$$.fragment,we),Se=s(we),W=l(we,"P",{"data-svelte-h":!0}),f(W)!=="svelte-24gfcg"&&(W.innerHTML=Re),we.forEach(o),De=s(c),b=l(c,"DIV",{class:!0});var ee=C(b);m(Z.$$.fragment,ee),Be=s(ee),Y=l(ee,"P",{"data-svelte-h":!0}),f(Y)!=="svelte-7fahc0"&&(Y.textContent=Ve),Ie=s(ee),G=l(ee,"P",{"data-svelte-h":!0}),f(G)!=="svelte-1yjwkav"&&(G.textContent=We),ee.forEach(o),Je=s(c),x=l(c,"DIV",{class:!0});var Ce=C(x);m(z.$$.fragment,Ce),Ue=s(Ce),X=l(Ce,"P",{"data-svelte-h":!0}),f(X)!=="svelte-1o77hl2"&&(X.textContent=Ye),Ce.forEach(o),je=s(c),y=l(c,"DIV",{class:!0});var Me=C(y);m(O.$$.fragment,Me),qe=s(Me),Q=l(Me,"P",{"data-svelte-h":!0}),f(Q)!=="svelte-1lxcwhv"&&(Q.textContent=Ge),Me.forEach(o),c.forEach(o),ue=s(e),m(H.$$.fragment,e),_e=s(e),w=l(e,"DIV",{class:!0});var Te=C(w);m(F.$$.fragment,Te),Ae=s(Te),K=l(Te,"P",{"data-svelte-h":!0}),f(K)!=="svelte-1icr6r1"&&(K.innerHTML=Xe),Te.forEach(o),he=s(e),m(E.$$.fragment,e),ge=s(e),te=l(e,"P",{}),C(te).forEach(o),this.h()},h(){M(v,"name","hf:doc:metadata"),M(v,"content",io),M(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(w,"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,v),a(e,ne,t),a(e,oe,t),a(e,se,t),u(k,e,t),a(e,re,t),a(e,$,t),a(e,ae,t),a(e,S,t),a(e,ie,t),a(e,D,t),a(e,le,t),a(e,B,t),a(e,de,t),a(e,I,t),a(e,ce,t),u(J,e,t),a(e,pe,t),u(U,e,t),a(e,me,t),u(j,e,t),a(e,fe,t),a(e,d,t),u(q,d,null),r(d,xe),r(d,R),r(d,ye),r(d,T),u(A,T,null),r(T,ke),r(T,V),r(d,$e),r(d,N),u(L,N,null),r(N,Se),r(N,W),r(d,De),r(d,b),u(Z,b,null),r(b,Be),r(b,Y),r(b,Ie),r(b,G),r(d,Je),r(d,x),u(z,x,null),r(x,Ue),r(x,X),r(d,je),r(d,y),u(O,y,null),r(y,qe),r(y,Q),a(e,ue,t),u(H,e,t),a(e,_e,t),a(e,w,t),u(F,w,null),r(w,Ae),r(w,K),a(e,he,t),u(E,e,t),a(e,ge,t),a(e,te,t),be=!0},p:Ke,i(e){be||(_(k.$$.fragment,e),_(J.$$.fragment,e),_(U.$$.fragment,e),_(j.$$.fragment,e),_(q.$$.fragment,e),_(A.$$.fragment,e),_(L.$$.fragment,e),_(Z.$$.fragment,e),_(z.$$.fragment,e),_(O.$$.fragment,e),_(H.$$.fragment,e),_(F.$$.fragment,e),_(E.$$.fragment,e),be=!0)},o(e){h(k.$$.fragment,e),h(J.$$.fragment,e),h(U.$$.fragment,e),h(j.$$.fragment,e),h(q.$$.fragment,e),h(A.$$.fragment,e),h(L.$$.fragment,e),h(Z.$$.fragment,e),h(z.$$.fragment,e),h(O.$$.fragment,e),h(H.$$.fragment,e),h(F.$$.fragment,e),h(E.$$.fragment,e),be=!1},d(e){e&&(o(ne),o(oe),o(se),o(re),o($),o(ae),o(S),o(ie),o(D),o(le),o(B),o(de),o(I),o(ce),o(pe),o(me),o(fe),o(d),o(ue),o(_e),o(w),o(he),o(ge),o(te)),o(v),g(k,e),g(J,e),g(U,e),g(j,e),g(q),g(A),g(L),g(Z),g(z),g(O),g(H,e),g(F),g(E,e)}}}const io='{"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 lo(Le){return eo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _o extends oo{constructor(v){super(),to(this,v,lo,ao,Qe,{})}}export{_o as component};
