Buckets:

rtrm's picture
download
raw
10.2 kB
import{s as se,n as ne,o as re}from"../chunks/scheduler.8c3d61f6.js";import{S as ae,i as de,g as m,s as n,r as $,A as ie,h as l,f as o,c as r,j as G,u as M,x as S,k as q,y as J,a as s,v,d as y,t as D,w as x}from"../chunks/index.da70eac4.js";import{D as oe}from"../chunks/Docstring.eabe339b.js";import{C as me}from"../chunks/CodeBlock.a9c4becf.js";import{H as B,E as le}from"../chunks/getInferenceSnippets.366c2c95.js";function fe(F){let a,I,z,Z,f,E,c,Y='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.',H,u,K="The model can be loaded with the following code snippet.",L,p,P,h,N,d,_,Q,C,ee='A Transformer model for video-like data used in <a href="https://github.com/NVIDIA/Cosmos" rel="nofollow">Cosmos</a>.',R,g,V,i,T,X,w,te='The output of <a href="/docs/diffusers/pr_11986/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',j,b,W,k,A;return f=new B({props:{title:"CosmosTransformer3DModel",local:"cosmostransformer3dmodel",headingTag:"h1"}}),p=new me({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">&quot;nvidia/Cosmos-1.0-Diffusion-7B-Text2World&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),h=new B({props:{title:"CosmosTransformer3DModel",local:"diffusers.CosmosTransformer3DModel",headingTag:"h2"}}),_=new oe({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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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_11986/src/diffusers/models/transformers/transformer_cosmos.py#L387"}}),g=new B({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),T=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/pr_11986/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_11986/src/diffusers/models/modeling_outputs.py#L20"}}),b=new le({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/cosmos_transformer3d.md"}}),{c(){a=m("meta"),I=n(),z=m("p"),Z=n(),$(f.$$.fragment),E=n(),c=m("p"),c.innerHTML=Y,H=n(),u=m("p"),u.textContent=K,L=n(),$(p.$$.fragment),P=n(),$(h.$$.fragment),N=n(),d=m("div"),$(_.$$.fragment),Q=n(),C=m("p"),C.innerHTML=ee,R=n(),$(g.$$.fragment),V=n(),i=m("div"),$(T.$$.fragment),X=n(),w=m("p"),w.innerHTML=te,j=n(),$(b.$$.fragment),W=n(),k=m("p"),this.h()},l(e){const t=ie("svelte-u9bgzb",document.head);a=l(t,"META",{name:!0,content:!0}),t.forEach(o),I=r(e),z=l(e,"P",{}),G(z).forEach(o),Z=r(e),M(f.$$.fragment,e),E=r(e),c=l(e,"P",{"data-svelte-h":!0}),S(c)!=="svelte-1pjw3fi"&&(c.innerHTML=Y),H=r(e),u=l(e,"P",{"data-svelte-h":!0}),S(u)!=="svelte-1vuni30"&&(u.textContent=K),L=r(e),M(p.$$.fragment,e),P=r(e),M(h.$$.fragment,e),N=r(e),d=l(e,"DIV",{class:!0});var O=G(d);M(_.$$.fragment,O),Q=r(O),C=l(O,"P",{"data-svelte-h":!0}),S(C)!=="svelte-y8uhes"&&(C.innerHTML=ee),O.forEach(o),R=r(e),M(g.$$.fragment,e),V=r(e),i=l(e,"DIV",{class:!0});var U=G(i);M(T.$$.fragment,U),X=r(U),w=l(U,"P",{"data-svelte-h":!0}),S(w)!=="svelte-k0667v"&&(w.innerHTML=te),U.forEach(o),j=r(e),M(b.$$.fragment,e),W=r(e),k=l(e,"P",{}),G(k).forEach(o),this.h()},h(){q(a,"name","hf:doc:metadata"),q(a,"content",ce),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(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){J(document.head,a),s(e,I,t),s(e,z,t),s(e,Z,t),v(f,e,t),s(e,E,t),s(e,c,t),s(e,H,t),s(e,u,t),s(e,L,t),v(p,e,t),s(e,P,t),v(h,e,t),s(e,N,t),s(e,d,t),v(_,d,null),J(d,Q),J(d,C),s(e,R,t),v(g,e,t),s(e,V,t),s(e,i,t),v(T,i,null),J(i,X),J(i,w),s(e,j,t),v(b,e,t),s(e,W,t),s(e,k,t),A=!0},p:ne,i(e){A||(y(f.$$.fragment,e),y(p.$$.fragment,e),y(h.$$.fragment,e),y(_.$$.fragment,e),y(g.$$.fragment,e),y(T.$$.fragment,e),y(b.$$.fragment,e),A=!0)},o(e){D(f.$$.fragment,e),D(p.$$.fragment,e),D(h.$$.fragment,e),D(_.$$.fragment,e),D(g.$$.fragment,e),D(T.$$.fragment,e),D(b.$$.fragment,e),A=!1},d(e){e&&(o(I),o(z),o(Z),o(E),o(c),o(H),o(u),o(L),o(P),o(N),o(d),o(R),o(V),o(i),o(j),o(W),o(k)),o(a),x(f,e),x(p,e),x(h,e),x(_),x(g,e),x(T),x(b,e)}}}const ce='{"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 ue(F){return re(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends ae{constructor(a){super(),de(this,a,ue,fe,se,{})}}export{be as component};

Xet Storage Details

Size:
10.2 kB
·
Xet hash:
3eb9b83ee7e64b2de3e07bc2964490ad7e9b6bf50afc2c742be93e0c4aeb0b8a

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