Buckets:

download
raw
14.6 kB
import"../chunks/DsnmJJEf.js";import{i as A,h as E,C as w,H as t,a as z,D as a,E as N,s as k}from"../chunks/BtE7mKSK.js";import{p as J,o as Z,s as e,f as O,a as T,b as F,c as s,d as y,n as r,r as i}from"../chunks/jDjavuwI.js";const I='{"title":"EasyAnimateTransformer3DModel","local":"easyanimatetransformer3dmodel","sections":[{"title":"EasyAnimateTransformer3DModel","local":"diffusers.EasyAnimateTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';var L=y('<meta name="hf:doc:metadata"/>'),W=y('<p></p> <!> <!> <p>A Diffusion Transformer model for 3D data from <a href="https://github.com/aigc-apps/EasyAnimate" rel="nofollow">EasyAnimate</a> was introduced by Alibaba PAI.</p> <p>The model can be loaded with the following code snippet.</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>A Transformer model for video-like data in <a href="https://github.com/aigc-apps/EasyAnimate" rel="nofollow">EasyAnimate</a>.</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_14261/en/api/models/easyanimate_transformer3d#diffusers.EasyAnimateTransformer3DModel">EasyAnimateTransformer3DModel</a> forward method.</p></div></div> <!> <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 output of <a href="/docs/diffusers/pr_14261/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.</p></div> <!> <p></p>',1);function Y(b,v){J(v,!1),Z(()=>{new URLSearchParams(window.location.search).get("fw")}),A();var d=W();E("855ui7",h=>{var g=L();k(g,"content",I),T(h,g)});var m=e(O(d),2);w(m,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var l=e(m,2);t(l,{title:"EasyAnimateTransformer3DModel",local:"easyanimatetransformer3dmodel",headingTag:"h1"});var c=e(l,6);z(c,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEVhc3lBbmltYXRlVHJhbnNmb3JtZXIzRE1vZGVsJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBFYXN5QW5pbWF0ZVRyYW5zZm9ybWVyM0RNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYWxpYmFiYS1wYWklMkZFYXN5QW5pbWF0ZVY1LjEtMTJiLXpoJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> EasyAnimateTransformer3DModel
transformer = EasyAnimateTransformer3DModel.from_pretrained(<span class="hljs-string">&quot;alibaba-pai/EasyAnimateV5.1-12b-zh&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,lang:"python",wrap:!1});var f=e(c,2);t(f,{title:"EasyAnimateTransformer3DModel",local:"diffusers.EasyAnimateTransformer3DModel",headingTag:"h2"});var o=e(f,2),p=s(o);a(p,{name:"class diffusers.EasyAnimateTransformer3DModel",anchor:"diffusers.EasyAnimateTransformer3DModel",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/transformers/transformer_easyanimate.py#L316",parameters:[{name:"num_attention_heads",val:": int = 48"},{name:"attention_head_dim",val:": int = 64"},{name:"in_channels",val:": int | None = None"},{name:"out_channels",val:": int | None = None"},{name:"patch_size",val:": int | None = None"},{name:"sample_width",val:": int = 90"},{name:"sample_height",val:": int = 60"},{name:"activation_fn",val:": str = 'gelu-approximate'"},{name:"timestep_activation_fn",val:": str = 'silu'"},{name:"freq_shift",val:": int = 0"},{name:"num_layers",val:": int = 48"},{name:"mmdit_layers",val:": int = 48"},{name:"dropout",val:": float = 0.0"},{name:"time_embed_dim",val:": int = 512"},{name:"add_norm_text_encoder",val:": bool = False"},{name:"text_embed_dim",val:": int = 3584"},{name:"text_embed_dim_t5",val:": int = None"},{name:"norm_eps",val:": float = 1e-05"},{name:"norm_elementwise_affine",val:": bool = True"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"time_position_encoding_type",val:": str = '3d_rope'"},{name:"after_norm",val:" = False"},{name:"resize_inpaint_mask_directly",val:": bool = True"},{name:"enable_text_attention_mask",val:": bool = True"},{name:"add_noise_in_inpaint_model",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.EasyAnimateTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>48</code>) &#x2014;
The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.EasyAnimateTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>64</code>) &#x2014;
The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.EasyAnimateTransformer3DModel.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.EasyAnimateTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to <code>16</code>) &#x2014;
The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.EasyAnimateTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) &#x2014;
The size of the patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.EasyAnimateTransformer3DModel.sample_width",description:`<strong>sample_width</strong> (<code>int</code>, defaults to <code>90</code>) &#x2014;
The width of the input latents.`,name:"sample_width"},{anchor:"diffusers.EasyAnimateTransformer3DModel.sample_height",description:`<strong>sample_height</strong> (<code>int</code>, defaults to <code>60</code>) &#x2014;
The height of the input latents.`,name:"sample_height"},{anchor:"diffusers.EasyAnimateTransformer3DModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, defaults to <code>&quot;gelu-approximate&quot;</code>) &#x2014;
Activation function to use in feed-forward.`,name:"activation_fn"},{anchor:"diffusers.EasyAnimateTransformer3DModel.timestep_activation_fn",description:`<strong>timestep_activation_fn</strong> (<code>str</code>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
Activation function to use when generating the timestep embeddings.`,name:"timestep_activation_fn"},{anchor:"diffusers.EasyAnimateTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>30</code>) &#x2014;
The number of layers of Transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.EasyAnimateTransformer3DModel.mmdit_layers",description:`<strong>mmdit_layers</strong> (<code>int</code>, defaults to <code>1000</code>) &#x2014;
The number of layers of Multi Modal Transformer blocks to use.`,name:"mmdit_layers"},{anchor:"diffusers.EasyAnimateTransformer3DModel.dropout",description:`<strong>dropout</strong> (<code>float</code>, defaults to <code>0.0</code>) &#x2014;
The dropout probability to use.`,name:"dropout"},{anchor:"diffusers.EasyAnimateTransformer3DModel.time_embed_dim",description:`<strong>time_embed_dim</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
Output dimension of timestep embeddings.`,name:"time_embed_dim"},{anchor:"diffusers.EasyAnimateTransformer3DModel.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.EasyAnimateTransformer3DModel.norm_eps",description:`<strong>norm_eps</strong> (<code>float</code>, defaults to <code>1e-5</code>) &#x2014;
The epsilon value to use in normalization layers.`,name:"norm_eps"},{anchor:"diffusers.EasyAnimateTransformer3DModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to use elementwise affine in normalization layers.`,name:"norm_elementwise_affine"},{anchor:"diffusers.EasyAnimateTransformer3DModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.EasyAnimateTransformer3DModel.time_position_encoding_type",description:`<strong>time_position_encoding_type</strong> (<code>str</code>, defaults to <code>3d_rope</code>) &#x2014;
Type of time position encoding.`,name:"time_position_encoding_type"},{anchor:"diffusers.EasyAnimateTransformer3DModel.after_norm",description:`<strong>after_norm</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Flag to apply normalization after.`,name:"after_norm"},{anchor:"diffusers.EasyAnimateTransformer3DModel.resize_inpaint_mask_directly",description:`<strong>resize_inpaint_mask_directly</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Flag to resize inpaint mask directly.`,name:"resize_inpaint_mask_directly"},{anchor:"diffusers.EasyAnimateTransformer3DModel.enable_text_attention_mask",description:`<strong>enable_text_attention_mask</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Flag to enable text attention mask.`,name:"enable_text_attention_mask"},{anchor:"diffusers.EasyAnimateTransformer3DModel.add_noise_in_inpaint_model",description:`<strong>add_noise_in_inpaint_model</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Flag to add noise in inpaint model.`,name:"add_noise_in_inpaint_model"}]});var _=e(p,4),M=s(_);a(M,{name:"forward",anchor:"diffusers.EasyAnimateTransformer3DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/transformers/transformer_easyanimate.py#L461",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": Tensor"},{name:"timestep_cond",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states_t5",val:": typing.Optional[torch.Tensor] = None"},{name:"inpaint_latents",val:": typing.Optional[torch.Tensor] = None"},{name:"control_latents",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, channels, num_frames, height, width)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.timestep_cond",description:`<strong>timestep_cond</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Conditional embeddings for timestep. If provided, the embeddings will be summed with the samples passed
through the <code>self.time_embedding</code> layer to obtain the final timestep embeddings.`,name:"timestep_cond"},{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.encoder_hidden_states_t5",description:`<strong>encoder_hidden_states_t5</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Additional conditional embeddings computed from a T5 text encoder.`,name:"encoder_hidden_states_t5"},{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.inpaint_latents",description:`<strong>inpaint_latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Latents concatenated to <code>hidden_states</code> for inpainting variants of the model.`,name:"inpaint_latents"},{anchor:"diffusers.EasyAnimateTransformer3DModel.forward.control_latents",description:`<strong>control_latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Latents concatenated to <code>hidden_states</code> for control variants of the model.`,name:"control_latents"},{anchor:"diffusers.EasyAnimateTransformer3DModel.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"}],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>
`}),r(2),i(_),i(o);var u=e(o,2);t(u,{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"});var n=e(u,2),D=s(n);a(D,{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14261/src/diffusers/models/modeling_outputs.py#L21",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_14261/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"}]}),r(2),i(n);var x=e(n,2);N(x,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/easyanimate_transformer3d.md"}),r(2),T(b,d),F()}export{Y as component};

Xet Storage Details

Size:
14.6 kB
·
Xet hash:
088272aa27a003ca87bec478b0d91a172a1e452ae40f66246d83c71ae7c93c19

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