Buckets:

HuggingFaceDocBuilder's picture
download
raw
11.2 kB
import{s as X,n as Y,o as ee}from"../chunks/scheduler.53228c21.js";import{S as ne,i as te,e as m,s,c as $,h as oe,a as l,d as t,b as a,f as U,g as x,j as R,k as q,l as T,m as o,n as M,t as w,o as y,p as z}from"../chunks/index.cac5d66a.js";import{C as re}from"../chunks/CopyLLMTxtMenu.5ac9ab94.js";import{D as K}from"../chunks/Docstring.8a316450.js";import{H as Q,E as se}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92b2cd9d.js";function ae(W){let i,N,L,A,f,C,c,P,p,Z='A Transformer model for image-like data from <a href="https://huggingface.co/papers/2212.09748" rel="nofollow">DiT</a>.',E,u,H,r,h,V,D,B='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>).',j,d,_,G,b,J='The <a href="/docs/diffusers/pr_13813/en/api/models/dit_transformer2d#diffusers.DiTTransformer2DModel">DiTTransformer2DModel</a> forward method.',S,g,I,k,O;return f=new re({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),c=new Q({props:{title:"DiTTransformer2DModel",local:"dittransformer2dmodel",headingTag:"h1"}}),u=new Q({props:{title:"DiTTransformer2DModel",local:"diffusers.DiTTransformer2DModel",headingTag:"h2"}}),h=new K({props:{name:"class diffusers.DiTTransformer2DModel",anchor:"diffusers.DiTTransformer2DModel",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) &#x2014; 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) &#x2014; 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) &#x2014; The number of channels in the input.",name:"in_channels"},{anchor:"diffusers.DiTTransformer2DModel.out_channels",description:`<strong>out_channels</strong> (int, optional) &#x2014;
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) &#x2014; 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) &#x2014; 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) &#x2014;
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) &#x2014;
Configure if the Transformer blocks&#x2019; attention should contain a bias parameter.`,name:"attention_bias"},{anchor:"diffusers.DiTTransformer2DModel.sample_size",description:`<strong>sample_size</strong> (int, defaults to 32) &#x2014;
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) &#x2014;
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 &#x201C;gelu-approximate&#x201D;) &#x2014;
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) &#x2014;
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) &#x2014;
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 &#x201C;ada_norm_zero&#x201D;) &#x2014;
Specifies the type of normalization used, can be &#x2018;ada_norm_zero&#x2019;.`,name:"norm_type"},{anchor:"diffusers.DiTTransformer2DModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (bool, optional, defaults to False) &#x2014;
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) &#x2014;
A small constant added to the denominator in normalization layers to prevent division by zero.`,name:"norm_eps"}],source:"https://github.com/huggingface/diffusers/blob/vr_13813/src/diffusers/models/transformers/dit_transformer_2d.py#L31"}}),_=new K({props:{name:"forward",anchor:"diffusers.DiTTransformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": torch.LongTensor | None = None"},{name:"class_labels",val:": torch.LongTensor | None = 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) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.DiTTransformer2DModel.forward.timestep",description:`<strong>timestep</strong> ( <code>torch.LongTensor</code>, <em>optional</em>) &#x2014;
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>) &#x2014;
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>) &#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.DiTTransformer2DModel.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_13813/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_13813/src/diffusers/models/transformers/dit_transformer_2d.py#L148",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>
`}}),g=new se({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/dit_transformer2d.md"}}),{c(){i=m("meta"),N=s(),L=m("p"),A=s(),$(f.$$.fragment),C=s(),$(c.$$.fragment),P=s(),p=m("p"),p.innerHTML=Z,E=s(),$(u.$$.fragment),H=s(),r=m("div"),$(h.$$.fragment),V=s(),D=m("p"),D.innerHTML=B,j=s(),d=m("div"),$(_.$$.fragment),G=s(),b=m("p"),b.innerHTML=J,S=s(),$(g.$$.fragment),I=s(),k=m("p"),this.h()},l(e){const n=oe("svelte-u9bgzb",document.head);i=l(n,"META",{name:!0,content:!0}),n.forEach(t),N=a(e),L=l(e,"P",{}),U(L).forEach(t),A=a(e),x(f.$$.fragment,e),C=a(e),x(c.$$.fragment,e),P=a(e),p=l(e,"P",{"data-svelte-h":!0}),R(p)!=="svelte-14u6i1s"&&(p.innerHTML=Z),E=a(e),x(u.$$.fragment,e),H=a(e),r=l(e,"DIV",{class:!0});var v=U(r);x(h.$$.fragment,v),V=a(v),D=l(v,"P",{"data-svelte-h":!0}),R(D)!=="svelte-auif6k"&&(D.innerHTML=B),j=a(v),d=l(v,"DIV",{class:!0});var F=U(d);x(_.$$.fragment,F),G=a(F),b=l(F,"P",{"data-svelte-h":!0}),R(b)!=="svelte-t6r4sa"&&(b.innerHTML=J),F.forEach(t),v.forEach(t),S=a(e),x(g.$$.fragment,e),I=a(e),k=l(e,"P",{}),U(k).forEach(t),this.h()},h(){q(i,"name","hf:doc:metadata"),q(i,"content",ie),q(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(r,"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,n){T(document.head,i),o(e,N,n),o(e,L,n),o(e,A,n),M(f,e,n),o(e,C,n),M(c,e,n),o(e,P,n),o(e,p,n),o(e,E,n),M(u,e,n),o(e,H,n),o(e,r,n),M(h,r,null),T(r,V),T(r,D),T(r,j),T(r,d),M(_,d,null),T(d,G),T(d,b),o(e,S,n),M(g,e,n),o(e,I,n),o(e,k,n),O=!0},p:Y,i(e){O||(w(f.$$.fragment,e),w(c.$$.fragment,e),w(u.$$.fragment,e),w(h.$$.fragment,e),w(_.$$.fragment,e),w(g.$$.fragment,e),O=!0)},o(e){y(f.$$.fragment,e),y(c.$$.fragment,e),y(u.$$.fragment,e),y(h.$$.fragment,e),y(_.$$.fragment,e),y(g.$$.fragment,e),O=!1},d(e){e&&(t(N),t(L),t(A),t(C),t(P),t(p),t(E),t(H),t(r),t(S),t(I),t(k)),t(i),z(f,e),z(c,e),z(u,e),z(h),z(_),z(g,e)}}}const ie='{"title":"DiTTransformer2DModel","local":"dittransformer2dmodel","sections":[{"title":"DiTTransformer2DModel","local":"diffusers.DiTTransformer2DModel","sections":[],"depth":2}],"depth":1}';function de(W){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ue extends ne{constructor(i){super(),te(this,i,de,ae,X,{})}}export{ue as component};

Xet Storage Details

Size:
11.2 kB
·
Xet hash:
f1fb03db5bd6543f542bcdb422adb483c50c79add514adbef226d35bd7facb50

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.