Buckets:

download
raw
27.5 kB
import"../chunks/DsnmJJEf.js";import{i as B,h as Y,C as H,H as s,a as Q,D as r,E as $,s as ee}from"../chunks/BLbO27j4.js";import{p as re,o as oe,s as e,f as ae,a as X,b as ne,c as o,d as K,n,r as a}from"../chunks/jDjavuwI.js";const se='{"title":"SanaWMLTX2RefinerTransformer3DModel","local":"sanawmltx2refinertransformer3dmodel","sections":[{"title":"SanaWMLTX2RefinerTransformer3DModel","local":"diffusers.SanaWMLTX2RefinerTransformer3DModel","sections":[],"depth":2},{"title":"SanaWMRefinerKVCache","local":"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVCache","sections":[],"depth":2},{"title":"SanaWMRefinerKVLayerCache","local":"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';var te=K('<meta name="hf:doc:metadata"/>'),ie=K(`<p></p> <!> <!> <p>The chunk-causal autoregressive refiner DiT used as stage 2 of <a href="/docs/diffusers/pr_15078/en/api/pipelines/sana_wm#diffusers.SanaWMPipeline">SanaWMPipeline</a>, driven by <a href="/docs/diffusers/pr_15078/en/api/pipelines/sana_wm#diffusers.SanaWMLTX2Refiner">SanaWMLTX2Refiner</a>.</p> <p>It is architecturally identical to <a href="/docs/diffusers/pr_15078/en/api/models/ltx2_video_transformer3d#diffusers.LTX2VideoTransformer3DModel">LTX2VideoTransformer3DModel</a> — same config arguments, same submodules, same
parameter names — so a released LTX-2 checkpoint loads into it unchanged. The forward pass differs:</p> <ul><li>only the video stream is run (the audio and audio/video cross-attention branches are skipped),</li> <li>self-attention runs against an explicit sliding-window KV cache (<code>SanaWMRefinerKVCache</code>) holding the attention
sink plus the recent refined history, so per-block compute is bounded and total refinement cost scales linearly
with video length,</li> <li>the caller supplies the video RoPE, which lets each autoregressive window keep every frame’s absolute index in the
source video (see <a href="/docs/diffusers/pr_15078/en/api/models/sana_wm_refiner_transformer3d#diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions">SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions()</a>).</li></ul> <p>The model can be loaded with:</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 chunk-causal autoregressive refiner transformer used as SANA-WM stage 2.</p> <p>Architecturally identical to <a href="/docs/diffusers/pr_15078/en/api/models/ltx2_video_transformer3d#diffusers.LTX2VideoTransformer3DModel">LTX2VideoTransformer3DModel</a> — same config arguments, same submodules, same
parameter names — so a released LTX-2 checkpoint loads into it unchanged. What differs is the forward pass:</p> <ul><li>only the video stream is run (the audio and audio/video cross-attention branches are skipped),</li> <li>self-attention runs against an explicit sliding-window KV cache (<code>SanaWMRefinerKVCache</code>) holding the attention
sink plus recent refined history, so refinement cost is bounded per AR block and scales linearly with video
length,</li> <li>the caller supplies the video RoPE, which lets each AR window keep every frame’s absolute index in the source
video (see <a href="/docs/diffusers/pr_15078/en/api/models/sana_wm_refiner_transformer3d#diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions">build_rotary_emb_for_absolute_positions()</a>).</li></ul> <p>The remaining arguments mirror <a href="/docs/diffusers/pr_15078/en/api/models/ltx2_video_transformer3d#diffusers.LTX2VideoTransformer3DModel">LTX2VideoTransformer3DModel</a> one-for-one. The audio-side arguments and submodules
are kept purely so the checkpoint’s audio weights round-trip; they are not used by the refiner forward.</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>Build the video RoPE for an explicit list of absolute latent-frame indices.</p> <p><code>SanaWMLTX2AudioVideoRotaryPosEmbed.prepare_video_coords</code> assumes a contiguous <code>torch.arange(num_frames)</code>,
which is fine for bidirectional inference. The sliding-window AR refiner instead needs to keep each frame’s
absolute index in the source video, so RoPE captures the correct temporal phase across the <code>[sink + recent + active]</code> window.</p></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>Video-only forward pass over a single AR block.</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>Container holding one [<em>SanaWMRefinerKVLayerCache</em>] per transformer block, plus the shared sink RoPE.</p> <p>This implements the <code>rf_shifted_sink</code> KV-cache contract the SANA-WM stage-2 refiner was trained with. Refinement
is chunk-causal: <em>block_size</em> latent frames are denoised at a time while attending to a bounded window of <em>[attention sink + recent history + active block]</em> K/V.</p> <ul><li><code>sink_pe</code>: the <em>(cos, sin)</em> RoPE tuple for the sink frames, rebuilt per AR window at the sliding <code>sink_rope_offset</code> so the sink sits immediately before the bounded working cache. Shared across layers because
RoPE does not depend on the layer.</li></ul></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>Per-layer KV cache for the SANA-WM stage-2 chunk-causal AR refiner.</p> <p>Holds the two halves of the sliding-window prefix that the refiner’s self-attention attends to, plus a slot for
reading back the K/V that the last forward captured. All tensors are <em>(batch_size, num_tokens, inner_dim)</em> (i.e.
before the per-head unflatten), matching the layout the refiner’s self-attention concatenates in.</p> <ul><li><code>sink_k_pre</code> / <code>sink_v</code>: <strong>pre</strong>-RoPE K/V of the attention-sink frames, captured once from the raw stage-1
latents. They are stored pre-RoPE so each AR window can re-apply RoPE at its own shifted sink offset
(<code>SanaWMRefinerKVCache.sink_pe</code>).</li> <li><code>history_k</code> / <code>history_v</code>: <strong>post</strong>-RoPE K/V of the already refined recent frames, ready to be concatenated
as-is.</li> <li><code>captured_k_pre</code> / <code>captured_v_pre</code> and <code>captured_k_post</code> / <code>captured_v_post</code>: readback slots written by
the capture <code>kv_cache_mode</code>s.</li></ul> <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>Pop the post-RoPE K/V captured by the last forward.</p></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>Pop the pre-RoPE K/V captured by the last forward.</p></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>Return the post-RoPE recent-history K/V, or <code>None</code> if empty.</p></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>Return the pre-RoPE sink K/V, or <code>None</code> if it has not been captured (or is empty).</p></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>Store the post-RoPE K/V produced by the current forward.</p></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>Store the pre-RoPE K/V produced by the current forward.</p></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>Store the post-RoPE recent-history K/V.</p></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>Store the pre-RoPE sink K/V.</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_15078/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.</p></div> <!> <p></p>`,1);function fe(E,J){re(J,!1),oe(()=>{new URLSearchParams(window.location.search).get("fw")}),B();var g=ie();Y("1ns90vk",D=>{var V=te();ee(V,"content",se),X(D,V)});var v=e(ae(g),2);H(v,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var T=e(v,2);s(T,{title:"SanaWMLTX2RefinerTransformer3DModel",local:"sanawmltx2refinertransformer3dmodel",headingTag:"h1"});var y=e(T,10);Q(y,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU2FuYVdNTFRYMlJlZmluZXJUcmFuc2Zvcm1lcjNETW9kZWwlMEElMEF0cmFuc2Zvcm1lciUyMCUzRCUyMFNhbmFXTUxUWDJSZWZpbmVyVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJFZmZpY2llbnQtTGFyZ2UtTW9kZWwlMkZTQU5BLVdNX2JpZGlyZWN0aW9uYWwtZGlmZnVzZXJzJTIyJTJDJTBBJTIwJTIwJTIwJTIwc3ViZm9sZGVyJTNEJTIycmVmaW5lciUyRnRyYW5zZm9ybWVyJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> SanaWMLTX2RefinerTransformer3DModel
transformer = SanaWMLTX2RefinerTransformer3DModel.from_pretrained(
<span class="hljs-string">&quot;Efficient-Large-Model/SANA-WM_bidirectional-diffusers&quot;</span>,
subfolder=<span class="hljs-string">&quot;refiner/transformer&quot;</span>,
torch_dtype=torch.bfloat16,
)`,lang:"python",wrap:!1});var M=e(y,2);s(M,{title:"SanaWMLTX2RefinerTransformer3DModel",local:"diffusers.SanaWMLTX2RefinerTransformer3DModel",headingTag:"h2"});var t=e(M,2),w=o(t);r(w,{name:"class diffusers.SanaWMLTX2RefinerTransformer3DModel",anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L1122",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"},{name:"ff_bias",val:": bool = True"},{name:"audio_ff_bias",val:": bool = True"},{name:"use_prompt_adaln_single",val:": bool = True"},{name:"use_keyframes_abs_pos_embedding",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.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.SanaWMLTX2RefinerTransformer3DModel.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.SanaWMLTX2RefinerTransformer3DModel.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.SanaWMLTX2RefinerTransformer3DModel.patch_size_t",description:`<strong>patch_size_t</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
The size of the temporal patches to use in the patch embedding layer.`,name:"patch_size_t"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.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.SanaWMLTX2RefinerTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.cross_attention_dim",description:`<strong>cross_attention_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
The number of channels for cross attention heads.`,name:"cross_attention_dim"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>48</code>) &#x2014;
The number of layers of Transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.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.SanaWMLTX2RefinerTransformer3DModel.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"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.rope_type",description:`<strong>rope_type</strong> (<code>str</code>, defaults to <code>&quot;interleaved&quot;</code>) &#x2014;
Which RoPE application to use (<code>&quot;interleaved&quot;</code> or <code>&quot;split&quot;</code>).`,name:"rope_type"}]});var i=e(w,10),P=o(i);r(P,{name:"build_rotary_emb_for_absolute_positions",anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L1388",parameters:[{name:"batch_size",val:": int"},{name:"frame_positions",val:": list"},{name:"height",val:": int"},{name:"width",val:": int"},{name:"device",val:": device"},{name:"fps",val:": float"}],parametersDescription:[{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions.batch_size",description:`<strong>batch_size</strong> (<code>int</code>) &#x2014;
Batch size to broadcast the coordinates to.`,name:"batch_size"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions.frame_positions",description:`<strong>frame_positions</strong> (<code>list[int]</code>) &#x2014;
Absolute latent-frame indices covered by this window.`,name:"frame_positions"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions.height",description:`<strong>height</strong> (<code>int</code>), width (<code>int</code>) &#x2014;
Latent spatial resolution.`,name:"height"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions.device",description:`<strong>device</strong> (<code>torch.device</code>) &#x2014;
Device to build the coordinates on.`,name:"device"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions.fps",description:`<strong>fps</strong> (<code>float</code>) &#x2014;
Video frame rate, which drives LTX-2&#x2019;s temporal RoPE scaling.`,name:"fps"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>the <code>(cos, sin)</code> RoPE tuple.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>tuple[torch.Tensor, torch.Tensor]</code></p>
`}),n(4),a(i);var R=e(i,2),z=o(R);r(z,{name:"forward",anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L1445",parameters:[{name:"hidden_states",val:": Tensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"timestep",val:": Tensor"},{name:"video_rotary_emb",val:": tuple"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"kv_cache",val:": diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVCache | None = None"},{name:"kv_cache_mode",val:": str | None = None"},{name:"attention_kwargs",val:": dict | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
Patchified video latents of the active block, of shape <code>(batch_size, num_video_tokens, in_channels)</code>.`,name:"hidden_states"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
Text embeddings of shape <code>(batch_size, text_seq_len, caption_channels)</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.Tensor</code>) &#x2014;
Timestep of shape <code>(batch_size, num_video_tokens)</code>, already scaled by
<code>self.config.timestep_scale_multiplier</code>.`,name:"timestep"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.video_rotary_emb",description:`<strong>video_rotary_emb</strong> (<code>tuple[torch.Tensor, torch.Tensor]</code>) &#x2014;
The <code>(cos, sin)</code> RoPE for the active block&#x2019;s absolute frame positions, as returned by
<a href="/docs/diffusers/pr_15078/en/api/models/sana_wm_refiner_transformer3d#diffusers.SanaWMLTX2RefinerTransformer3DModel.build_rotary_emb_for_absolute_positions">build_rotary_emb_for_absolute_positions()</a>.`,name:"video_rotary_emb"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Multiplicative text attention mask of shape <code>(batch_size, text_seq_len)</code>.`,name:"encoder_attention_mask"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.kv_cache",description:`<strong>kv_cache</strong> (<code>SanaWMRefinerKVCache</code>, <em>optional</em>) &#x2014;
Sliding-window KV cache holding the per-layer attention sink and recent refined history, plus the
shared <code>sink_pe</code> RoPE. Required whenever <code>kv_cache_mode</code> is set.`,name:"kv_cache"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.kv_cache_mode",description:`<strong>kv_cache_mode</strong> (<code>str</code>, <em>optional</em>) &#x2014;
One of:</p>
<ul>
<li><code>&quot;inject&quot;</code>: attend to <code>[sink + history + current]</code> K/V (the denoising steps).</li>
<li><code>&quot;capture_pre_rope&quot;</code>: no prefix; record the pre-RoPE K/V of this forward into the cache (used once to
seed the attention sink from the raw stage-1 latents).</li>
<li><code>&quot;inject_and_capture_post_rope&quot;</code>: attend to <code>[sink + history + current]</code> K/V and record this block&#x2019;s
post-RoPE K/V into the cache so it can be appended to the history.</li>
</ul>
<p>When <code>None</code>, the block runs plain full self-attention over the current tokens only.`,name:"kv_cache_mode"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Optional kwargs forwarded to the LoRA scale handling.`,name:"attention_kwargs"},{anchor:"diffusers.SanaWMLTX2RefinerTransformer3DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return a <a href="/docs/diffusers/pr_15078/en/api/models/sana_transformer2d#diffusers.models.modeling_outputs.Transformer2DModelOutput">Transformer2DModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>the predicted velocity for the active
block, of shape <code>(batch_size, num_video_tokens, out_channels)</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_15078/en/api/models/sana_transformer2d#diffusers.models.modeling_outputs.Transformer2DModelOutput"
>Transformer2DModelOutput</a> or <code>tuple</code></p>
`}),n(2),a(R),a(t);var k=e(t,2);s(k,{title:"SanaWMRefinerKVCache",local:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVCache",headingTag:"h2"});var d=e(k,2),C=o(d);r(C,{name:"class diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVCache",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVCache",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L757",parameters:[{name:"num_layers",val:": int"}],parametersDescription:[{anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVCache.num_layers",description:`<strong>num_layers</strong> (<em>int</em>) &#x2014;
Number of transformer blocks to allocate a per-layer cache for.`,name:"num_layers"}]}),n(6),a(d);var W=e(d,2);s(W,{title:"SanaWMRefinerKVLayerCache",local:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache",headingTag:"h2"});var c=e(W,2),L=o(c);r(L,{name:"class diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L668",parameters:[]});var l=e(L,8),Z=o(l);r(Z,{name:"get_captured_post_rope",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.get_captured_post_rope",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L736",parameters:[]}),n(2),a(l);var f=e(l,2),q=o(f);r(q,{name:"get_captured_pre_rope",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.get_captured_pre_rope",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L722",parameters:[]}),n(2),a(f);var m=e(f,2),A=o(m);r(A,{name:"get_history",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.get_history",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L711",parameters:[]}),n(2),a(m);var _=e(m,2),N=o(_);r(N,{name:"get_sink",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.get_sink",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L700",parameters:[]}),n(2),a(_);var p=e(_,2),I=o(p);r(I,{name:"store_captured_post_rope",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.store_captured_post_rope",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L731",parameters:[{name:"key",val:": Tensor"},{name:"value",val:": Tensor"}]}),n(2),a(p);var u=e(p,2),F=o(u);r(F,{name:"store_captured_pre_rope",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.store_captured_pre_rope",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L717",parameters:[{name:"key",val:": Tensor"},{name:"value",val:": Tensor"}]}),n(2),a(u);var h=e(u,2),O=o(h);r(O,{name:"store_history",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.store_history",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L706",parameters:[{name:"history_k",val:": Tensor"},{name:"history_v",val:": Tensor"}]}),n(2),a(h);var S=e(h,2),j=o(S);r(j,{name:"store_sink",anchor:"diffusers.models.transformers.transformer_sana_wm_refiner.SanaWMRefinerKVLayerCache.store_sink",source:"https://github.com/huggingface/diffusers/blob/vr_15078/src/diffusers/models/transformers/transformer_sana_wm_refiner.py#L695",parameters:[{name:"sink_k_pre",val:": Tensor"},{name:"sink_v",val:": Tensor"}]}),n(2),a(S),a(c);var x=e(c,2);s(x,{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"});var b=e(x,2),U=o(b);r(U,{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",source:"https://github.com/huggingface/diffusers/blob/vr_15078/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_15078/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"}]}),n(2),a(b);var G=e(b,2);$(G,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/sana_wm_refiner_transformer3d.md"}),n(2),X(E,g),ne()}export{fe as component};

Xet Storage Details

Size:
27.5 kB
·
Xet hash:
c48076f742a7eb2c9109c5ec156af67d1103cf14303e05d83f10840b66ba3f1d

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