Buckets:

download
raw
13.7 kB
import{s as ce,n as ue,o as pe}from"../chunks/scheduler.53228c21.js";import{S as he,i as _e,e as i,s as r,c as f,h as ge,a as d,d as n,b as s,f as V,g as c,j as A,k as N,l as u,m as o,n as p,t as h,o as _,p as g}from"../chunks/index.cac5d66a.js";import{C as Te}from"../chunks/CopyLLMTxtMenu.127444ce.js";import{D as re}from"../chunks/Docstring.3f02c614.js";import{C as be}from"../chunks/CodeBlock.606cbaf4.js";import{H as se,E as $e}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.1e8e5da3.js";function Me(ae){let m,P,Z,j,b,H,$,O,M,ie='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.',W,v,de="The model can be loaded with the following code snippet.",q,D,F,L,G,a,w,ee,E,me="Lumina2NextDiT: Diffusion model with a Transformer backbone.",te,T,y,ne,C,le='The <a href="/docs/diffusers/pr_13751/en/api/models/lumina2_transformer2d#diffusers.Lumina2Transformer2DModel">Lumina2Transformer2DModel</a> forward method.',S,x,R,l,k,oe,I,fe='The output of <a href="/docs/diffusers/pr_13751/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',B,z,K,U,Y;return b=new Te({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),$=new se({props:{title:"Lumina2Transformer2DModel",local:"lumina2transformer2dmodel",headingTag:"h1"}}),D=new be({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)`,lang:"python",wrap:!1}}),L=new se({props:{title:"Lumina2Transformer2DModel",local:"diffusers.Lumina2Transformer2DModel",headingTag:"h2"}}),w=new re({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:": int | None = 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:": float | None = None"},{name:"norm_eps",val:": float = 1e-05"},{name:"scaling_factor",val:": float = 1.0"},{name:"axes_dim_rope",val:": tuple = (32, 32, 32)"},{name:"axes_lens",val:": tuple = (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/vr_13751/src/diffusers/models/transformers/transformer_lumina2.py#L325"}}),y=new re({props:{name:"forward",anchor:"diffusers.Lumina2Transformer2DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"encoder_attention_mask",val:": Tensor"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.Lumina2Transformer2DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, in_channels, height, width)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.Lumina2Transformer2DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.Lumina2Transformer2DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_len, embed_dims)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.Lumina2Transformer2DModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
Mask applied to <code>encoder_hidden_states</code> during attention.`,name:"encoder_attention_mask"},{anchor:"diffusers.Lumina2Transformer2DModel.forward.attention_kwargs",description:`<strong>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:"attention_kwargs"},{anchor:"diffusers.Lumina2Transformer2DModel.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 <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain
tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/models/transformers/transformer_lumina2.py#L458",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>
`}}),x=new se({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),k=new re({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/pr_13751/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/vr_13751/src/diffusers/models/modeling_outputs.py#L21"}}),z=new $e({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/lumina2_transformer2d.md"}}),{c(){m=i("meta"),P=r(),Z=i("p"),j=r(),f(b.$$.fragment),H=r(),f($.$$.fragment),O=r(),M=i("p"),M.innerHTML=ie,W=r(),v=i("p"),v.textContent=de,q=r(),f(D.$$.fragment),F=r(),f(L.$$.fragment),G=r(),a=i("div"),f(w.$$.fragment),ee=r(),E=i("p"),E.textContent=me,te=r(),T=i("div"),f(y.$$.fragment),ne=r(),C=i("p"),C.innerHTML=le,S=r(),f(x.$$.fragment),R=r(),l=i("div"),f(k.$$.fragment),oe=r(),I=i("p"),I.innerHTML=fe,B=r(),f(z.$$.fragment),K=r(),U=i("p"),this.h()},l(e){const t=ge("svelte-u9bgzb",document.head);m=d(t,"META",{name:!0,content:!0}),t.forEach(n),P=s(e),Z=d(e,"P",{}),V(Z).forEach(n),j=s(e),c(b.$$.fragment,e),H=s(e),c($.$$.fragment,e),O=s(e),M=d(e,"P",{"data-svelte-h":!0}),A(M)!=="svelte-cct7b"&&(M.innerHTML=ie),W=s(e),v=d(e,"P",{"data-svelte-h":!0}),A(v)!=="svelte-1vuni30"&&(v.textContent=de),q=s(e),c(D.$$.fragment,e),F=s(e),c(L.$$.fragment,e),G=s(e),a=d(e,"DIV",{class:!0});var J=V(a);c(w.$$.fragment,J),ee=s(J),E=d(J,"P",{"data-svelte-h":!0}),A(E)!=="svelte-fzcdqf"&&(E.textContent=me),te=s(J),T=d(J,"DIV",{class:!0});var Q=V(T);c(y.$$.fragment,Q),ne=s(Q),C=d(Q,"P",{"data-svelte-h":!0}),A(C)!=="svelte-3547uu"&&(C.innerHTML=le),Q.forEach(n),J.forEach(n),S=s(e),c(x.$$.fragment,e),R=s(e),l=d(e,"DIV",{class:!0});var X=V(l);c(k.$$.fragment,X),oe=s(X),I=d(X,"P",{"data-svelte-h":!0}),A(I)!=="svelte-1acihvv"&&(I.innerHTML=fe),X.forEach(n),B=s(e),c(z.$$.fragment,e),K=s(e),U=d(e,"P",{}),V(U).forEach(n),this.h()},h(){N(m,"name","hf:doc:metadata"),N(m,"content",ve),N(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),N(l,"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){u(document.head,m),o(e,P,t),o(e,Z,t),o(e,j,t),p(b,e,t),o(e,H,t),p($,e,t),o(e,O,t),o(e,M,t),o(e,W,t),o(e,v,t),o(e,q,t),p(D,e,t),o(e,F,t),p(L,e,t),o(e,G,t),o(e,a,t),p(w,a,null),u(a,ee),u(a,E),u(a,te),u(a,T),p(y,T,null),u(T,ne),u(T,C),o(e,S,t),p(x,e,t),o(e,R,t),o(e,l,t),p(k,l,null),u(l,oe),u(l,I),o(e,B,t),p(z,e,t),o(e,K,t),o(e,U,t),Y=!0},p:ue,i(e){Y||(h(b.$$.fragment,e),h($.$$.fragment,e),h(D.$$.fragment,e),h(L.$$.fragment,e),h(w.$$.fragment,e),h(y.$$.fragment,e),h(x.$$.fragment,e),h(k.$$.fragment,e),h(z.$$.fragment,e),Y=!0)},o(e){_(b.$$.fragment,e),_($.$$.fragment,e),_(D.$$.fragment,e),_(L.$$.fragment,e),_(w.$$.fragment,e),_(y.$$.fragment,e),_(x.$$.fragment,e),_(k.$$.fragment,e),_(z.$$.fragment,e),Y=!1},d(e){e&&(n(P),n(Z),n(j),n(H),n(O),n(M),n(W),n(v),n(q),n(F),n(G),n(a),n(S),n(R),n(l),n(B),n(K),n(U)),n(m),g(b,e),g($,e),g(D,e),g(L,e),g(w),g(y),g(x,e),g(k),g(z,e)}}}const ve='{"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 De(ae){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ee extends he{constructor(m){super(),_e(this,m,De,Me,ce,{})}}export{Ee as component};

Xet Storage Details

Size:
13.7 kB
·
Xet hash:
1436de53f02778834fe62f971e9959db5ba867037229f142366d0cf6a19d9037

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