Buckets:

download
raw
11.9 kB
import"../chunks/DsnmJJEf.js";import{i as x,h as V,C as X,H as r,a as w,D as t,E as k,s as z}from"../chunks/BtE7mKSK.js";import{p as N,o as q,s as e,f as R,a as T,b as U,c as s,d as b,n as a,r as d}from"../chunks/jDjavuwI.js";const W='{"title":"LTXVideoTransformer3DModel","local":"ltxvideotransformer3dmodel","sections":[{"title":"LTXVideoTransformer3DModel","local":"diffusers.LTXVideoTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';var Z=b('<meta name="hf:doc:metadata"/>'),J=b('<p></p> <!> <!> <p>A Diffusion Transformer model for 3D data from <a href="https://huggingface.co/Lightricks/LTX-Video" 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>The <a href="/docs/diffusers/pr_13966/en/api/models/ltx_video_transformer3d#diffusers.LTXVideoTransformer3DModel">LTXVideoTransformer3DModel</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_13966/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.</p></div> <!> <p></p>',1);function I(v,y){N(y,!1),q(()=>{new URLSearchParams(window.location.search).get("fw")}),x();var i=J();V("hubo8c",_=>{var g=Z();z(g,"content",W),T(_,g)});var c=e(R(i),2);X(c,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var l=e(c,2);r(l,{title:"LTXVideoTransformer3DModel",local:"ltxvideotransformer3dmodel",headingTag:"h1"});var m=e(l,6);w(m,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMExUWFZpZGVvVHJhbnNmb3JtZXIzRE1vZGVsJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBMVFhWaWRlb1RyYW5zZm9ybWVyM0RNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyTGlnaHRyaWNrcyUyRkxUWC1WaWRlbyUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNikudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LTXVideoTransformer3DModel
transformer = LTXVideoTransformer3DModel.from_pretrained(<span class="hljs-string">&quot;Lightricks/LTX-Video&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,lang:"python",wrap:!1});var f=e(m,2);r(f,{title:"LTXVideoTransformer3DModel",local:"diffusers.LTXVideoTransformer3DModel",headingTag:"h2"});var o=e(f,2),h=s(o);t(h,{name:"class diffusers.LTXVideoTransformer3DModel",anchor:"diffusers.LTXVideoTransformer3DModel",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_ltx.py#L385",parameters:[{name:"in_channels",val:": int = 128"},{name:"out_channels",val:": int = 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 = 64"},{name:"cross_attention_dim",val:": int = 2048"},{name:"num_layers",val:": int = 28"},{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 = 4096"},{name:"attention_bias",val:": bool = True"},{name:"attention_out_bias",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LTXVideoTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.LTXVideoTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.LTXVideoTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
The size of the spatial patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.LTXVideoTransformer3DModel.patch_size_t",description:`<strong>patch_size_t</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
The size of the tmeporal patches to use in the patch embedding layer.`,name:"patch_size_t"},{anchor:"diffusers.LTXVideoTransformer3DModel.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.LTXVideoTransformer3DModel.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.LTXVideoTransformer3DModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, defaults to <code>2048 </code>) &#x2014;
The number of channels for cross attention heads.`,name:"cross_attention_dim"},{anchor:"diffusers.LTXVideoTransformer3DModel.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.LTXVideoTransformer3DModel.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.LTXVideoTransformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, defaults to <code>&quot;rms_norm_across_heads&quot;</code>) &#x2014;
The normalization layer to use.`,name:"qk_norm"}]});var p=e(h,4),M=s(p);t(M,{name:"forward",anchor:"diffusers.LTXVideoTransformer3DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_ltx.py#L494",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"encoder_attention_mask",val:": Tensor"},{name:"num_frames",val:": int | None = None"},{name:"height",val:": int | None = None"},{name:"width",val:": int | None = None"},{name:"rope_interpolation_scale",val:": typing.Union[tuple[float, float, float], torch.Tensor, NoneType] = None"},{name:"video_coords",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LTXVideoTransformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, in_channels)</code>) &#x2014;
Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_len, embed_dims)</code>) &#x2014;
Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
Mask applied to <code>encoder_hidden_states</code> during attention.`,name:"encoder_attention_mask"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of frames in the video used to compute the rotary positional embeddings.`,name:"num_frames"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Height of the latent used to compute the rotary positional embeddings.`,name:"height"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Width of the latent used to compute the rotary positional embeddings.`,name:"width"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.rope_interpolation_scale",description:`<strong>rope_interpolation_scale</strong> (<code>tuple</code> of <code>float</code> or <code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Interpolation scale used by the rotary positional embeddings.`,name:"rope_interpolation_scale"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.video_coords",description:`<strong>video_coords</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-computed video coordinates used by the rotary positional embeddings.`,name:"video_coords"},{anchor:"diffusers.LTXVideoTransformer3DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.LTXVideoTransformer3DModel.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>The denoised output tensor of shape <code>(batch_size, sequence_length, out_channels)</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>torch.Tensor</code></p>
`}),a(2),d(p),d(o);var u=e(o,2);r(u,{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"});var n=e(u,2),D=s(n);t(D,{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",source:"https://github.com/huggingface/diffusers/blob/vr_13966/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_13966/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"}]}),a(2),d(n);var L=e(n,2);k(L,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/ltx_video_transformer3d.md"}),a(2),T(v,i),U()}export{I as component};

Xet Storage Details

Size:
11.9 kB
·
Xet hash:
916836632edec03664730adea9289af543b03cde83dd34faa11f02a6c9ccc933

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