Skip to content

vllm_omni.diffusion.models.ltx2.ltx2_guidance

Official multi-modal guidance for the LTX model family.

LTX_GUIDANCE_EXECUTOR module-attribute

LTX_GUIDANCE_EXECUTOR = LTXGuidanceExecutor()

combine_velocity_via_x0 module-attribute

combine_velocity_via_x0 = (
    LTXGuidanceExecutor.combine_cfg_velocity
)

logger module-attribute

logger = init_logger(__name__)

LTXDenoisePass dataclass

One conditioned Transformer evaluation in a guidance batch.

name instance-attribute

name: str

negative_audio_context class-attribute instance-attribute

negative_audio_context: bool = False

negative_video_context class-attribute instance-attribute

negative_video_context: bool = False

LTXGuidanceExecutor

Build and execute official LTX multi-guidance Transformer passes.

combine_cfg_velocity staticmethod

combine_cfg_velocity(
    sample: Tensor,
    positive_velocity: Tensor,
    negative_velocity: Tensor,
    sigma: Tensor,
    guidance_scale: float,
    *,
    model_sigma: Tensor | None = None,
) -> Tensor

predict_noise

predict_noise(
    pipeline: Any,
    plan: LTXGuidancePlan,
    index: int,
    timestep: Tensor,
    state: LTXAVState,
    forward_ctx: LTXForwardContext,
    denoise_ctx: LTXDenoiseContext,
    preserve_positive_velocity: bool = False,
) -> tuple[Tensor, Tensor]

predict_parallel_guidance

predict_parallel_guidance(
    pipeline: Any,
    plan: LTXGuidancePlan,
    index: int,
    timestep: Tensor,
    state: LTXAVState,
    forward_ctx: LTXForwardContext,
    denoise_ctx: LTXDenoiseContext,
    preserve_positive_velocity: bool = False,
) -> tuple[Tensor, Tensor]

prepare_denoise_context staticmethod

prepare_denoise_context(
    plan: LTXGuidancePlan,
    guidance_parallel_ready: bool,
    guidance_world_size: int,
    denoise_ctx: LTXDenoiseContext,
) -> LTXDenoiseContext

timestep_kwargs staticmethod

timestep_kwargs(
    ts: Tensor,
    video_token_count: int,
    audio_token_count: int,
    *,
    expand_for_sequence_parallel: bool = False,
) -> dict[str, Tensor]

validate_guidance_world_size staticmethod

validate_guidance_world_size(
    plan: LTXGuidancePlan, guidance_world_size: int
) -> None

warn_if_imbalanced classmethod

warn_if_imbalanced(
    plan: LTXGuidancePlan,
    guidance_world_size: int,
    phase_name: str,
) -> None

LTXGuidancePlan dataclass

Concrete Transformer passes derived from a guidance specification.

names property

names: tuple[str, ...]

passes instance-attribute

passes: tuple[LTXDenoisePass, ...]

spec instance-attribute

build classmethod

LTXGuidanceSpec dataclass

Video and audio guidance requested for one denoise phase.

audio class-attribute instance-attribute

do_cfg property

do_cfg: bool

do_modality_guidance property

do_modality_guidance: bool

do_rescale property

do_rescale: bool

do_stg property

do_stg: bool

video class-attribute instance-attribute

positive_only classmethod

positive_only() -> LTXGuidanceSpec

LTXModalityGuidance dataclass

Guidance parameters applied to one LTX output modality.

cfg_scale class-attribute instance-attribute

cfg_scale: float = 1.0

do_cfg property

do_cfg: bool

do_modality_guidance property

do_modality_guidance: bool

do_stg property

do_stg: bool

modality_scale class-attribute instance-attribute

modality_scale: float = 1.0

rescale_scale class-attribute instance-attribute

rescale_scale: float = 0.0

stg_blocks class-attribute instance-attribute

stg_blocks: tuple[int, ...] = ()

stg_scale class-attribute instance-attribute

stg_scale: float = 0.0

build_perturbation_kwargs

build_perturbation_kwargs(
    plan: LTXGuidancePlan,
    batch_size: int,
    reference: Tensor,
) -> dict[str, Any]

combine_guided_x0

combine_guided_x0(
    *,
    cond: Tensor,
    uncond_text: Tensor | float,
    uncond_perturbed: Tensor | float,
    uncond_modality: Tensor | float,
    guidance: LTXModalityGuidance,
    rescale_token_count: int | None = None,
) -> Tensor

euler_step_from_velocity

euler_step_from_velocity(
    sample: Tensor,
    velocity: Tensor,
    sigmas: Tensor,
    step_index: int,
) -> Tensor

velocity_from_x0

velocity_from_x0(
    sample: Tensor, x0: Tensor, sigma: Tensor
) -> Tensor

Convert x0 back to velocity using the official fp32 arithmetic order.

x0_from_velocity

x0_from_velocity(
    sample: Tensor, velocity: Tensor, sigma: Tensor
) -> Tensor

Convert velocity to x0 using the official fp32 arithmetic order.