Skip to content
FastVideo
Esc
↑↓navigate↵open⌘Jpreview
On this page

ltx2

LTX-2 model plugin package.

fastvideo.train.models.ltx2.LTX2Model

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[str, Any] | None = None, attention_backend: AttentionBackendEnum | str | None = None, train_audio: bool = False, timestep_uniform_prob: float = 0.1)

LTX-2 per-role model for the modular trainer.

fastvideo.train.models.ltx2.LTX2Model.ensure_negative_conditioning

ensure_negative_conditioning() -> None

Cache the unconditional conditioning used by CFG dropout.

LTX-2 inference builds its CFG unconditional branch from the checkpoint preset's negative_prompt 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. LTX2GemmaTextEncoderModel owns the connector, which means the shared encode_negative_prompt helper already produces the post-connector tensor.

fastvideo.train.models.ltx2.LTX2Model.decode_latents

decode_latents(latents_b_t_c_h_w: torch.Tensor) -> torch.Tensor

fastvideo.train.models.ltx2.LTX2Model.prepare_batch

prepare_batch(raw_batch: dict[str, Any], *, generator: torch.Generator, latents_source: Literal['data', 'zeros'] = 'data') -> TrainingBatch

fastvideo.train.models.ltx2.LTX2Model.predict_noise

predict_noise(noisy_latents: torch.Tensor, timestep: torch.Tensor, batch: TrainingBatch, *, conditional: bool, cfg_uncond: dict[str, Any] | None = None, attn_kind: Literal['dense', 'vsa'] = 'dense', clean_x: torch.Tensor | None = None, aug_t: torch.Tensor | None = None) -> torch.Tensor

fastvideo.train.models.ltx2.LTX2Model.backward

backward(loss: torch.Tensor, ctx: Any, *, grad_accum_rounds: int) -> None

Submodules

Was this page helpful?