import{s as ao,o as lo,n as ro}from"../chunks/scheduler.8c3d61f6.js";import{S as co,i as mo,g as i,s as o,r as p,A as fo,h as r,f as s,c as n,j as x,u,x as l,k as C,y as t,a as c,v as _,d as h,t as g,w as b}from"../chunks/index.da70eac4.js";import{T as io}from"../chunks/Tip.1d9b8c37.js";import{D}from"../chunks/Docstring.6b390b9a.js";import{H as Ie,E as po}from"../chunks/EditOnGithub.1e64e623.js";function uo(ce){let m,w="This API is 🧪 experimental.";return{c(){m=i("p"),m.textContent=w},l(v){m=r(v,"P",{"data-svelte-h":!0}),l(m)!=="svelte-89q1io"&&(m.textContent=w)},m(v,P){c(v,m,P)},p:ro,d(v){v&&s(m)}}}function _o(ce){let m,w="This API is 🧪 experimental.";return{c(){m=i("p"),m.textContent=w},l(v){m=r(v,"P",{"data-svelte-h":!0}),l(m)!=="svelte-89q1io"&&(m.textContent=w)},m(v,P){c(v,m,P)},p:ro,d(v){v&&s(m)}}}function ho(ce){let m,w,v,P,z,Le,V,Ot='The <a href="https://huggingface.co/papers/1505.04597" rel="nofollow">UNet</a> model was originally introduced by Ronneberger et al. for biomedical image segmentation, but it is also commonly used in 🤗 Diffusers because it outputs images that are the same size as the input. It is one of the most important components of a diffusion system because it facilitates the actual diffusion process. There are several variants of the UNet model in 🤗 Diffusers, depending on it’s number of dimensions and whether it is a conditional model or not. This is a 2D UNet conditional model.',je,S,Bt="The abstract from the paper is:",He,E,It='<em>There is large consent that successful training of deep networks requires many thousand annotated training samples. In this paper, we present a network and training strategy that relies on the strong use of data augmentation to use the available annotated samples more efficiently. The architecture consists of a contracting path to capture context and a symmetric expanding path that enables precise localization. We show that such a network can be trained end-to-end from very few images and outperforms the prior best method (a sliding-window convolutional network) on the ISBI challenge for segmentation of neuronal structures in electron microscopic stacks. Using the same network trained on transmitted light microscopy images (phase contrast and DIC) we won the ISBI cell tracking challenge 2015 in these categories by a large margin. Moreover, the network is fast. Segmentation of a 512x512 image takes less than a second on a recent GPU. The full implementation (based on Caffe) and the trained networks are available at <a href="http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net" rel="nofollow">http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net</a>.</em>',ze,G,Ve,a,X,nt,me,Lt=`A conditional 2D UNet model that takes a noisy sample, conditional state, and a timestep and returns a sample
shaped output.`,st,fe,jt=`This model inherits from <a href="/docs/diffusers/pr_10021/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for it’s generic methods implemented
for all models (such as downloading or saving).`,it,F,R,rt,pe,Ht="Disables the FreeU mechanism.",dt,k,K,at,ue,zt='Enables the FreeU mechanism from <a href="https://arxiv.org/abs/2309.11497" rel="nofollow">https://arxiv.org/abs/2309.11497</a>.',lt,_e,Vt="The suffixes after the scaling factors represent the stage blocks where they are being applied.",ct,he,St=`Please refer to the <a href="https://github.com/ChenyangSi/FreeU" rel="nofollow">official repository</a> for combinations of values that
are known to work well for different pipelines such as Stable Diffusion v1, v2, and Stable Diffusion XL.`,mt,q,J,ft,ge,Et='The <a href="/docs/diffusers/pr_10021/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a> forward method.',pt,A,W,ut,be,Gt=`Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, key, value)
are fused. For cross-attention modules, key and value projection matrices are fused.`,_t,O,ht,$,Q,gt,ve,Xt="Enable sliced attention computation.",bt,ye,Rt=`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.`,vt,B,Y,yt,xe,Kt="Sets the attention processor to use to compute attention.",xt,I,Z,Ct,Ce,Jt="Disables custom attention processors and sets the default attention implementation.",Dt,T,ee,kt,De,Wt="Disables the fused QKV projection if enabled.",Nt,L,Se,te,Ee,M,oe,Ut,ke,Qt='The output of <a href="/docs/diffusers/pr_10021/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>.',Ge,ne,Xe,y,se,wt,Ne,Yt=`A conditional 2D UNet model that takes a noisy sample, conditional state, and a timestep and returns a sample
shaped output.`,At,Ue,Zt=`This model inherits from <a href="/docs/diffusers/pr_10021/en/api/models/overview#diffusers.FlaxModelMixin">FlaxModelMixin</a>. Check the superclass documentation for it’s generic methods
implemented for all models (such as downloading or saving).`,$t,we,eo=`This model is also a Flax Linen <a href="https://flax.readthedocs.io/en/latest/flax.linen.html#module" rel="nofollow">flax.linen.Module</a>
subclass. Use it as a regular Flax Linen module and refer to the Flax documentation for all matters related to its
general usage and behavior.`,Tt,Ae,to="Inherent JAX features such as the following are supported:",Mt,$e,oo='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',Re,ie,Ke,U,re,Pt,Te,no='The output of <a href="/docs/diffusers/pr_10021/en/api/models/unet2d-cond#diffusers.FlaxUNet2DConditionModel">FlaxUNet2DConditionModel</a>.',Ft,j,de,qt,Me,so="Returns a new object replacing the specified fields with new values.",Je,ae,We,Be,Qe;return z=new Ie({props:{title:"UNet2DConditionModel",local:"unet2dconditionmodel",headingTag:"h1"}}),G=new Ie({props:{title:"UNet2DConditionModel",local:"diffusers.UNet2DConditionModel",headingTag:"h2"}}),X=new D({props:{name:"class diffusers.UNet2DConditionModel",anchor:"diffusers.UNet2DConditionModel",parameters:[{name:"sample_size",val:": typing.Optional[int] = None"},{name:"in_channels",val:": int = 4"},{name:"out_channels",val:": int = 4"},{name:"center_input_sample",val:": bool = False"},{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:"mid_block_type",val:": typing.Optional[str] = 'UNetMidBlock2DCrossAttn'"},{name:"up_block_types",val:": typing.Tuple[str] = ('UpBlock2D', 'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D')"},{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:": typing.Union[int, typing.Tuple[int]] = 2"},{name:"downsample_padding",val:": int = 1"},{name:"mid_block_scale_factor",val:": float = 1"},{name:"dropout",val:": float = 0.0"},{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:": typing.Union[int, typing.Tuple[int]] = 1280"},{name:"transformer_layers_per_block",val:": typing.Union[int, typing.Tuple[int], typing.Tuple[typing.Tuple]] = 1"},{name:"reverse_transformer_layers_per_block",val:": typing.Optional[typing.Tuple[typing.Tuple[int]]] = None"},{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:"dual_cross_attention",val:": bool = False"},{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:"resnet_skip_time_act",val:": bool = False"},{name:"resnet_out_scale_factor",val:": float = 1.0"},{name:"time_embedding_type",val:": str = 'positional'"},{name:"time_embedding_dim",val:": typing.Optional[int] = None"},{name:"time_embedding_act_fn",val:": typing.Optional[str] = None"},{name:"timestep_post_act",val:": typing.Optional[str] = None"},{name:"time_cond_proj_dim",val:": typing.Optional[int] = None"},{name:"conv_in_kernel",val:": int = 3"},{name:"conv_out_kernel",val:": int = 3"},{name:"projection_class_embeddings_input_dim",val:": typing.Optional[int] = None"},{name:"attention_type",val:": str = 'default'"},{name:"class_embeddings_concat",val:": bool = False"},{name:"mid_block_only_cross_attention",val:": typing.Optional[bool] = None"},{name:"cross_attention_norm",val:": typing.Optional[str] = None"},{name:"addition_embed_type_num_heads",val:": int = 64"}],parametersDescription:[{anchor:"diffusers.UNet2DConditionModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code> or <code>Tuple[int, int]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Height and width of input/output sample.`,name:"sample_size"},{anchor:"diffusers.UNet2DConditionModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; Number of channels in the input sample.",name:"in_channels"},{anchor:"diffusers.UNet2DConditionModel.out_channels",description:"<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; Number of channels in the output.",name:"out_channels"},{anchor:"diffusers.UNet2DConditionModel.center_input_sample",description:"<strong>center_input_sample</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Whether to center the input sample.",name:"center_input_sample"},{anchor:"diffusers.UNet2DConditionModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.UNet2DConditionModel.freq_shift",description:"<strong>freq_shift</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014; The frequency shift to apply to the time embedding.",name:"freq_shift"},{anchor:"diffusers.UNet2DConditionModel.down_block_types",description:`<strong>down_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, 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.UNet2DConditionModel.mid_block_type",description:`<strong>mid_block_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;UNetMidBlock2DCrossAttn&quot;</code>) &#x2014;
Block type for middle of UNet, it can be one of <code>UNetMidBlock2DCrossAttn</code>, <code>UNetMidBlock2D</code>, or
<code>UNetMidBlock2DSimpleCrossAttn</code>. If <code>None</code>, the mid block layer is skipped.`,name:"mid_block_type"},{anchor:"diffusers.UNet2DConditionModel.up_block_types",description:`<strong>up_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;UpBlock2D&quot;, &quot;CrossAttnUpBlock2D&quot;, &quot;CrossAttnUpBlock2D&quot;, &quot;CrossAttnUpBlock2D&quot;)</code>) &#x2014;
The tuple of upsample blocks to use.`,name:"up_block_types"},{anchor:"diffusers.UNet2DConditionModel.only_cross_attention(bool",description:`<strong>only_cross_attention(<code>bool</code></strong> or <code>Tuple[bool]</code>, <em>optional</em>, default to <code>False</code>) &#x2014;
Whether to include self-attention in the basic transformer blocks, see
<code>BasicTransformerBlock</code>.`,name:"only_cross_attention(bool"},{anchor:"diffusers.UNet2DConditionModel.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(320, 640, 1280, 1280)</code>) &#x2014;
The tuple of output channels for each block.`,name:"block_out_channels"},{anchor:"diffusers.UNet2DConditionModel.layers_per_block",description:"<strong>layers_per_block</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014; The number of layers per block.",name:"layers_per_block"},{anchor:"diffusers.UNet2DConditionModel.downsample_padding",description:"<strong>downsample_padding</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The padding to use for the downsampling convolution.",name:"downsample_padding"},{anchor:"diffusers.UNet2DConditionModel.mid_block_scale_factor",description:"<strong>mid_block_scale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014; The scale factor to use for the mid block.",name:"mid_block_scale_factor"},{anchor:"diffusers.UNet2DConditionModel.dropout",description:"<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014; The dropout probability to use.",name:"dropout"},{anchor:"diffusers.UNet2DConditionModel.act_fn",description:"<strong>act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014; The activation function to use.",name:"act_fn"},{anchor:"diffusers.UNet2DConditionModel.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 <code>None</code>, normalization and activation layers is skipped in post-processing.`,name:"norm_num_groups"},{anchor:"diffusers.UNet2DConditionModel.norm_eps",description:"<strong>norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014; The epsilon to use for the normalization.",name:"norm_eps"},{anchor:"diffusers.UNet2DConditionModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>, defaults to 1280) &#x2014;
The dimension of the cross attention features.`,name:"cross_attention_dim"},{anchor:"diffusers.UNet2DConditionModel.transformer_layers_per_block",description:`<strong>transformer_layers_per_block</strong> (<code>int</code>, <code>Tuple[int]</code>, or <code>Tuple[Tuple]</code> , <em>optional</em>, defaults to 1) &#x2014;
The number of transformer blocks of type <code>BasicTransformerBlock</code>. Only relevant for
<code>CrossAttnDownBlock2D</code>, <code>CrossAttnUpBlock2D</code>,
<code>UNetMidBlock2DCrossAttn</code>.`,name:"transformer_layers_per_block"},{anchor:"diffusers.UNet2DConditionModel.reverse_transformer_layers_per_block",description:`<strong>reverse_transformer_layers_per_block</strong>  &#x2014; (<code>Tuple[Tuple]</code>, <em>optional</em>, defaults to None):
The number of transformer blocks of type <code>BasicTransformerBlock</code>, in the upsampling
blocks of the U-Net. Only relevant if <code>transformer_layers_per_block</code> is of type <code>Tuple[Tuple]</code> and for
<code>CrossAttnDownBlock2D</code>, <code>CrossAttnUpBlock2D</code>,
<code>UNetMidBlock2DCrossAttn</code>.`,name:"reverse_transformer_layers_per_block"},{anchor:"diffusers.UNet2DConditionModel.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.UNet2DConditionModel.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.UNet2DConditionModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014; The dimension of the attention heads.",name:"attention_head_dim"},{anchor:"diffusers.UNet2DConditionModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of attention heads. If not defined, defaults to <code>attention_head_dim</code>`,name:"num_attention_heads"},{anchor:"diffusers.UNet2DConditionModel.resnet_time_scale_shift",description:`<strong>resnet_time_scale_shift</strong> (<code>str</code>, <em>optional</em>, 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.UNet2DConditionModel.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 <code>None</code>,
<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.UNet2DConditionModel.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.UNet2DConditionModel.addition_time_embed_dim",description:`<strong>addition_time_embed_dim</strong> &#x2014; (<code>int</code>, <em>optional</em>, defaults to <code>None</code>):
Dimension for the timestep embeddings.`,name:"addition_time_embed_dim"},{anchor:"diffusers.UNet2DConditionModel.num_class_embeds",description:`<strong>num_class_embeds</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#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.UNet2DConditionModel.time_embedding_type",description:`<strong>time_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>positional</code>) &#x2014;
The type of position embedding to use for timesteps. Choose from <code>positional</code> or <code>fourier</code>.`,name:"time_embedding_type"},{anchor:"diffusers.UNet2DConditionModel.time_embedding_dim",description:`<strong>time_embedding_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
An optional override for the dimension of the projected time embedding.`,name:"time_embedding_dim"},{anchor:"diffusers.UNet2DConditionModel.time_embedding_act_fn",description:`<strong>time_embedding_act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Optional activation function to use only once on the time embeddings before they are passed to the rest of
the UNet. Choose from <code>silu</code>, <code>mish</code>, <code>gelu</code>, and <code>swish</code>.`,name:"time_embedding_act_fn"},{anchor:"diffusers.UNet2DConditionModel.timestep_post_act",description:`<strong>timestep_post_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The second activation function to use in timestep embedding. Choose from <code>silu</code>, <code>mish</code> and <code>gelu</code>.`,name:"timestep_post_act"},{anchor:"diffusers.UNet2DConditionModel.time_cond_proj_dim",description:`<strong>time_cond_proj_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The dimension of <code>cond_proj</code> layer in the timestep embedding.`,name:"time_cond_proj_dim"},{anchor:"diffusers.UNet2DConditionModel.conv_in_kernel",description:"<strong>conv_in_kernel</strong> (<code>int</code>, <em>optional</em>, default to <code>3</code>) &#x2014; The kernel size of <code>conv_in</code> layer.",name:"conv_in_kernel"},{anchor:"diffusers.UNet2DConditionModel.conv_out_kernel",description:"<strong>conv_out_kernel</strong> (<code>int</code>, <em>optional</em>, default to <code>3</code>) &#x2014; The kernel size of <code>conv_out</code> layer.",name:"conv_out_kernel"},{anchor:"diffusers.UNet2DConditionModel.projection_class_embeddings_input_dim",description:`<strong>projection_class_embeddings_input_dim</strong> (<code>int</code>, <em>optional</em>) &#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.UNet2DConditionModel.class_embeddings_concat",description:`<strong>class_embeddings_concat</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Whether to concatenate the time
embeddings with the class embeddings.`,name:"class_embeddings_concat"},{anchor:"diffusers.UNet2DConditionModel.mid_block_only_cross_attention",description:`<strong>mid_block_only_cross_attention</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether to use cross attention with the mid block when using the <code>UNetMidBlock2DSimpleCrossAttn</code>. If
<code>only_cross_attention</code> is given as a single boolean and <code>mid_block_only_cross_attention</code> is <code>None</code>, the
<code>only_cross_attention</code> value is used as the value for <code>mid_block_only_cross_attention</code>. Default to <code>False</code>
otherwise.`,name:"mid_block_only_cross_attention"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L71"}}),R=new D({props:{name:"disable_freeu",anchor:"diffusers.UNet2DConditionModel.disable_freeu",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L864"}}),K=new D({props:{name:"enable_freeu",anchor:"diffusers.UNet2DConditionModel.enable_freeu",parameters:[{name:"s1",val:": float"},{name:"s2",val:": float"},{name:"b1",val:": float"},{name:"b2",val:": float"}],parametersDescription:[{anchor:"diffusers.UNet2DConditionModel.enable_freeu.s1",description:`<strong>s1</strong> (<code>float</code>) &#x2014;
Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to
mitigate the &#x201C;oversmoothing effect&#x201D; in the enhanced denoising process.`,name:"s1"},{anchor:"diffusers.UNet2DConditionModel.enable_freeu.s2",description:`<strong>s2</strong> (<code>float</code>) &#x2014;
Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to
mitigate the &#x201C;oversmoothing effect&#x201D; in the enhanced denoising process.`,name:"s2"},{anchor:"diffusers.UNet2DConditionModel.enable_freeu.b1",description:"<strong>b1</strong> (<code>float</code>) &#x2014; Scaling factor for stage 1 to amplify the contributions of backbone features.",name:"b1"},{anchor:"diffusers.UNet2DConditionModel.enable_freeu.b2",description:"<strong>b2</strong> (<code>float</code>) &#x2014; Scaling factor for stage 2 to amplify the contributions of backbone features.",name:"b2"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L840"}}),J=new D({props:{name:"forward",anchor:"diffusers.UNet2DConditionModel.forward",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Union[torch.Tensor, float, int]"},{name:"encoder_hidden_states",val:": Tensor"},{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:"cross_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"added_cond_kwargs",val:": typing.Optional[typing.Dict[str, torch.Tensor]] = None"},{name:"down_block_additional_residuals",val:": typing.Optional[typing.Tuple[torch.Tensor]] = None"},{name:"mid_block_additional_residual",val:": typing.Optional[torch.Tensor] = None"},{name:"down_intrablock_additional_residuals",val:": typing.Optional[typing.Tuple[torch.Tensor]] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.UNet2DConditionModel.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The noisy input tensor with the following shape <code>(batch, channel, height, width)</code>.`,name:"sample"},{anchor:"diffusers.UNet2DConditionModel.forward.timestep",description:"<strong>timestep</strong> (<code>torch.Tensor</code> or <code>float</code> or <code>int</code>) &#x2014; The number of timesteps to denoise an input.",name:"timestep"},{anchor:"diffusers.UNet2DConditionModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
The encoder hidden states with shape <code>(batch, sequence_length, feature_dim)</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.UNet2DConditionModel.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.UNet2DConditionModel.forward.timestep_cond",description:`<strong>timestep_cond</strong> &#x2014; (<code>torch.Tensor</code>, <em>optional</em>, defaults to <code>None</code>):
Conditional embeddings for timestep. If provided, the embeddings will be summed with the samples passed
through the <code>self.time_embedding</code> layer to obtain the timestep embeddings.`,name:"timestep_cond"},{anchor:"diffusers.UNet2DConditionModel.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.UNet2DConditionModel.forward.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.UNet2DConditionModel.forward.added_cond_kwargs",description:`<strong>added_cond_kwargs</strong> &#x2014; (<code>dict</code>, <em>optional</em>):
A kwargs dictionary containing additional embeddings that if specified are added to the embeddings that
are passed along to the UNet blocks.`,name:"added_cond_kwargs"},{anchor:"diffusers.UNet2DConditionModel.forward.down_block_additional_residuals",description:`<strong>down_block_additional_residuals</strong> &#x2014; (<code>tuple</code> of <code>torch.Tensor</code>, <em>optional</em>):
A tuple of tensors that if specified are added to the residuals of down unet blocks.`,name:"down_block_additional_residuals"},{anchor:"diffusers.UNet2DConditionModel.forward.mid_block_additional_residual",description:`<strong>mid_block_additional_residual</strong> &#x2014; (<code>torch.Tensor</code>, <em>optional</em>):
A tensor that if specified is added to the residual of the middle unet block.`,name:"mid_block_additional_residual"},{anchor:"diffusers.UNet2DConditionModel.forward.down_intrablock_additional_residuals",description:`<strong>down_intrablock_additional_residuals</strong> (<code>tuple</code> of <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
additional residuals to be added within UNet down blocks, for example from T2I-Adapter side model(s)`,name:"down_intrablock_additional_residuals"},{anchor:"diffusers.UNet2DConditionModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
A cross-attention mask of shape <code>(batch, sequence_length)</code> is applied to <code>encoder_hidden_states</code>. If
<code>True</code> the mask is kept, otherwise if <code>False</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:"encoder_attention_mask"},{anchor:"diffusers.UNet2DConditionModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/pr_10021/en/api/models/unet2d-cond#diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput">UNet2DConditionOutput</a> instead of a plain
tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L1040",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is True, an <a
  href="/docs/diffusers/pr_10021/en/api/models/unet2d-cond#diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput"
>UNet2DConditionOutput</a> is returned,
otherwise a <code>tuple</code> 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/pr_10021/en/api/models/unet2d-cond#diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput"
>UNet2DConditionOutput</a> or <code>tuple</code></p>
`}}),W=new D({props:{name:"fuse_qkv_projections",anchor:"diffusers.UNet2DConditionModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L872"}}),O=new io({props:{warning:!0,$$slots:{default:[uo]},$$scope:{ctx:ce}}}),Q=new D({props:{name:"set_attention_slice",anchor:"diffusers.UNet2DConditionModel.set_attention_slice",parameters:[{name:"slice_size",val:": typing.Union[str, int, typing.List[int]] = 'auto'"}],parametersDescription:[{anchor:"diffusers.UNet2DConditionModel.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/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L771"}}),Y=new D({props:{name:"set_attn_processor",anchor:"diffusers.UNet2DConditionModel.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.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_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.MochiAttnProcessor2_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.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, 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.AttnProcessorNPU, diffusers.models.attention_processor.AttnProcessor2_0, diffusers.models.attention_processor.MochiVaeAttnProcessor2_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.MochiAttnProcessor2_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.IPAdapterAttnProcessor, diffusers.models.attention_processor.IPAdapterAttnProcessor2_0, diffusers.models.attention_processor.IPAdapterXFormersAttnProcessor, 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.UNet2DConditionModel.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/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L722"}}),Z=new D({props:{name:"set_default_attn_processor",anchor:"diffusers.UNet2DConditionModel.set_default_attn_processor",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L756"}}),ee=new D({props:{name:"unfuse_qkv_projections",anchor:"diffusers.UNet2DConditionModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L897"}}),L=new io({props:{warning:!0,$$slots:{default:[_o]},$$scope:{ctx:ce}}}),te=new Ie({props:{title:"UNet2DConditionOutput",local:"diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput",headingTag:"h2"}}),oe=new D({props:{name:"class diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput",anchor:"diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput",parameters:[{name:"sample",val:": Tensor = None"}],parametersDescription:[{anchor:"diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
The hidden states output conditioned on <code>encoder_hidden_states</code> input. Output of last layer of model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition.py#L58"}}),ne=new Ie({props:{title:"FlaxUNet2DConditionModel",local:"diffusers.FlaxUNet2DConditionModel",headingTag:"h2"}}),se=new D({props:{name:"class diffusers.FlaxUNet2DConditionModel",anchor:"diffusers.FlaxUNet2DConditionModel",parameters:[{name:"sample_size",val:": int = 32"},{name:"in_channels",val:": int = 4"},{name:"out_channels",val:": int = 4"},{name:"down_block_types",val:": typing.Tuple[str, ...] = ('CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'DownBlock2D')"},{name:"up_block_types",val:": typing.Tuple[str, ...] = ('UpBlock2D', 'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D')"},{name:"mid_block_type",val:": typing.Optional[str] = 'UNetMidBlock2DCrossAttn'"},{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:"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:"cross_attention_dim",val:": int = 1280"},{name:"dropout",val:": float = 0.0"},{name:"use_linear_projection",val:": bool = False"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"use_memory_efficient_attention",val:": bool = False"},{name:"split_head_dim",val:": bool = False"},{name:"transformer_layers_per_block",val:": typing.Union[int, typing.Tuple[int, ...]] = 1"},{name:"addition_embed_type",val:": typing.Optional[str] = None"},{name:"addition_time_embed_dim",val:": typing.Optional[int] = None"},{name:"addition_embed_type_num_heads",val:": int = 64"},{name:"projection_class_embeddings_input_dim",val:": typing.Optional[int] = None"},{name:"parent",val:": typing.Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x7fba51d7f2e0>"},{name:"name",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.FlaxUNet2DConditionModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The size of the input sample.`,name:"sample_size"},{anchor:"diffusers.FlaxUNet2DConditionModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of channels in the input sample.`,name:"in_channels"},{anchor:"diffusers.FlaxUNet2DConditionModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.FlaxUNet2DConditionModel.down_block_types",description:`<strong>down_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;FlaxCrossAttnDownBlock2D&quot;, &quot;FlaxCrossAttnDownBlock2D&quot;, &quot;FlaxCrossAttnDownBlock2D&quot;, &quot;FlaxDownBlock2D&quot;)</code>) &#x2014;
The tuple of downsample blocks to use.`,name:"down_block_types"},{anchor:"diffusers.FlaxUNet2DConditionModel.up_block_types",description:`<strong>up_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;FlaxUpBlock2D&quot;, &quot;FlaxCrossAttnUpBlock2D&quot;, &quot;FlaxCrossAttnUpBlock2D&quot;, &quot;FlaxCrossAttnUpBlock2D&quot;)</code>) &#x2014;
The tuple of upsample blocks to use.`,name:"up_block_types"},{anchor:"diffusers.FlaxUNet2DConditionModel.mid_block_type",description:`<strong>mid_block_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;UNetMidBlock2DCrossAttn&quot;</code>) &#x2014;
Block type for middle of UNet, it can be one of <code>UNetMidBlock2DCrossAttn</code>. If <code>None</code>, the mid block layer
is skipped.`,name:"mid_block_type"},{anchor:"diffusers.FlaxUNet2DConditionModel.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(320, 640, 1280, 1280)</code>) &#x2014;
The tuple of output channels for each block.`,name:"block_out_channels"},{anchor:"diffusers.FlaxUNet2DConditionModel.layers_per_block",description:`<strong>layers_per_block</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The number of layers per block.`,name:"layers_per_block"},{anchor:"diffusers.FlaxUNet2DConditionModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>, defaults to 8) &#x2014;
The dimension of the attention heads.`,name:"attention_head_dim"},{anchor:"diffusers.FlaxUNet2DConditionModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code> or <code>Tuple[int]</code>, <em>optional</em>) &#x2014;
The number of attention heads.`,name:"num_attention_heads"},{anchor:"diffusers.FlaxUNet2DConditionModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
The dimension of the cross attention features.`,name:"cross_attention_dim"},{anchor:"diffusers.FlaxUNet2DConditionModel.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0) &#x2014;
Dropout probability for down, up and bottleneck blocks.`,name:"dropout"},{anchor:"diffusers.FlaxUNet2DConditionModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.FlaxUNet2DConditionModel.freq_shift",description:"<strong>freq_shift</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014; The frequency shift to apply to the time embedding.",name:"freq_shift"},{anchor:"diffusers.FlaxUNet2DConditionModel.use_memory_efficient_attention",description:`<strong>use_memory_efficient_attention</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Enable memory efficient attention as described <a href="https://arxiv.org/abs/2112.05682" rel="nofollow">here</a>.`,name:"use_memory_efficient_attention"},{anchor:"diffusers.FlaxUNet2DConditionModel.split_head_dim",description:`<strong>split_head_dim</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to split the head dimension into a new axis for the self-attention computation. In most cases,
enabling this flag should speed up the computation for Stable Diffusion 2.x and Stable Diffusion XL.`,name:"split_head_dim"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition_flax.py#L48"}}),ie=new Ie({props:{title:"FlaxUNet2DConditionOutput",local:"diffusers.models.unets.unet_2d_condition_flax.FlaxUNet2DConditionOutput",headingTag:"h2"}}),re=new D({props:{name:"class diffusers.models.unets.unet_2d_condition_flax.FlaxUNet2DConditionOutput",anchor:"diffusers.models.unets.unet_2d_condition_flax.FlaxUNet2DConditionOutput",parameters:[{name:"sample",val:": Array"}],parametersDescription:[{anchor:"diffusers.models.unets.unet_2d_condition_flax.FlaxUNet2DConditionOutput.sample",description:`<strong>sample</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
The hidden states output conditioned on <code>encoder_hidden_states</code> input. Output of last layer of model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/diffusers/models/unets/unet_2d_condition_flax.py#L35"}}),de=new D({props:{name:"replace",anchor:"diffusers.models.unets.unet_2d_condition_flax.FlaxUNet2DConditionOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_10021/src/flax/struct.py#L144"}}),ae=new po({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/unet2d-cond.md"}}),{c(){m=i("meta"),w=o(),v=i("p"),P=o(),p(z.$$.fragment),Le=o(),V=i("p"),V.innerHTML=Ot,je=o(),S=i("p"),S.textContent=Bt,He=o(),E=i("p"),E.innerHTML=It,ze=o(),p(G.$$.fragment),Ve=o(),a=i("div"),p(X.$$.fragment),nt=o(),me=i("p"),me.textContent=Lt,st=o(),fe=i("p"),fe.innerHTML=jt,it=o(),F=i("div"),p(R.$$.fragment),rt=o(),pe=i("p"),pe.textContent=Ht,dt=o(),k=i("div"),p(K.$$.fragment),at=o(),ue=i("p"),ue.innerHTML=zt,lt=o(),_e=i("p"),_e.textContent=Vt,ct=o(),he=i("p"),he.innerHTML=St,mt=o(),q=i("div"),p(J.$$.fragment),ft=o(),ge=i("p"),ge.innerHTML=Et,pt=o(),A=i("div"),p(W.$$.fragment),ut=o(),be=i("p"),be.textContent=Gt,_t=o(),p(O.$$.fragment),ht=o(),$=i("div"),p(Q.$$.fragment),gt=o(),ve=i("p"),ve.textContent=Xt,bt=o(),ye=i("p"),ye.textContent=Rt,vt=o(),B=i("div"),p(Y.$$.fragment),yt=o(),xe=i("p"),xe.textContent=Kt,xt=o(),I=i("div"),p(Z.$$.fragment),Ct=o(),Ce=i("p"),Ce.textContent=Jt,Dt=o(),T=i("div"),p(ee.$$.fragment),kt=o(),De=i("p"),De.textContent=Wt,Nt=o(),p(L.$$.fragment),Se=o(),p(te.$$.fragment),Ee=o(),M=i("div"),p(oe.$$.fragment),Ut=o(),ke=i("p"),ke.innerHTML=Qt,Ge=o(),p(ne.$$.fragment),Xe=o(),y=i("div"),p(se.$$.fragment),wt=o(),Ne=i("p"),Ne.textContent=Yt,At=o(),Ue=i("p"),Ue.innerHTML=Zt,$t=o(),we=i("p"),we.innerHTML=eo,Tt=o(),Ae=i("p"),Ae.textContent=to,Mt=o(),$e=i("ul"),$e.innerHTML=oo,Re=o(),p(ie.$$.fragment),Ke=o(),U=i("div"),p(re.$$.fragment),Pt=o(),Te=i("p"),Te.innerHTML=no,Ft=o(),j=i("div"),p(de.$$.fragment),qt=o(),Me=i("p"),Me.textContent=so,Je=o(),p(ae.$$.fragment),We=o(),Be=i("p"),this.h()},l(e){const d=fo("svelte-u9bgzb",document.head);m=r(d,"META",{name:!0,content:!0}),d.forEach(s),w=n(e),v=r(e,"P",{}),x(v).forEach(s),P=n(e),u(z.$$.fragment,e),Le=n(e),V=r(e,"P",{"data-svelte-h":!0}),l(V)!=="svelte-1wycdgn"&&(V.innerHTML=Ot),je=n(e),S=r(e,"P",{"data-svelte-h":!0}),l(S)!=="svelte-1cwsb16"&&(S.textContent=Bt),He=n(e),E=r(e,"P",{"data-svelte-h":!0}),l(E)!=="svelte-12epiox"&&(E.innerHTML=It),ze=n(e),u(G.$$.fragment,e),Ve=n(e),a=r(e,"DIV",{class:!0});var f=x(a);u(X.$$.fragment,f),nt=n(f),me=r(f,"P",{"data-svelte-h":!0}),l(me)!=="svelte-15rls8d"&&(me.textContent=Lt),st=n(f),fe=r(f,"P",{"data-svelte-h":!0}),l(fe)!=="svelte-4kemio"&&(fe.innerHTML=jt),it=n(f),F=r(f,"DIV",{class:!0});var le=x(F);u(R.$$.fragment,le),rt=n(le),pe=r(le,"P",{"data-svelte-h":!0}),l(pe)!=="svelte-1d0rkng"&&(pe.textContent=Ht),le.forEach(s),dt=n(f),k=r(f,"DIV",{class:!0});var H=x(k);u(K.$$.fragment,H),at=n(H),ue=r(H,"P",{"data-svelte-h":!0}),l(ue)!=="svelte-4p7kn0"&&(ue.innerHTML=zt),lt=n(H),_e=r(H,"P",{"data-svelte-h":!0}),l(_e)!=="svelte-1t9gjdi"&&(_e.textContent=Vt),ct=n(H),he=r(H,"P",{"data-svelte-h":!0}),l(he)!=="svelte-tw05zf"&&(he.innerHTML=St),H.forEach(s),mt=n(f),q=r(f,"DIV",{class:!0});var Ye=x(q);u(J.$$.fragment,Ye),ft=n(Ye),ge=r(Ye,"P",{"data-svelte-h":!0}),l(ge)!=="svelte-1e6tmgk"&&(ge.innerHTML=Et),Ye.forEach(s),pt=n(f),A=r(f,"DIV",{class:!0});var Pe=x(A);u(W.$$.fragment,Pe),ut=n(Pe),be=r(Pe,"P",{"data-svelte-h":!0}),l(be)!=="svelte-1254b9i"&&(be.textContent=Gt),_t=n(Pe),u(O.$$.fragment,Pe),Pe.forEach(s),ht=n(f),$=r(f,"DIV",{class:!0});var Fe=x($);u(Q.$$.fragment,Fe),gt=n(Fe),ve=r(Fe,"P",{"data-svelte-h":!0}),l(ve)!=="svelte-7fahc0"&&(ve.textContent=Xt),bt=n(Fe),ye=r(Fe,"P",{"data-svelte-h":!0}),l(ye)!=="svelte-1yjwkav"&&(ye.textContent=Rt),Fe.forEach(s),vt=n(f),B=r(f,"DIV",{class:!0});var Ze=x(B);u(Y.$$.fragment,Ze),yt=n(Ze),xe=r(Ze,"P",{"data-svelte-h":!0}),l(xe)!=="svelte-1o77hl2"&&(xe.textContent=Kt),Ze.forEach(s),xt=n(f),I=r(f,"DIV",{class:!0});var et=x(I);u(Z.$$.fragment,et),Ct=n(et),Ce=r(et,"P",{"data-svelte-h":!0}),l(Ce)!=="svelte-1lxcwhv"&&(Ce.textContent=Jt),et.forEach(s),Dt=n(f),T=r(f,"DIV",{class:!0});var qe=x(T);u(ee.$$.fragment,qe),kt=n(qe),De=r(qe,"P",{"data-svelte-h":!0}),l(De)!=="svelte-1vhtc74"&&(De.textContent=Wt),Nt=n(qe),u(L.$$.fragment,qe),qe.forEach(s),f.forEach(s),Se=n(e),u(te.$$.fragment,e),Ee=n(e),M=r(e,"DIV",{class:!0});var tt=x(M);u(oe.$$.fragment,tt),Ut=n(tt),ke=r(tt,"P",{"data-svelte-h":!0}),l(ke)!=="svelte-1cxpeig"&&(ke.innerHTML=Qt),tt.forEach(s),Ge=n(e),u(ne.$$.fragment,e),Xe=n(e),y=r(e,"DIV",{class:!0});var N=x(y);u(se.$$.fragment,N),wt=n(N),Ne=r(N,"P",{"data-svelte-h":!0}),l(Ne)!=="svelte-15rls8d"&&(Ne.textContent=Yt),At=n(N),Ue=r(N,"P",{"data-svelte-h":!0}),l(Ue)!=="svelte-fpm8lq"&&(Ue.innerHTML=Zt),$t=n(N),we=r(N,"P",{"data-svelte-h":!0}),l(we)!=="svelte-11x0x4w"&&(we.innerHTML=eo),Tt=n(N),Ae=r(N,"P",{"data-svelte-h":!0}),l(Ae)!=="svelte-ngiliw"&&(Ae.textContent=to),Mt=n(N),$e=r(N,"UL",{"data-svelte-h":!0}),l($e)!=="svelte-1w7z84m"&&($e.innerHTML=oo),N.forEach(s),Re=n(e),u(ie.$$.fragment,e),Ke=n(e),U=r(e,"DIV",{class:!0});var Oe=x(U);u(re.$$.fragment,Oe),Pt=n(Oe),Te=r(Oe,"P",{"data-svelte-h":!0}),l(Te)!=="svelte-yloz4a"&&(Te.innerHTML=no),Ft=n(Oe),j=r(Oe,"DIV",{class:!0});var ot=x(j);u(de.$$.fragment,ot),qt=n(ot),Me=r(ot,"P",{"data-svelte-h":!0}),l(Me)!=="svelte-brjshm"&&(Me.textContent=so),ot.forEach(s),Oe.forEach(s),Je=n(e),u(ae.$$.fragment,e),We=n(e),Be=r(e,"P",{}),x(Be).forEach(s),this.h()},h(){C(m,"name","hf:doc:metadata"),C(m,"content",go),C(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(k,"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"),C(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C($,"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(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(a,"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(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(U,"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,d){t(document.head,m),c(e,w,d),c(e,v,d),c(e,P,d),_(z,e,d),c(e,Le,d),c(e,V,d),c(e,je,d),c(e,S,d),c(e,He,d),c(e,E,d),c(e,ze,d),_(G,e,d),c(e,Ve,d),c(e,a,d),_(X,a,null),t(a,nt),t(a,me),t(a,st),t(a,fe),t(a,it),t(a,F),_(R,F,null),t(F,rt),t(F,pe),t(a,dt),t(a,k),_(K,k,null),t(k,at),t(k,ue),t(k,lt),t(k,_e),t(k,ct),t(k,he),t(a,mt),t(a,q),_(J,q,null),t(q,ft),t(q,ge),t(a,pt),t(a,A),_(W,A,null),t(A,ut),t(A,be),t(A,_t),_(O,A,null),t(a,ht),t(a,$),_(Q,$,null),t($,gt),t($,ve),t($,bt),t($,ye),t(a,vt),t(a,B),_(Y,B,null),t(B,yt),t(B,xe),t(a,xt),t(a,I),_(Z,I,null),t(I,Ct),t(I,Ce),t(a,Dt),t(a,T),_(ee,T,null),t(T,kt),t(T,De),t(T,Nt),_(L,T,null),c(e,Se,d),_(te,e,d),c(e,Ee,d),c(e,M,d),_(oe,M,null),t(M,Ut),t(M,ke),c(e,Ge,d),_(ne,e,d),c(e,Xe,d),c(e,y,d),_(se,y,null),t(y,wt),t(y,Ne),t(y,At),t(y,Ue),t(y,$t),t(y,we),t(y,Tt),t(y,Ae),t(y,Mt),t(y,$e),c(e,Re,d),_(ie,e,d),c(e,Ke,d),c(e,U,d),_(re,U,null),t(U,Pt),t(U,Te),t(U,Ft),t(U,j),_(de,j,null),t(j,qt),t(j,Me),c(e,Je,d),_(ae,e,d),c(e,We,d),c(e,Be,d),Qe=!0},p(e,[d]){const f={};d&2&&(f.$$scope={dirty:d,ctx:e}),O.$set(f);const le={};d&2&&(le.$$scope={dirty:d,ctx:e}),L.$set(le)},i(e){Qe||(h(z.$$.fragment,e),h(G.$$.fragment,e),h(X.$$.fragment,e),h(R.$$.fragment,e),h(K.$$.fragment,e),h(J.$$.fragment,e),h(W.$$.fragment,e),h(O.$$.fragment,e),h(Q.$$.fragment,e),h(Y.$$.fragment,e),h(Z.$$.fragment,e),h(ee.$$.fragment,e),h(L.$$.fragment,e),h(te.$$.fragment,e),h(oe.$$.fragment,e),h(ne.$$.fragment,e),h(se.$$.fragment,e),h(ie.$$.fragment,e),h(re.$$.fragment,e),h(de.$$.fragment,e),h(ae.$$.fragment,e),Qe=!0)},o(e){g(z.$$.fragment,e),g(G.$$.fragment,e),g(X.$$.fragment,e),g(R.$$.fragment,e),g(K.$$.fragment,e),g(J.$$.fragment,e),g(W.$$.fragment,e),g(O.$$.fragment,e),g(Q.$$.fragment,e),g(Y.$$.fragment,e),g(Z.$$.fragment,e),g(ee.$$.fragment,e),g(L.$$.fragment,e),g(te.$$.fragment,e),g(oe.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(ie.$$.fragment,e),g(re.$$.fragment,e),g(de.$$.fragment,e),g(ae.$$.fragment,e),Qe=!1},d(e){e&&(s(w),s(v),s(P),s(Le),s(V),s(je),s(S),s(He),s(E),s(ze),s(Ve),s(a),s(Se),s(Ee),s(M),s(Ge),s(Xe),s(y),s(Re),s(Ke),s(U),s(Je),s(We),s(Be)),s(m),b(z,e),b(G,e),b(X),b(R),b(K),b(J),b(W),b(O),b(Q),b(Y),b(Z),b(ee),b(L),b(te,e),b(oe),b(ne,e),b(se),b(ie,e),b(re),b(de),b(ae,e)}}}const go='{"title":"UNet2DConditionModel","local":"unet2dconditionmodel","sections":[{"title":"UNet2DConditionModel","local":"diffusers.UNet2DConditionModel","sections":[],"depth":2},{"title":"UNet2DConditionOutput","local":"diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput","sections":[],"depth":2},{"title":"FlaxUNet2DConditionModel","local":"diffusers.FlaxUNet2DConditionModel","sections":[],"depth":2},{"title":"FlaxUNet2DConditionOutput","local":"diffusers.models.unets.unet_2d_condition_flax.FlaxUNet2DConditionOutput","sections":[],"depth":2}],"depth":1}';function bo(ce){return lo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ko extends co{constructor(m){super(),mo(this,m,bo,ho,ao,{})}}export{ko as component};
