Buckets:
| import{s as re,n as ae,o as de}from"../chunks/scheduler.53228c21.js";import{S as ie,i as me,e as m,s as n,c as f,h as le,a as l,d as o,b as r,f as q,g as c,j as Q,k as X,l as I,m as s,n as p,t as u,o as h,p as _}from"../chunks/index.100fac89.js";import{C as fe}from"../chunks/CopyLLMTxtMenu.733ee6d3.js";import{D as ne}from"../chunks/Docstring.695f69dc.js";import{C as ce}from"../chunks/CodeBlock.d30a6509.js";import{H as Y,E as pe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.0e2208d5.js";function ue(K){let a,Z,k,L,g,E,T,H,b,ee='A Diffusion Transformer model for 3D video-like data was introduced in <a href="https://huggingface.co/papers/2501.03575" rel="nofollow">Cosmos World Foundation Model Platform for Physical AI</a> by NVIDIA.',P,$,te="The model can be loaded with the following code snippet.",N,M,R,y,V,d,x,B,w,oe='A Transformer model for video-like data used in <a href="https://github.com/NVIDIA/Cosmos" rel="nofollow">Cosmos</a>.',j,v,W,i,D,F,z,se='The output of <a href="/docs/diffusers/pr_12849/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',O,C,U,J,A;return g=new fe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),T=new Y({props:{title:"CosmosTransformer3DModel",local:"cosmostransformer3dmodel",headingTag:"h1"}}),M=new ce({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvc21vc1RyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwQ29zbW9zVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJudmlkaWElMkZDb3Ntb3MtMS4wLURpZmZ1c2lvbi03Qi1UZXh0MldvcmxkJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CosmosTransformer3DModel | |
| transformer = CosmosTransformer3DModel.from_pretrained(<span class="hljs-string">"nvidia/Cosmos-1.0-Diffusion-7B-Text2World"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),y=new Y({props:{title:"CosmosTransformer3DModel",local:"diffusers.CosmosTransformer3DModel",headingTag:"h2"}}),x=new ne({props:{name:"class diffusers.CosmosTransformer3DModel",anchor:"diffusers.CosmosTransformer3DModel",parameters:[{name:"in_channels",val:": int = 16"},{name:"out_channels",val:": int = 16"},{name:"num_attention_heads",val:": int = 32"},{name:"attention_head_dim",val:": int = 128"},{name:"num_layers",val:": int = 28"},{name:"mlp_ratio",val:": float = 4.0"},{name:"text_embed_dim",val:": int = 1024"},{name:"adaln_lora_dim",val:": int = 256"},{name:"max_size",val:": typing.Tuple[int, int, int] = (128, 240, 240)"},{name:"patch_size",val:": typing.Tuple[int, int, int] = (1, 2, 2)"},{name:"rope_scale",val:": typing.Tuple[float, float, float] = (2.0, 1.0, 1.0)"},{name:"concat_padding_mask",val:": bool = True"},{name:"extra_pos_embed_type",val:": typing.Optional[str] = 'learnable'"}],parametersDescription:[{anchor:"diffusers.CosmosTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.CosmosTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.CosmosTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>32</code>) — | |
| The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.CosmosTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The number of channels in each attention head.`,name:"attention_head_dim"},{anchor:"diffusers.CosmosTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>28</code>) — | |
| The number of layers of transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.CosmosTransformer3DModel.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, defaults to <code>4.0</code>) — | |
| The ratio of the hidden layer size to the input size in the feedforward network.`,name:"mlp_ratio"},{anchor:"diffusers.CosmosTransformer3DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) — | |
| Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.CosmosTransformer3DModel.adaln_lora_dim",description:`<strong>adaln_lora_dim</strong> (<code>int</code>, defaults to <code>256</code>) — | |
| The hidden dimension of the Adaptive LayerNorm LoRA layer.`,name:"adaln_lora_dim"},{anchor:"diffusers.CosmosTransformer3DModel.max_size",description:`<strong>max_size</strong> (<code>Tuple[int, int, int]</code>, defaults to <code>(128, 240, 240)</code>) — | |
| The maximum size of the input latent tensors in the temporal, height, and width dimensions.`,name:"max_size"},{anchor:"diffusers.CosmosTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>Tuple[int, int, int]</code>, defaults to <code>(1, 2, 2)</code>) — | |
| The patch size to use for patchifying the input latent tensors in the temporal, height, and width | |
| dimensions.`,name:"patch_size"},{anchor:"diffusers.CosmosTransformer3DModel.rope_scale",description:`<strong>rope_scale</strong> (<code>Tuple[float, float, float]</code>, defaults to <code>(2.0, 1.0, 1.0)</code>) — | |
| The scaling factor to use for RoPE in the temporal, height, and width dimensions.`,name:"rope_scale"},{anchor:"diffusers.CosmosTransformer3DModel.concat_padding_mask",description:`<strong>concat_padding_mask</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to concatenate the padding mask to the input latent tensors.`,name:"concat_padding_mask"},{anchor:"diffusers.CosmosTransformer3DModel.extra_pos_embed_type",description:`<strong>extra_pos_embed_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>learnable</code>) — | |
| The type of extra positional embeddings to use. Can be one of <code>None</code> or <code>learnable</code>.`,name:"extra_pos_embed_type"}],source:"https://github.com/huggingface/diffusers/blob/vr_12849/src/diffusers/models/transformers/transformer_cosmos.py#L387"}}),v=new Y({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),D=new ne({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_12849/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) — | |
| 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_12849/src/diffusers/models/modeling_outputs.py#L21"}}),C=new pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/cosmos_transformer3d.md"}}),{c(){a=m("meta"),Z=n(),k=m("p"),L=n(),f(g.$$.fragment),E=n(),f(T.$$.fragment),H=n(),b=m("p"),b.innerHTML=ee,P=n(),$=m("p"),$.textContent=te,N=n(),f(M.$$.fragment),R=n(),f(y.$$.fragment),V=n(),d=m("div"),f(x.$$.fragment),B=n(),w=m("p"),w.innerHTML=oe,j=n(),f(v.$$.fragment),W=n(),i=m("div"),f(D.$$.fragment),F=n(),z=m("p"),z.innerHTML=se,O=n(),f(C.$$.fragment),U=n(),J=m("p"),this.h()},l(e){const t=le("svelte-u9bgzb",document.head);a=l(t,"META",{name:!0,content:!0}),t.forEach(o),Z=r(e),k=l(e,"P",{}),q(k).forEach(o),L=r(e),c(g.$$.fragment,e),E=r(e),c(T.$$.fragment,e),H=r(e),b=l(e,"P",{"data-svelte-h":!0}),Q(b)!=="svelte-1pjw3fi"&&(b.innerHTML=ee),P=r(e),$=l(e,"P",{"data-svelte-h":!0}),Q($)!=="svelte-1vuni30"&&($.textContent=te),N=r(e),c(M.$$.fragment,e),R=r(e),c(y.$$.fragment,e),V=r(e),d=l(e,"DIV",{class:!0});var S=q(d);c(x.$$.fragment,S),B=r(S),w=l(S,"P",{"data-svelte-h":!0}),Q(w)!=="svelte-y8uhes"&&(w.innerHTML=oe),S.forEach(o),j=r(e),c(v.$$.fragment,e),W=r(e),i=l(e,"DIV",{class:!0});var G=q(i);c(D.$$.fragment,G),F=r(G),z=l(G,"P",{"data-svelte-h":!0}),Q(z)!=="svelte-rb9yki"&&(z.innerHTML=se),G.forEach(o),O=r(e),c(C.$$.fragment,e),U=r(e),J=l(e,"P",{}),q(J).forEach(o),this.h()},h(){X(a,"name","hf:doc:metadata"),X(a,"content",he),X(d,"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){I(document.head,a),s(e,Z,t),s(e,k,t),s(e,L,t),p(g,e,t),s(e,E,t),p(T,e,t),s(e,H,t),s(e,b,t),s(e,P,t),s(e,$,t),s(e,N,t),p(M,e,t),s(e,R,t),p(y,e,t),s(e,V,t),s(e,d,t),p(x,d,null),I(d,B),I(d,w),s(e,j,t),p(v,e,t),s(e,W,t),s(e,i,t),p(D,i,null),I(i,F),I(i,z),s(e,O,t),p(C,e,t),s(e,U,t),s(e,J,t),A=!0},p:ae,i(e){A||(u(g.$$.fragment,e),u(T.$$.fragment,e),u(M.$$.fragment,e),u(y.$$.fragment,e),u(x.$$.fragment,e),u(v.$$.fragment,e),u(D.$$.fragment,e),u(C.$$.fragment,e),A=!0)},o(e){h(g.$$.fragment,e),h(T.$$.fragment,e),h(M.$$.fragment,e),h(y.$$.fragment,e),h(x.$$.fragment,e),h(v.$$.fragment,e),h(D.$$.fragment,e),h(C.$$.fragment,e),A=!1},d(e){e&&(o(Z),o(k),o(L),o(E),o(H),o(b),o(P),o($),o(N),o(R),o(V),o(d),o(j),o(W),o(i),o(O),o(U),o(J)),o(a),_(g,e),_(T,e),_(M,e),_(y,e),_(x),_(v,e),_(D),_(C,e)}}}const he='{"title":"CosmosTransformer3DModel","local":"cosmostransformer3dmodel","sections":[{"title":"CosmosTransformer3DModel","local":"diffusers.CosmosTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function _e(K){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends ie{constructor(a){super(),me(this,a,_e,ue,re,{})}}export{xe as component}; | |
Xet Storage Details
- Size:
- 10.5 kB
- Xet hash:
- c906c311fa00d1c31d906f602ea42102a05c53a467e87128e8d9daad9afced08
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.