import{s as te,n as ne,o as ie}from"../chunks/scheduler.53228c21.js";import{S as ae,i as oe,e as m,s as a,c as b,h as se,a as d,d as n,b as o,f as j,g as y,j as W,k as X,l,m as s,n as L,t as N,o as M,p as w}from"../chunks/index.100fac89.js";import{C as re}from"../chunks/CopyLLMTxtMenu.fb2ec027.js";import{D as Z}from"../chunks/Docstring.86a664ae.js";import{H as ee,E as me}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.09d4dba9.js";function de(B){let r,C,z,O,u,P,c,A,h,J='A Next Version of Diffusion Transformer model for 2D data from <a href="https://github.com/Alpha-VLLM/Lumina-T2X" rel="nofollow">Lumina-T2X</a>.',E,_,q,i,g,F,D,K="LuminaNextDiT: Diffusion model with a Transformer backbone.",G,v,Q="Inherit ModelMixin and ConfigMixin to be compatible with the sampler StableDiffusionPipeline of diffusers.",R,f,x,U,$,Y="Forward pass of LuminaNextDiT.",I,T,H,k,S;return u=new re({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),c=new ee({props:{title:"LuminaNextDiT2DModel",local:"luminanextdit2dmodel",headingTag:"h1"}}),_=new ee({props:{title:"LuminaNextDiT2DModel",local:"diffusers.LuminaNextDiT2DModel",headingTag:"h2"}}),g=new Z({props:{name:"class diffusers.LuminaNextDiT2DModel",anchor:"diffusers.LuminaNextDiT2DModel",parameters:[{name:"sample_size",val:": int = 128"},{name:"patch_size",val:": typing.Optional[int] = 2"},{name:"in_channels",val:": typing.Optional[int] = 4"},{name:"hidden_size",val:": typing.Optional[int] = 2304"},{name:"num_layers",val:": typing.Optional[int] = 32"},{name:"num_attention_heads",val:": typing.Optional[int] = 32"},{name:"num_kv_heads",val:": typing.Optional[int] = None"},{name:"multiple_of",val:": typing.Optional[int] = 256"},{name:"ffn_dim_multiplier",val:": typing.Optional[float] = None"},{name:"norm_eps",val:": typing.Optional[float] = 1e-05"},{name:"learn_sigma",val:": typing.Optional[bool] = True"},{name:"qk_norm",val:": typing.Optional[bool] = True"},{name:"cross_attention_dim",val:": typing.Optional[int] = 2048"},{name:"scaling_factor",val:": typing.Optional[float] = 1.0"}],parametersDescription:[{anchor:"diffusers.LuminaNextDiT2DModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>) &#x2014; The width of the latent images. This is fixed during training since
it is used to learn a number of position embeddings.`,name:"sample_size"},{anchor:"diffusers.LuminaNextDiT2DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The size of each patch in the image. This parameter defines the resolution of patches fed into the model.`,name:"patch_size"},{anchor:"diffusers.LuminaNextDiT2DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of input channels for the model. Typically, this matches the number of channels in the input
images.`,name:"in_channels"},{anchor:"diffusers.LuminaNextDiT2DModel.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
The dimensionality of the hidden layers in the model. This parameter determines the width of the model&#x2019;s
hidden representations.`,name:"hidden_size"},{anchor:"diffusers.LuminaNextDiT2DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, default to 32) &#x2014;
The number of layers in the model. This defines the depth of the neural network.`,name:"num_layers"},{anchor:"diffusers.LuminaNextDiT2DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The number of attention heads in each attention layer. This parameter specifies how many separate attention
mechanisms are used.`,name:"num_attention_heads"},{anchor:"diffusers.LuminaNextDiT2DModel.num_kv_heads",description:`<strong>num_kv_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The number of key-value heads in the attention mechanism, if different from the number of attention heads.
If None, it defaults to num_attention_heads.`,name:"num_kv_heads"},{anchor:"diffusers.LuminaNextDiT2DModel.multiple_of",description:`<strong>multiple_of</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
A factor that the hidden size should be a multiple of. This can help optimize certain hardware
configurations.`,name:"multiple_of"},{anchor:"diffusers.LuminaNextDiT2DModel.ffn_dim_multiplier",description:`<strong>ffn_dim_multiplier</strong> (<code>float</code>, <em>optional</em>) &#x2014;
A multiplier for the dimensionality of the feed-forward network. If None, it uses a default value based on
the model configuration.`,name:"ffn_dim_multiplier"},{anchor:"diffusers.LuminaNextDiT2DModel.norm_eps",description:`<strong>norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
A small value added to the denominator for numerical stability in normalization layers.`,name:"norm_eps"},{anchor:"diffusers.LuminaNextDiT2DModel.learn_sigma",description:`<strong>learn_sigma</strong> (<code>bool</code>, <em>optional</em>, defaults to True) &#x2014;
Whether the model should learn the sigma parameter, which might be related to uncertainty or variance in
predictions.`,name:"learn_sigma"},{anchor:"diffusers.LuminaNextDiT2DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to True) &#x2014;
Indicates if the queries and keys in the attention mechanism should be normalized.`,name:"qk_norm"},{anchor:"diffusers.LuminaNextDiT2DModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The dimensionality of the text embeddings. This parameter defines the size of the text representations used
in the model.`,name:"cross_attention_dim"},{anchor:"diffusers.LuminaNextDiT2DModel.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A scaling factor applied to certain parameters or layers in the model. This can be used for adjusting the
overall scale of the model&#x2019;s operations.`,name:"scaling_factor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/lumina_nextdit2d.py#L178"}}),x=new Z({props:{name:"forward",anchor:"diffusers.LuminaNextDiT2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"encoder_mask",val:": Tensor"},{name:"image_rotary_emb",val:": Tensor"},{name:"cross_attention_kwargs",val:": typing.Dict[str, typing.Any] = None"},{name:"return_dict",val:" = True"}],parametersDescription:[{anchor:"diffusers.LuminaNextDiT2DModel.forward.hidden_states",description:"<strong>hidden_states</strong> (torch.Tensor) &#x2014; Input tensor of shape (N, C, H, W).",name:"hidden_states"},{anchor:"diffusers.LuminaNextDiT2DModel.forward.timestep",description:"<strong>timestep</strong> (torch.Tensor) &#x2014; Tensor of diffusion timesteps of shape (N,).",name:"timestep"},{anchor:"diffusers.LuminaNextDiT2DModel.forward.encoder_hidden_states",description:"<strong>encoder_hidden_states</strong> (torch.Tensor) &#x2014; Tensor of caption features of shape (N, D).",name:"encoder_hidden_states"},{anchor:"diffusers.LuminaNextDiT2DModel.forward.encoder_mask",description:"<strong>encoder_mask</strong> (torch.Tensor) &#x2014; Tensor of caption masks of shape (N, L).",name:"encoder_mask"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/lumina_nextdit2d.py#L291"}}),T=new me({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/lumina_nextdit2d.md"}}),{c(){r=m("meta"),C=a(),z=m("p"),O=a(),b(u.$$.fragment),P=a(),b(c.$$.fragment),A=a(),h=m("p"),h.innerHTML=J,E=a(),b(_.$$.fragment),q=a(),i=m("div"),b(g.$$.fragment),F=a(),D=m("p"),D.textContent=K,G=a(),v=m("p"),v.textContent=Q,R=a(),f=m("div"),b(x.$$.fragment),U=a(),$=m("p"),$.textContent=Y,I=a(),b(T.$$.fragment),H=a(),k=m("p"),this.h()},l(e){const t=se("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(n),C=o(e),z=d(e,"P",{}),j(z).forEach(n),O=o(e),y(u.$$.fragment,e),P=o(e),y(c.$$.fragment,e),A=o(e),h=d(e,"P",{"data-svelte-h":!0}),W(h)!=="svelte-13vz9fn"&&(h.innerHTML=J),E=o(e),y(_.$$.fragment,e),q=o(e),i=d(e,"DIV",{class:!0});var p=j(i);y(g.$$.fragment,p),F=o(p),D=d(p,"P",{"data-svelte-h":!0}),W(D)!=="svelte-8adszf"&&(D.textContent=K),G=o(p),v=d(p,"P",{"data-svelte-h":!0}),W(v)!=="svelte-wuyqug"&&(v.textContent=Q),R=o(p),f=d(p,"DIV",{class:!0});var V=j(f);y(x.$$.fragment,V),U=o(V),$=d(V,"P",{"data-svelte-h":!0}),W($)!=="svelte-vv6okb"&&($.textContent=Y),V.forEach(n),p.forEach(n),I=o(e),y(T.$$.fragment,e),H=o(e),k=d(e,"P",{}),j(k).forEach(n),this.h()},h(){X(r,"name","hf:doc:metadata"),X(r,"content",le),X(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(i,"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){l(document.head,r),s(e,C,t),s(e,z,t),s(e,O,t),L(u,e,t),s(e,P,t),L(c,e,t),s(e,A,t),s(e,h,t),s(e,E,t),L(_,e,t),s(e,q,t),s(e,i,t),L(g,i,null),l(i,F),l(i,D),l(i,G),l(i,v),l(i,R),l(i,f),L(x,f,null),l(f,U),l(f,$),s(e,I,t),L(T,e,t),s(e,H,t),s(e,k,t),S=!0},p:ne,i(e){S||(N(u.$$.fragment,e),N(c.$$.fragment,e),N(_.$$.fragment,e),N(g.$$.fragment,e),N(x.$$.fragment,e),N(T.$$.fragment,e),S=!0)},o(e){M(u.$$.fragment,e),M(c.$$.fragment,e),M(_.$$.fragment,e),M(g.$$.fragment,e),M(x.$$.fragment,e),M(T.$$.fragment,e),S=!1},d(e){e&&(n(C),n(z),n(O),n(P),n(A),n(h),n(E),n(q),n(i),n(I),n(H),n(k)),n(r),w(u,e),w(c,e),w(_,e),w(g),w(x),w(T,e)}}}const le='{"title":"LuminaNextDiT2DModel","local":"luminanextdit2dmodel","sections":[{"title":"LuminaNextDiT2DModel","local":"diffusers.LuminaNextDiT2DModel","sections":[],"depth":2}],"depth":1}';function fe(B){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends ae{constructor(r){super(),oe(this,r,fe,de,te,{})}}export{ge as component};
