Buckets:

download
raw
9.93 kB
import"../chunks/DsnmJJEf.js";import{i as x,h as M,C as w,H as l,a as N,D as f,E as D,s as A}from"../chunks/DBNuz8hP.js";import{p as P,o as k,s as e,f as J,a as h,b as z,c as p,d as g,n as _,r as u}from"../chunks/CQ2f15a1.js";const R='{"title":"PAN2Transformer3DModel","local":"pan2transformer3dmodel","sections":[{"title":"PAN2Transformer3DModel","local":"diffusers.PAN2Transformer3DModel","sections":[],"depth":2}],"depth":1}';var U=g('<meta name="hf:doc:metadata"/>'),W=g(`<p></p> <!> <!> <p>The diffusion transformer of PAN 2. It runs joint attention over the video tokens and the text tokens, with separate projections and feed-forward networks for each stream.</p> <p>The video input stacks the noisy latents, the conditioning latents and a one-channel conditioning mask, so the same model serves text-to-video and image-to-video.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The diffusion transformer of PAN 2.</p> <p>A stack of joint-attention blocks over the concatenation of the patchified video latents and the refined text
tokens. The video input carries the noisy latents, the conditioning latents and a conditioning mask stacked along
the channel axis, so the same model serves text-to-video and image-to-video.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The <a href="/docs/diffusers/pr_15243/en/api/models/pan2_transformer3d#diffusers.PAN2Transformer3DModel">PAN2Transformer3DModel</a> forward method.</p></div></div> <!> <p></p>`,1);function O(T,b){P(b,!1),k(()=>{new URLSearchParams(window.location.search).get("fw")}),x();var n=W();M("medoer",c=>{var m=U();A(m,"content",R),h(c,m)});var t=e(J(n),2);w(t,{containerStyle:"float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"});var r=e(t,2);l(r,{title:"PAN2Transformer3DModel",local:"pan2transformer3dmodel",headingTag:"h1"});var a=e(r,6);N(a,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwUEFOMlRyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwUEFOMlRyYW5zZm9ybWVyM0RNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIySUZNJTJGUEFOMiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTIwZHR5cGUlM0R0b3JjaC5iZmxvYXQxNik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> PAN2Transformer3DModel
transformer = PAN2Transformer3DModel.from_pretrained(<span class="hljs-string">&quot;IFM/PAN2&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, dtype=torch.bfloat16)`,lang:"python",wrap:!1});var s=e(a,2);l(s,{title:"PAN2Transformer3DModel",local:"diffusers.PAN2Transformer3DModel",headingTag:"h2"});var o=e(s,2),d=p(o);f(d,{name:"class diffusers.PAN2Transformer3DModel",anchor:"diffusers.PAN2Transformer3DModel",source:"https://github.com/huggingface/diffusers/blob/vr_15243/src/diffusers/models/transformers/transformer_pan2.py#L325",parameters:[{name:"patch_size",val:": tuple[int, int, int] = (1, 2, 2)"},{name:"in_channels",val:": int = 97"},{name:"out_channels",val:": int = 48"},{name:"num_attention_heads",val:": int = 32"},{name:"attention_head_dim",val:": int = 128"},{name:"num_layers",val:": int = 44"},{name:"num_refiner_layers",val:": int = 4"},{name:"mlp_ratio",val:": float = 8.0"},{name:"context_mlp_ratio",val:": float = 4.0"},{name:"refiner_mlp_ratio",val:": float = 4.0"},{name:"text_embed_dim",val:": int = 4096"},{name:"rope_axes_dim",val:": tuple[int, int, int] = (16, 56, 56)"},{name:"rope_theta",val:": float = 256.0"},{name:"rope_temporal_scale",val:": float = 0.6666666666666666"}],parametersDescription:[{anchor:"diffusers.PAN2Transformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>tuple[int, int, int]</code>, defaults to <code>(1, 2, 2)</code>) &#x2014;
The <code>(t, h, w)</code> patch size of the patch embedding.`,name:"patch_size"},{anchor:"diffusers.PAN2Transformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>97</code>) &#x2014;
The number of input channels: noisy latents, conditioning latents and one conditioning mask channel.`,name:"in_channels"},{anchor:"diffusers.PAN2Transformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>48</code>) &#x2014;
The number of output channels.`,name:"out_channels"},{anchor:"diffusers.PAN2Transformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>32</code>) &#x2014;
The number of attention heads.`,name:"num_attention_heads"},{anchor:"diffusers.PAN2Transformer3DModel.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.PAN2Transformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>44</code>) &#x2014;
The number of joint-attention blocks.`,name:"num_layers"},{anchor:"diffusers.PAN2Transformer3DModel.num_refiner_layers",description:`<strong>num_refiner_layers</strong> (<code>int</code>, defaults to <code>4</code>) &#x2014;
The number of token refiner blocks applied to the text embeddings.`,name:"num_refiner_layers"},{anchor:"diffusers.PAN2Transformer3DModel.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, defaults to <code>8.0</code>) &#x2014;
The ratio of the video feed-forward inner dimension to the hidden dimension.`,name:"mlp_ratio"},{anchor:"diffusers.PAN2Transformer3DModel.context_mlp_ratio",description:`<strong>context_mlp_ratio</strong> (<code>float</code>, defaults to <code>4.0</code>) &#x2014;
The ratio of the text feed-forward inner dimension to the hidden dimension.`,name:"context_mlp_ratio"},{anchor:"diffusers.PAN2Transformer3DModel.refiner_mlp_ratio",description:`<strong>refiner_mlp_ratio</strong> (<code>float</code>, defaults to <code>4.0</code>) &#x2014;
The ratio of the token refiner feed-forward inner dimension to the hidden dimension.`,name:"refiner_mlp_ratio"},{anchor:"diffusers.PAN2Transformer3DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
The dimension of the text encoder hidden states.`,name:"text_embed_dim"},{anchor:"diffusers.PAN2Transformer3DModel.rope_axes_dim",description:`<strong>rope_axes_dim</strong> (<code>tuple[int, int, int]</code>, defaults to <code>(16, 56, 56)</code>) &#x2014;
The number of channels of each <code>(t, h, w)</code> axis in the rotary embedding.`,name:"rope_axes_dim"},{anchor:"diffusers.PAN2Transformer3DModel.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, defaults to <code>256.0</code>) &#x2014;
The base of the rotary embedding.`,name:"rope_theta"},{anchor:"diffusers.PAN2Transformer3DModel.rope_temporal_scale",description:`<strong>rope_temporal_scale</strong> (<code>float</code>, defaults to <code>16 / 24</code>) &#x2014;
The factor the frame positions of the rotary embedding are multiplied with: the reference frame rate of the
rotary embedding over the frame rate of the videos (16 over 24 fps).`,name:"rope_temporal_scale"}]});var i=e(d,6),v=p(i);f(v,{name:"forward",anchor:"diffusers.PAN2Transformer3DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_15243/src/diffusers/models/transformers/transformer_pan2.py#L438",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PAN2Transformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, in_channels, num_frames, height, width)</code>) &#x2014;
The noisy latents, the conditioning latents and the conditioning mask, concatenated along channels.`,name:"hidden_states"},{anchor:"diffusers.PAN2Transformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.Tensor</code> of shape <code>(batch_size,)</code>) &#x2014;
The denoising timestep in <code>[0, 1000]</code>.`,name:"timestep"},{anchor:"diffusers.PAN2Transformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, text_seq_len, text_embed_dim)</code>) &#x2014;
The text encoder hidden states.`,name:"encoder_hidden_states"},{anchor:"diffusers.PAN2Transformer3DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary passed along to the <code>AttentionProcessor</code>; only used for the LoRA scale.`,name:"attention_kwargs"},{anchor:"diffusers.PAN2Transformer3DModel.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 <a href="/docs/diffusers/pr_15243/en/api/models/cogview3plus_transformer2d#diffusers.models.modeling_outputs.Transformer2DModelOutput">Transformer2DModelOutput</a> instead of a plain
tuple.`,name:"return_dict"}],returnDescription:`
<p>The predicted velocity of shape <code>(batch_size, out_channels, num_frames, height, width)</code>.</p>
`,returnType:`
<p><a
href="/docs/diffusers/pr_15243/en/api/models/cogview3plus_transformer2d#diffusers.models.modeling_outputs.Transformer2DModelOutput"
>Transformer2DModelOutput</a> or <code>tuple</code></p>
`}),_(2),u(i),u(o);var y=e(o,2);D(y,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/pan2_transformer3d.md"}),_(2),h(T,n),z()}export{O as component};

Xet Storage Details

Size:
9.93 kB
·
Xet hash:
d275e3b76d7ecd1c79360c916967c8c099a7925dc873667d04e205893836002b

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