---
title: ltx2
---

<div class="python-reference">
<a id="fastvideo.train.models.ltx2-classes"></a>
<a id="fastvideo.train.models.ltx2"></a>
<p>LTX-2 model plugin package.</p>
<h2 id="fastvideo.train.models.ltx2.LTX2Model"><code>fastvideo.train.models.ltx2.LTX2Model</code></h2>
<pre class="doc-signature"><code>LTX2Model(*, init_from: str, training_config: TrainingConfig, trainable: bool = True, disable_custom_init_weights: bool = False, enable_gradient_checkpointing_type: str | None = None, transformer_override_safetensor: str | None = None, lora: LoraConfig | dict&#91;str, Any&#93; | None = None, attention_backend: AttentionBackendEnum | str | None = None, train_audio: bool = False, timestep_uniform_prob: float = 0.1)</code></pre>
<p>LTX-2 per-role model for the modular trainer.</p>

<h3 id="fastvideo.train.models.ltx2.LTX2Model.ensure_negative_conditioning"><code>fastvideo.train.models.ltx2.LTX2Model.ensure_negative_conditioning</code></h3>
<pre class="doc-signature"><code>ensure_negative_conditioning() -&gt; None</code></pre>
<p>Cache the unconditional conditioning used by CFG dropout.</p>
<p>LTX-2 inference builds its CFG unconditional branch from the
checkpoint preset's <code>negative_prompt</code> encoded through Gemma +
the Embeddings1D connector — empty for the distilled presets, the
preset's quality-negative prompt for the base presets that run
CFG — so the dropped samples have to carry that embedding rather
than zeros. <code>LTX2GemmaTextEncoderModel</code> owns the connector,
which means the shared <code>encode_negative_prompt</code> helper already
produces the post-connector tensor.</p>
<h3 id="fastvideo.train.models.ltx2.LTX2Model.decode_latents"><code>fastvideo.train.models.ltx2.LTX2Model.decode_latents</code></h3>
<pre class="doc-signature"><code>decode_latents(latents_b_t_c_h_w: torch.Tensor) -&gt; torch.Tensor</code></pre>

<h3 id="fastvideo.train.models.ltx2.LTX2Model.prepare_batch"><code>fastvideo.train.models.ltx2.LTX2Model.prepare_batch</code></h3>
<pre class="doc-signature"><code>prepare_batch(raw_batch: dict&#91;str, Any&#93;, *, generator: torch.Generator, latents_source: Literal&#91;&#x27;data&#x27;, &#x27;zeros&#x27;&#93; = &#x27;data&#x27;) -&gt; TrainingBatch</code></pre>

<h3 id="fastvideo.train.models.ltx2.LTX2Model.predict_noise"><code>fastvideo.train.models.ltx2.LTX2Model.predict_noise</code></h3>
<pre class="doc-signature"><code>predict_noise(noisy_latents: torch.Tensor, timestep: torch.Tensor, batch: TrainingBatch, *, conditional: bool, cfg_uncond: dict&#91;str, Any&#93; | None = None, attn_kind: Literal&#91;&#x27;dense&#x27;, &#x27;vsa&#x27;&#93; = &#x27;dense&#x27;, clean_x: torch.Tensor | None = None, aug_t: torch.Tensor | None = None) -&gt; torch.Tensor</code></pre>

<h3 id="fastvideo.train.models.ltx2.LTX2Model.backward"><code>fastvideo.train.models.ltx2.LTX2Model.backward</code></h3>
<pre class="doc-signature"><code>backward(loss: torch.Tensor, ctx: Any, *, grad_accum_rounds: int) -&gt; None</code></pre>

</div>

<h2>Submodules</h2>
<ul>
<li><a href="/FastVideo/api/fastvideo/train/models/ltx2/ltx2">ltx2</a></li>
</ul>
