Buckets:
| import"../chunks/DsnmJJEf.js";import{i as v,h as x,C as M,H as m,D as f,E as w,s as y}from"../chunks/BtE7mKSK.js";import{p as z,o as k,s as e,f as L,a as c,b as N,c as p,d as _,n as u,r as h}from"../chunks/jDjavuwI.js";const A='{"title":"DiTTransformer2DModel","local":"dittransformer2dmodel","sections":[{"title":"DiTTransformer2DModel","local":"diffusers.DiTTransformer2DModel","sections":[],"depth":2}],"depth":1}';var O=_('<meta name="hf:doc:metadata"/>'),C=_('<p></p> <!> <!> <p>A Transformer model for image-like data from <a href="https://huggingface.co/papers/2212.09748" rel="nofollow">DiT</a>.</p> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>A 2D Transformer model as introduced in DiT (<a href="https://huggingface.co/papers/2212.09748" rel="nofollow">https://huggingface.co/papers/2212.09748</a>).</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/diffusers/pr_14358/en/api/models/dit_transformer2d#diffusers.DiTTransformer2DModel">DiTTransformer2DModel</a> forward method.</p></div></div> <!> <p></p>',1);function I(g,T){z(T,!1),k(()=>{new URLSearchParams(window.location.search).get("fw")}),v();var n=C();x("mo84v8",d=>{var l=O();y(l,"content",A),c(d,l)});var r=e(L(n),2);M(r,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var t=e(r,2);m(t,{title:"DiTTransformer2DModel",local:"dittransformer2dmodel",headingTag:"h1"});var a=e(t,4);m(a,{title:"DiTTransformer2DModel",local:"diffusers.DiTTransformer2DModel",headingTag:"h2"});var o=e(a,2),s=p(o);f(s,{name:"class diffusers.DiTTransformer2DModel",anchor:"diffusers.DiTTransformer2DModel",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/models/transformers/dit_transformer_2d.py#L31",parameters:[{name:"num_attention_heads",val:": int = 16"},{name:"attention_head_dim",val:": int = 72"},{name:"in_channels",val:": int = 4"},{name:"out_channels",val:": int | None = None"},{name:"num_layers",val:": int = 28"},{name:"dropout",val:": float = 0.0"},{name:"norm_num_groups",val:": int = 32"},{name:"attention_bias",val:": bool = True"},{name:"sample_size",val:": int = 32"},{name:"patch_size",val:": int = 2"},{name:"activation_fn",val:": str = 'gelu-approximate'"},{name:"num_embeds_ada_norm",val:": int | None = 1000"},{name:"upcast_attention",val:": bool = False"},{name:"norm_type",val:": str = 'ada_norm_zero'"},{name:"norm_elementwise_affine",val:": bool = False"},{name:"norm_eps",val:": float = 1e-05"}],parametersDescription:[{anchor:"diffusers.DiTTransformer2DModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (int, optional, defaults to 16) — The number of heads to use for multi-head attention.",name:"num_attention_heads"},{anchor:"diffusers.DiTTransformer2DModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (int, optional, defaults to 72) — The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.DiTTransformer2DModel.in_channels",description:"<strong>in_channels</strong> (int, defaults to 4) — The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.DiTTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (int, optional) — | |
| The number of channels in the output. Specify this parameter if the output channel number differs from the | |
| input.`,name:"out_channels"},{anchor:"diffusers.DiTTransformer2DModel.num_layers",description:"<strong>num_layers</strong> (int, optional, defaults to 28) — The number of layers of Transformer blocks to use.",name:"num_layers"},{anchor:"diffusers.DiTTransformer2DModel.dropout",description:"<strong>dropout</strong> (float, optional, defaults to 0.0) — The dropout probability to use within the Transformer blocks.",name:"dropout"},{anchor:"diffusers.DiTTransformer2DModel.norm_num_groups",description:`<strong>norm_num_groups</strong> (int, optional, defaults to 32) — | |
| Number of groups for group normalization within Transformer blocks.`,name:"norm_num_groups"},{anchor:"diffusers.DiTTransformer2DModel.attention_bias",description:`<strong>attention_bias</strong> (bool, optional, defaults to True) — | |
| Configure if the Transformer blocks’ attention should contain a bias parameter.`,name:"attention_bias"},{anchor:"diffusers.DiTTransformer2DModel.sample_size",description:`<strong>sample_size</strong> (int, defaults to 32) — | |
| The width of the latent images. This parameter is fixed during training.`,name:"sample_size"},{anchor:"diffusers.DiTTransformer2DModel.patch_size",description:`<strong>patch_size</strong> (int, defaults to 2) — | |
| Size of the patches the model processes, relevant for architectures working on non-sequential data.`,name:"patch_size"},{anchor:"diffusers.DiTTransformer2DModel.activation_fn",description:`<strong>activation_fn</strong> (str, optional, defaults to “gelu-approximate”) — | |
| Activation function to use in feed-forward networks within Transformer blocks.`,name:"activation_fn"},{anchor:"diffusers.DiTTransformer2DModel.num_embeds_ada_norm",description:`<strong>num_embeds_ada_norm</strong> (int, optional, defaults to 1000) — | |
| Number of embeddings for AdaLayerNorm, fixed during training and affects the maximum denoising steps during | |
| inference.`,name:"num_embeds_ada_norm"},{anchor:"diffusers.DiTTransformer2DModel.upcast_attention",description:`<strong>upcast_attention</strong> (bool, optional, defaults to False) — | |
| If true, upcasts the attention mechanism dimensions for potentially improved performance.`,name:"upcast_attention"},{anchor:"diffusers.DiTTransformer2DModel.norm_type",description:`<strong>norm_type</strong> (str, optional, defaults to “ada_norm_zero”) — | |
| Specifies the type of normalization used, can be ‘ada_norm_zero’.`,name:"norm_type"},{anchor:"diffusers.DiTTransformer2DModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (bool, optional, defaults to False) — | |
| If true, enables element-wise affine parameters in the normalization layers.`,name:"norm_elementwise_affine"},{anchor:"diffusers.DiTTransformer2DModel.norm_eps",description:`<strong>norm_eps</strong> (float, optional, defaults to 1e-5) — | |
| A small constant added to the denominator in normalization layers to prevent division by zero.`,name:"norm_eps"}]});var i=e(s,4),D=p(i);f(D,{name:"forward",anchor:"diffusers.DiTTransformer2DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/models/transformers/dit_transformer_2d.py#L148",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": typing.Optional[torch.LongTensor] = None"},{name:"class_labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"cross_attention_kwargs",val:": dict = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DiTTransformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.LongTensor</code> of shape <code>(batch size, num latent pixels)</code> if discrete, <code>torch.FloatTensor</code> of shape <code>(batch size, channel, height, width)</code> if continuous) — | |
| Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.DiTTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>, <em>optional</em>) — | |
| Used to indicate denoising step. Optional timestep to be applied as an embedding in <code>AdaLayerNorm</code>.`,name:"timestep"},{anchor:"diffusers.DiTTransformer2DModel.forward.class_labels",description:`<strong>class_labels</strong> ( <code>torch.LongTensor</code> of shape <code>(batch size, num classes)</code>, <em>optional</em>) — | |
| Used to indicate class labels conditioning. Optional class labels to be applied as an embedding in | |
| <code>AdaLayerZeroNorm</code>.`,name:"class_labels"},{anchor:"diffusers.DiTTransformer2DModel.forward.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> ( <code>dict[str, Any]</code>, <em>optional</em>) — | |
| 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.DiTTransformer2DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_14358/en/api/models/unet2d-cond#diffusers.models.unets.unet_2d_condition.UNet2DConditionOutput">UNet2DConditionOutput</a> instead of a plain | |
| tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is True, an <code>~models.transformer_2d.Transformer2DModelOutput</code> is returned, otherwise a | |
| <code>tuple</code> where the first element is the sample tensor.</p> | |
| `}),u(2),h(i),h(o);var b=e(o,2);w(b,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/dit_transformer2d.md"}),u(2),c(g,n),N()}export{I as component}; | |
Xet Storage Details
- Size:
- 9.48 kB
- Xet hash:
- cad7b4b72538af35bb69d6640ddc48ceb221a6840c8969399e0c8916c8c730aa
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.