import{s as se,n as re,o as ie}from"../chunks/scheduler.53228c21.js";import{S as me,i as le,e as l,s as o,c as f,h as de,a as d,d as n,b as s,f as q,g as u,j as R,k as B,l as C,m as a,n as p,t as c,o as h,p as _}from"../chunks/index.100fac89.js";import{C as fe}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as oe}from"../chunks/Docstring.db856a1e.js";import{C as ue}from"../chunks/CodeBlock.d30a6509.js";import{H as Q,E as pe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function ce(X){let r,J,k,Z,g,I,T,j,$,ee='A Diffusion Transformer model for 3D video-like data was introduced in <a href="https://huggingface.co/Alpha-VLLM/Lumina-Image-2.0" rel="nofollow">Lumina Image 2.0</a> by Alpha-VLLM.',U,M,te="The model can be loaded with the following code snippet.",V,b,O,v,P,i,y,K,w,ne="Lumina2NextDiT: Diffusion model with a Transformer backbone.",A,D,H,m,L,Y,z,ae='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',N,x,W,E,F;return g=new fe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new Q({props:{title:"Lumina2Transformer2DModel",local:"lumina2transformer2dmodel",headingTag:"h1"}}),b=new ue({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEx1bWluYTJUcmFuc2Zvcm1lcjJETW9kZWwlMEElMEF0cmFuc2Zvcm1lciUyMCUzRCUyMEx1bWluYTJUcmFuc2Zvcm1lcjJETW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMkFscGhhLVZMTE0lMkZMdW1pbmEtSW1hZ2UtMi4wJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Lumina2Transformer2DModel

transformer = Lumina2Transformer2DModel.from_pretrained(<span class="hljs-string">&quot;Alpha-VLLM/Lumina-Image-2.0&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),v=new Q({props:{title:"Lumina2Transformer2DModel",local:"diffusers.Lumina2Transformer2DModel",headingTag:"h2"}}),y=new oe({props:{name:"class diffusers.Lumina2Transformer2DModel",anchor:"diffusers.Lumina2Transformer2DModel",parameters:[{name:"sample_size",val:": int = 128"},{name:"patch_size",val:": int = 2"},{name:"in_channels",val:": int = 16"},{name:"out_channels",val:": typing.Optional[int] = None"},{name:"hidden_size",val:": int = 2304"},{name:"num_layers",val:": int = 26"},{name:"num_refiner_layers",val:": int = 2"},{name:"num_attention_heads",val:": int = 24"},{name:"num_kv_heads",val:": int = 8"},{name:"multiple_of",val:": int = 256"},{name:"ffn_dim_multiplier",val:": typing.Optional[float] = None"},{name:"norm_eps",val:": float = 1e-05"},{name:"scaling_factor",val:": float = 1.0"},{name:"axes_dim_rope",val:": typing.Tuple[int, int, int] = (32, 32, 32)"},{name:"axes_lens",val:": typing.Tuple[int, int, int] = (300, 512, 512)"},{name:"cap_feat_dim",val:": int = 1024"}],parametersDescription:[{anchor:"diffusers.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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.Lumina2Transformer2DModel.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/transformer_lumina2.py#L325"}}),D=new Q({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),L=new oe({props:{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",parameters:[{name:"sample",val:": torch.Tensor"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>(batch size, num_vector_embeds - 1, num_latent_pixels)</code> if <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) &#x2014;
The hidden states output conditioned on the <code>encoder_hidden_states</code> input. If discrete, returns probability
distributions for the unnoised latent pixels.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/modeling_outputs.py#L21"}}),x=new pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/lumina2_transformer2d.md"}}),{c(){r=l("meta"),J=o(),k=l("p"),Z=o(),f(g.$$.fragment),I=o(),f(T.$$.fragment),j=o(),$=l("p"),$.innerHTML=ee,U=o(),M=l("p"),M.textContent=te,V=o(),f(b.$$.fragment),O=o(),f(v.$$.fragment),P=o(),i=l("div"),f(y.$$.fragment),K=o(),w=l("p"),w.textContent=ne,A=o(),f(D.$$.fragment),H=o(),m=l("div"),f(L.$$.fragment),Y=o(),z=l("p"),z.innerHTML=ae,N=o(),f(x.$$.fragment),W=o(),E=l("p"),this.h()},l(e){const t=de("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(n),J=s(e),k=d(e,"P",{}),q(k).forEach(n),Z=s(e),u(g.$$.fragment,e),I=s(e),u(T.$$.fragment,e),j=s(e),$=d(e,"P",{"data-svelte-h":!0}),R($)!=="svelte-cct7b"&&($.innerHTML=ee),U=s(e),M=d(e,"P",{"data-svelte-h":!0}),R(M)!=="svelte-1vuni30"&&(M.textContent=te),V=s(e),u(b.$$.fragment,e),O=s(e),u(v.$$.fragment,e),P=s(e),i=d(e,"DIV",{class:!0});var G=q(i);u(y.$$.fragment,G),K=s(G),w=d(G,"P",{"data-svelte-h":!0}),R(w)!=="svelte-fzcdqf"&&(w.textContent=ne),G.forEach(n),A=s(e),u(D.$$.fragment,e),H=s(e),m=d(e,"DIV",{class:!0});var S=q(m);u(L.$$.fragment,S),Y=s(S),z=d(S,"P",{"data-svelte-h":!0}),R(z)!=="svelte-1x8c0js"&&(z.innerHTML=ae),S.forEach(n),N=s(e),u(x.$$.fragment,e),W=s(e),E=d(e,"P",{}),q(E).forEach(n),this.h()},h(){B(r,"name","hf:doc:metadata"),B(r,"content",he),B(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(m,"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){C(document.head,r),a(e,J,t),a(e,k,t),a(e,Z,t),p(g,e,t),a(e,I,t),p(T,e,t),a(e,j,t),a(e,$,t),a(e,U,t),a(e,M,t),a(e,V,t),p(b,e,t),a(e,O,t),p(v,e,t),a(e,P,t),a(e,i,t),p(y,i,null),C(i,K),C(i,w),a(e,A,t),p(D,e,t),a(e,H,t),a(e,m,t),p(L,m,null),C(m,Y),C(m,z),a(e,N,t),p(x,e,t),a(e,W,t),a(e,E,t),F=!0},p:re,i(e){F||(c(g.$$.fragment,e),c(T.$$.fragment,e),c(b.$$.fragment,e),c(v.$$.fragment,e),c(y.$$.fragment,e),c(D.$$.fragment,e),c(L.$$.fragment,e),c(x.$$.fragment,e),F=!0)},o(e){h(g.$$.fragment,e),h(T.$$.fragment,e),h(b.$$.fragment,e),h(v.$$.fragment,e),h(y.$$.fragment,e),h(D.$$.fragment,e),h(L.$$.fragment,e),h(x.$$.fragment,e),F=!1},d(e){e&&(n(J),n(k),n(Z),n(I),n(j),n($),n(U),n(M),n(V),n(O),n(P),n(i),n(A),n(H),n(m),n(N),n(W),n(E)),n(r),_(g,e),_(T,e),_(b,e),_(v,e),_(y),_(D,e),_(L),_(x,e)}}}const he='{"title":"Lumina2Transformer2DModel","local":"lumina2transformer2dmodel","sections":[{"title":"Lumina2Transformer2DModel","local":"diffusers.Lumina2Transformer2DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function _e(X){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ye extends me{constructor(r){super(),le(this,r,_e,ce,se,{})}}export{ye as component};
