Buckets:
| import"../chunks/DsnmJJEf.js";import{i as w,h as L,C as M,H as m,a as x,D as f,E as k,s as X}from"../chunks/BtE7mKSK.js";import{p as V,o as D,s as e,f as z,a as u,b as N,c as p,d as g,n as _,r as h}from"../chunks/jDjavuwI.js";const I='{"title":"LTX2VideoTransformer3DModel","local":"ltx2videotransformer3dmodel","sections":[{"title":"LTX2VideoTransformer3DModel","local":"diffusers.LTX2VideoTransformer3DModel","sections":[],"depth":2}],"depth":1}';var R=g('<meta name="hf:doc:metadata"/>'),q=g('<p></p> <!> <!> <p>A Diffusion Transformer model for 3D data from <a href="https://huggingface.co/Lightricks/LTX-2" rel="nofollow">LTX</a> was introduced by Lightricks.</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 used in <a href="https://huggingface.co/Lightricks/LTX-Video" rel="nofollow">LTX</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>Forward pass for LTX-2.0 audiovisual video transformer.</p></div></div> <!> <p></p>',1);function J(T,v){V(v,!1),D(()=>{new URLSearchParams(window.location.search).get("fw")}),w();var n=q();L("1i20xey",c=>{var l=R();X(l,"content",I),u(c,l)});var t=e(z(n),2);M(t,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var a=e(t,2);m(a,{title:"LTX2VideoTransformer3DModel",local:"ltx2videotransformer3dmodel",headingTag:"h1"});var s=e(a,6);x(s,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMExUWDJWaWRlb1RyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwTFRYMlZpZGVvVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJMaWdodHJpY2tzJTJGTFRYLTIlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ0cmFuc2Zvcm1lciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LTX2VideoTransformer3DModel | |
| transformer = LTX2VideoTransformer3DModel.from_pretrained(<span class="hljs-string">"Lightricks/LTX-2"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.bfloat16).to(<span class="hljs-string">"cuda"</span>)`,lang:"python",wrap:!1});var r=e(s,2);m(r,{title:"LTX2VideoTransformer3DModel",local:"diffusers.LTX2VideoTransformer3DModel",headingTag:"h2"});var o=e(r,2),i=p(o);f(i,{name:"class diffusers.LTX2VideoTransformer3DModel",anchor:"diffusers.LTX2VideoTransformer3DModel",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_ltx2.py#L1062",parameters:[{name:"in_channels",val:": int = 128"},{name:"out_channels",val:": int | None = 128"},{name:"patch_size",val:": int = 1"},{name:"patch_size_t",val:": int = 1"},{name:"num_attention_heads",val:": int = 32"},{name:"attention_head_dim",val:": int = 128"},{name:"cross_attention_dim",val:": int = 4096"},{name:"vae_scale_factors",val:": tuple = (8, 32, 32)"},{name:"pos_embed_max_pos",val:": int = 20"},{name:"base_height",val:": int = 2048"},{name:"base_width",val:": int = 2048"},{name:"gated_attn",val:": bool = False"},{name:"cross_attn_mod",val:": bool = False"},{name:"audio_in_channels",val:": int = 128"},{name:"audio_out_channels",val:": int | None = 128"},{name:"audio_patch_size",val:": int = 1"},{name:"audio_patch_size_t",val:": int = 1"},{name:"audio_num_attention_heads",val:": int = 32"},{name:"audio_attention_head_dim",val:": int = 64"},{name:"audio_cross_attention_dim",val:": int = 2048"},{name:"audio_scale_factor",val:": int = 4"},{name:"audio_pos_embed_max_pos",val:": int = 20"},{name:"audio_sampling_rate",val:": int = 16000"},{name:"audio_hop_length",val:": int = 160"},{name:"audio_gated_attn",val:": bool = False"},{name:"audio_cross_attn_mod",val:": bool = False"},{name:"num_layers",val:": int = 48"},{name:"activation_fn",val:": str = 'gelu-approximate'"},{name:"qk_norm",val:": str = 'rms_norm_across_heads'"},{name:"norm_elementwise_affine",val:": bool = False"},{name:"norm_eps",val:": float = 1e-06"},{name:"caption_channels",val:": int = 3840"},{name:"attention_bias",val:": bool = True"},{name:"attention_out_bias",val:": bool = True"},{name:"rope_theta",val:": float = 10000.0"},{name:"rope_double_precision",val:": bool = True"},{name:"causal_offset",val:": int = 1"},{name:"timestep_scale_multiplier",val:": int = 1000"},{name:"cross_attn_timestep_scale_multiplier",val:": int = 1000"},{name:"rope_type",val:": str = 'interleaved'"},{name:"use_prompt_embeddings",val:" = True"},{name:"perturbed_attn",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.LTX2VideoTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.LTX2VideoTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.LTX2VideoTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| The size of the spatial patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.LTX2VideoTransformer3DModel.patch_size_t",description:`<strong>patch_size_t</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| The size of the tmeporal patches to use in the patch embedding layer.`,name:"patch_size_t"},{anchor:"diffusers.LTX2VideoTransformer3DModel.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.LTX2VideoTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>64</code>) — | |
| The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.LTX2VideoTransformer3DModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, defaults to <code>2048 </code>) — | |
| The number of channels for cross attention heads.`,name:"cross_attention_dim"},{anchor:"diffusers.LTX2VideoTransformer3DModel.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.LTX2VideoTransformer3DModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, defaults to <code>"gelu-approximate"</code>) — | |
| Activation function to use in feed-forward.`,name:"activation_fn"},{anchor:"diffusers.LTX2VideoTransformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, defaults to <code>"rms_norm_across_heads"</code>) — | |
| The normalization layer to use.`,name:"qk_norm"}]});var d=e(i,4),b=p(d);f(b,{name:"forward",anchor:"diffusers.LTX2VideoTransformer3DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_ltx2.py#L1321",parameters:[{name:"hidden_states",val:": Tensor"},{name:"audio_hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"audio_encoder_hidden_states",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"audio_timestep",val:": typing.Optional[torch.LongTensor] = None"},{name:"sigma",val:": typing.Optional[torch.Tensor] = None"},{name:"audio_sigma",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"audio_encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"num_frames",val:": int | None = None"},{name:"height",val:": int | None = None"},{name:"width",val:": int | None = None"},{name:"fps",val:": float = 24.0"},{name:"audio_num_frames",val:": int | None = None"},{name:"video_coords",val:": typing.Optional[torch.Tensor] = None"},{name:"audio_coords",val:": typing.Optional[torch.Tensor] = None"},{name:"isolate_modalities",val:": bool = False"},{name:"spatio_temporal_guidance_blocks",val:": list[int] | None = None"},{name:"perturbation_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"use_cross_timestep",val:": bool = False"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"video_self_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code>) — | |
| Input patchified video latents of shape <code>(batch_size, num_video_tokens, in_channels)</code>.`,name:"hidden_states"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_hidden_states",description:`<strong>audio_hidden_states</strong> (<code>torch.Tensor</code>) — | |
| Input patchified audio latents of shape <code>(batch_size, num_audio_tokens, audio_in_channels)</code>.`,name:"audio_hidden_states"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>) — | |
| Input video text embeddings of shape <code>(batch_size, text_seq_len, self.config.caption_channels)</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_encoder_hidden_states",description:`<strong>audio_encoder_hidden_states</strong> (<code>torch.Tensor</code>) — | |
| Input audio text embeddings of shape <code>(batch_size, text_seq_len, self.config.caption_channels)</code>.`,name:"audio_encoder_hidden_states"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.Tensor</code>) — | |
| Input timestep of shape <code>(batch_size, num_video_tokens)</code>. These should already be scaled by | |
| <code>self.config.timestep_scale_multiplier</code>.`,name:"timestep"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_timestep",description:`<strong>audio_timestep</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Input timestep of shape <code>(batch_size,)</code> or <code>(batch_size, num_audio_tokens)</code> for audio modulation | |
| params. This is only used by certain pipelines such as the I2V pipeline.`,name:"audio_timestep"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.sigma",description:`<strong>sigma</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Input scaled timestep of shape (batch_size,). Used for video prompt cross attention modulation in | |
| models such as LTX-2.3.`,name:"sigma"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_sigma",description:`<strong>audio_sigma</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Input scaled timestep of shape (batch_size,). Used for audio prompt cross attention modulation in | |
| models such as LTX-2.3. If <code>sigma</code> is supplied but <code>audio_sigma</code> is not, <code>audio_sigma</code> will be set to | |
| the provided <code>sigma</code> value.`,name:"audio_sigma"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Optional multiplicative text attention mask of shape <code>(batch_size, text_seq_len)</code>.`,name:"encoder_attention_mask"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_encoder_attention_mask",description:`<strong>audio_encoder_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Optional multiplicative text attention mask of shape <code>(batch_size, text_seq_len)</code> for audio modeling.`,name:"audio_encoder_attention_mask"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, <em>optional</em>) — | |
| The number of latent video frames. Used if calculating the video coordinates for RoPE.`,name:"num_frames"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>) — | |
| The latent video height. Used if calculating the video coordinates for RoPE.`,name:"height"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>) — | |
| The latent video width. Used if calculating the video coordinates for RoPE.`,name:"width"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.fps",description:`<strong>fps</strong> — (<code>float</code>, <em>optional</em>, defaults to <code>24.0</code>): | |
| The desired frames per second of the generated video. Used if calculating the video coordinates for | |
| RoPE.`,name:"fps"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_num_frames",description:`<strong>audio_num_frames</strong> — (<code>int</code>, <em>optional</em>): | |
| The number of latent audio frames. Used if calculating the audio coordinates for RoPE.`,name:"audio_num_frames"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.video_coords",description:`<strong>video_coords</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| The video coordinates to be used when calculating the rotary positional embeddings (RoPE) of shape | |
| <code>(batch_size, 3, num_video_tokens, 2)</code>. If not supplied, this will be calculated inside <code>forward</code>.`,name:"video_coords"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.audio_coords",description:`<strong>audio_coords</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| The audio coordinates to be used when calculating the rotary positional embeddings (RoPE) of shape | |
| <code>(batch_size, 1, num_audio_tokens, 2)</code>. If not supplied, this will be calculated inside <code>forward</code>.`,name:"audio_coords"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.isolate_modalities",description:`<strong>isolate_modalities</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to isolate each modality by turning off cross-modality (audio-to-video and video-to-audio) | |
| cross attention (for all blocks). Use for modality guidance in LTX-2.3.`,name:"isolate_modalities"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.spatio_temporal_guidance_blocks",description:`<strong>spatio_temporal_guidance_blocks</strong> (<code>list[int]</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| The transformer block indices at which to apply spatio-temporal guidance (STG), which shortcuts the | |
| self-attention operations by simply using the values rather than the full scaled dot-product attention | |
| (SDPA) operation. If <code>None</code> or empty, STG will not be applied to any block.`,name:"spatio_temporal_guidance_blocks"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.perturbation_mask",description:`<strong>perturbation_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Perturbation mask for STG of shape <code>(batch_size,)</code> or <code>(batch_size, 1, 1)</code>. Should be 0 at batch | |
| elements where STG should be applied and 1 elsewhere. If STG is being used but <code>peturbation_mask</code> is | |
| not supplied, will default to applying STG (perturbing) all batch elements.`,name:"perturbation_mask"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.use_cross_timestep",description:`<strong>use_cross_timestep</strong> (<code>bool</code> <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use the cross modality (audio is the cross modality of video, and vice versa) sigma when | |
| calculating the cross attention modulation parameters. <code>True</code> is the newer (e.g. LTX-2.3) behavior; | |
| <code>False</code> is the legacy LTX-2.0 behavior.`,name:"use_cross_timestep"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) — | |
| Optional dict of keyword args to be passed to the attention processor.`,name:"attention_kwargs"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.video_self_attention_mask",description:`<strong>video_self_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Optional multiplicative self-attention mask of shape <code>(batch_size, num_video_tokens, num_video_tokens)</code> | |
| applied to the video self-attention in each transformer block. Values in <code>[0, 1]</code> where <code>1</code> means full | |
| attention and <code>0</code> means masked. Used e.g. by the IC-LoRA pipeline to control attention strength between | |
| noisy tokens and appended reference tokens. Audio self-attention is not affected.`,name:"video_self_attention_mask"},{anchor:"diffusers.LTX2VideoTransformer3DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to return a dict-like structured output of type <code>AudioVisualModelOutput</code> or a tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, returns a structured output of type <code>AudioVisualModelOutput</code>, otherwise a | |
| <code>tuple</code> is returned where the first element is the denoised video latent patch sequence and the second | |
| element is the denoised audio latent patch sequence.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>AudioVisualModelOutput</code> or <code>tuple</code></p> | |
| `}),_(2),h(d),h(o);var y=e(o,2);k(y,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/ltx2_video_transformer3d.md"}),_(2),u(T,n),N()}export{J as component}; | |
Xet Storage Details
- Size:
- 18.1 kB
- Xet hash:
- 56c2964090c313490c8e509be89251b8406a29cfe491d5099adcb7ec42c6cb74
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.