Official Python inference and LoRA trainer package for the LTX-2 audio–video generative model.
Automated PR - 2026-10-02
github-actions[bot]9ec55f9f2279
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9087fd3..2c2c98d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,11 @@# Changelog+## 1.4.2 - 2026-10-01++### Added++- `ltx_pipelines.alpha_gen`, a one-stage IC-LoRA pipeline on the full model with video CFG 1 and STG off.+## 1.4.1 - 2026-09-30### Changeddiff --git a/packages/ltx-core/pyproject.toml b/packages/ltx-core/pyproject.tomlindex 0b6d888..f2c3756 100644--- a/packages/ltx-core/pyproject.toml+++ b/packages/ltx-core/pyproject.toml@@ -1,6 +1,6 @@[project]name = "ltx-core"-version = "1.4.1"+version = "1.4.2"description = "Core implementation of Lightricks' LTX-2 model"readme = "README.md"requires-python = ">=3.10"diff --git a/packages/ltx-kernels/pyproject.toml b/packages/ltx-kernels/pyproject.tomlindex f6f75e9..0f15d73 100644--- a/packages/ltx-kernels/pyproject.toml+++ b/packages/ltx-kernels/pyproject.toml@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"[project]name = "ltx-kernels"-version = "1.4.1"+version = "1.4.2"dependencies = ["torch","triton>=3.0",diff --git a/packages/ltx-pipelines/CLAUDE.md b/packages/ltx-pipelines/CLAUDE.mdindex 986f63c..18f70d5 100644--- a/packages/ltx-pipelines/CLAUDE.md+++ b/packages/ltx-pipelines/CLAUDE.md@@ -38,6 +38,7 @@ CLI: on `python -m ltx_pipelines.distilled`, `python -m ltx_pipelines.ti2vid_two| `DubItPipeline` | `dubit.py` | 2 | Distilled only | Euler | Dub-It with IC-LoRA + audio ref conditioning || `RetakePipeline` | `retake.py` | 1 | Full or distilled | Euler | Video region regeneration || `HDRICLoraPipeline` | `hdr_ic_lora.py` | 1 | Distilled + HDR IC-LoRA | Euler | ACEScct SDR-to-HDR; DFR seam keyframes on by default |+| `AlphaGenPipeline` | `alpha_gen.py` | 1 | Full + IC-LoRA | Euler | Guided one-stage IC-LoRA (video CFG 1, STG off) |## Guidancediff --git a/packages/ltx-pipelines/pyproject.toml b/packages/ltx-pipelines/pyproject.tomlindex 6e80567..767bd72 100644--- a/packages/ltx-pipelines/pyproject.toml+++ b/packages/ltx-pipelines/pyproject.toml@@ -1,6 +1,6 @@[project]name = "ltx-pipelines"-version = "1.4.1"+version = "1.4.2"description = "Pipelines implementation for Lightricks' LTX-2 model"readme = "README.md"requires-python = ">=3.10"diff --git a/packages/ltx-pipelines/src/ltx_pipelines/alpha_gen.py b/packages/ltx-pipelines/src/ltx_pipelines/alpha_gen.pynew file mode 100644index 0000000..dc3e0c5--- /dev/null+++ b/packages/ltx-pipelines/src/ltx_pipelines/alpha_gen.py@@ -0,0 +1,309 @@+"""Alpha-gen: one-stage IC-LoRA generation on the full model with multimodal guidance.+The diffusion pass matches ``TI2VidOneStagePipeline``: one Euler schedule, a+positive and negative prompt, and a ``FactoryGuidedDenoiser``. The extra input+is an IC-LoRA reference video, appended as ``VideoConditionByReferenceLatent``.+"""++import logging+from dataclasses import replace++import torch++from ltx_core.components.guiders import MultiModalGuiderParams, create_multimodal_guider_factory+from ltx_core.components.noisers import GaussianNoiser+from ltx_core.components.schedulers import LTX2Scheduler+from ltx_core.conditioning import ConditioningItem+from ltx_core.loader import LoraPathStrengthAndSDOps+from ltx_core.loader.registry import Registry+from ltx_core.model.video_vae import AUTO_TILING, AutoTiling, TilingConfig, VideoEncoder, get_video_chunks_number+from ltx_core.model.video_vae.transformer import DiffVAEMode+from ltx_core.quantization import QuantizationPolicy+from ltx_core.types import VideoPixelShape+from ltx_pipelines.iclora_utils import (+ append_ic_lora_reference_video_conditionings,+ read_lora_reference_downscale_factor,+ read_lora_reference_temporal_scale_factor,+)+from ltx_pipelines.utils.args import VideoConditioningAction, default_1_stage_arg_parser, resolve_cli_params+from ltx_pipelines.utils.blocks import (+ DiffusionStage,+ DurationPredictor,+ ImageConditioner,+ PromptEncoder,+ VideoDecoder,+ require_num_frames_source,+ resolve_num_frames,+)+from ltx_pipelines.utils.denoisers import FactoryGuidedDenoiser+from ltx_pipelines.utils.helpers import (+ assert_resolution,+ combined_image_conditionings,+ create_initial_video_latent,+ ensure_tiling_config,+ get_device,+ tiling_scale_factors_for_vae,+)+from ltx_pipelines.utils.media_io import EXRColorSpace, encode_video, resolve_hdr_color_space, vae_dtype_for_hdr+from ltx_pipelines.utils.model_paths import ModelPaths+from ltx_pipelines.utils.types import (+ DEFAULT_AUTO_DURATION,+ AutoDuration,+ ImageConditioningInput,+ ModalitySpec,+ OffloadMode,+ PipelineOutput,+ VideoAudio,+)++logger = logging.getLogger(__name__)++NEGATIVE_PROMPT = "worst quality, inconsistent motion, blurry, jittery, distorted"+++def alpha_gen_guider_params(base: MultiModalGuiderParams, *, cfg_scale: float) -> MultiModalGuiderParams:+ """Alpha-gen guidance: ``cfg_scale``, STG off, rescale 0.7, no cross-modal guidance."""+ return replace(base, cfg_scale=cfg_scale, stg_scale=0.0, rescale_scale=0.7, modality_scale=1.0)+++class AlphaGenPipeline:+ """Single-stage IC-LoRA pipeline on a full checkpoint."""++ def __init__(+ self,+ model_paths: ModelPaths,+ loras: list[LoraPathStrengthAndSDOps],+ device: torch.device | None = None,+ quantization: QuantizationPolicy | None = None,+ registry: Registry | None = None,+ offload_mode: OffloadMode = OffloadMode.NONE,+ diffvae_optimization: DiffVAEMode = DiffVAEMode.CHUNKED_EAGER,+ ) -> None:+ self.dtype = torch.bfloat16+ self.device = device or get_device()+ self.prompt_encoder = PromptEncoder(+ model_paths, dtype=self.dtype, device=self.device, registry=registry, offload_mode=offload_mode+ )+ self.image_conditioner = ImageConditioner(+ model_paths.video_vae(), dtype=self.dtype, device=self.device, registry=registry+ )+ self.stage = DiffusionStage.from_checkpoint(+ model_paths.transformer(),+ dtype=self.dtype,+ device=self.device,+ loras=tuple(loras),+ quantization=quantization,+ registry=registry,+ offload_mode=offload_mode,+ )+ self.video_decoder = VideoDecoder(+ model_paths.video_vae(),+ dtype=self.dtype,+ device=self.device,+ registry=registry,+ diffvae_optimization=diffvae_optimization,+ )+ self.duration_predictor = DurationPredictor.from_checkpoint(+ checkpoint_path=model_paths.duration_head_path, dtype=self.dtype, device=self.device+ )+ self.reference_downscale_factor, self.reference_temporal_scale_factor = _reference_scale_factors(loras)++ def __call__( # noqa: PLR0913+ self,+ prompt: str,+ negative_prompt: str,+ seed: int,+ height: int,+ width: int,+ frame_rate: float,+ num_inference_steps: int,+ video_guider_params: MultiModalGuiderParams,+ images: list[ImageConditioningInput],+ video_conditioning: list[tuple[str, float]],+ num_frames: int | AutoDuration = DEFAULT_AUTO_DURATION,+ vae_dtype: torch.dtype | None = None,+ color_space: EXRColorSpace | None = None,+ tiling_config: TilingConfig | AutoTiling | None = AUTO_TILING,+ ) -> PipelineOutput:+ """Generate one clip conditioned on ``video_conditioning`` (``(path, strength)`` pairs, at least one)."""+ if not video_conditioning:+ raise ValueError("Alpha-gen requires at least one reference video")+ require_num_frames_source(num_frames, self.duration_predictor)+ images = self.image_conditioner.resolve_crf(images)+ assert_resolution(height=height, width=width, is_two_stage=False)++ generator = torch.Generator(device=self.device).manual_seed(seed)+ ctx_p, ctx_n = self.prompt_encoder([prompt, negative_prompt])+ num_frames = resolve_num_frames(+ num_frames,+ self.duration_predictor,+ video_encoding=ctx_p.video_encoding,+ audio_encoding=None,+ frame_rate=frame_rate,+ )+ tiling_config = ensure_tiling_config(+ tiling_config,+ scale_factors=tiling_scale_factors_for_vae(self.video_decoder.checkpoint_path),+ vae_checkpoint_path=self.video_decoder.checkpoint_path,+ video_shape=VideoPixelShape(batch=1, frames=num_frames, height=height, width=width, fps=frame_rate),+ diffvae_optimization=self.video_decoder.diffvae_optimization,+ device=self.device,+ )+ conditionings = self.image_conditioner(+ lambda enc: self._conditionings(enc, images, video_conditioning, height, width, num_frames, color_space)+ )++ video_latent = create_initial_video_latent(+ width=width,+ height=height,+ frames=num_frames,+ fps=frame_rate,+ device=self.device,+ dtype=self.dtype,+ scale_factors=self.stage.video_scale_factors,+ )+ video_state, _ = self.stage(+ denoiser=FactoryGuidedDenoiser(+ v_context=ctx_p.video_encoding,+ a_context=None,+ video_guider_factory=create_multimodal_guider_factory(+ params=video_guider_params, negative_context=ctx_n.video_encoding+ ),+ ),+ sigmas=LTX2Scheduler().execute(steps=num_inference_steps).to(dtype=torch.float32, device=self.device),+ noiser=GaussianNoiser(generator=generator),+ modalities=VideoAudio(+ video=ModalitySpec(+ latent=video_latent,+ conditioning_fps=frame_rate,+ context=ctx_p.video_encoding,+ conditionings=conditionings,+ ),+ ),+ )++ decoded_video = self.video_decoder(+ video_state.latent, tiling_config, generator=generator, dtype=vae_dtype or self.dtype+ )+ return PipelineOutput(decoded_video, None, num_frames, tiling_config)++ def _conditionings(+ self,+ video_encoder: VideoEncoder,+ images: list[ImageConditioningInput],+ video_conditioning: list[tuple[str, float]],+ height: int,+ width: int,+ num_frames: int,+ color_space: EXRColorSpace | None,+ ) -> list[ConditioningItem]:+ conditionings = combined_image_conditionings(+ images=images,+ height=height,+ width=width,+ video_encoder=video_encoder,+ dtype=self.dtype,+ device=self.device,+ color_space=color_space,+ )+ append_ic_lora_reference_video_conditionings(+ conditionings,+ video_conditioning,+ height=height,+ width=width,+ num_frames=num_frames,+ video_encoder=video_encoder,+ dtype=self.dtype,+ device=self.device,+ reference_downscale_factor=self.reference_downscale_factor,+ reference_temporal_scale_factor=self.reference_temporal_scale_factor,+ conditioning_attention_strength=1.0,+ conditioning_attention_mask=None,+ tiling_config=None,+ color_space=color_space,+ )+ return conditionings+++def _reference_scale_factors(loras: list[LoraPathStrengthAndSDOps]) -> tuple[int, int]:+ """Spatial and temporal reference scales from LoRA metadata.+ A factor of 1 means the LoRA left it unset. Any values other than 1 must match.+ """+ spatial = {read_lora_reference_downscale_factor(lora.path) for lora in loras} - {1}+ temporal = {read_lora_reference_temporal_scale_factor(lora.path) for lora in loras} - {1}+ if len(spatial) > 1:+ raise ValueError(+ f"LoRA reference_downscale_factor values disagree: {sorted(spatial)}. "+ "1 means unset and is ignored; every set value must match."+ )+ if len(temporal) > 1:+ raise ValueError(+ f"LoRA reference_temporal_scale_factor values disagree: {sorted(temporal)}. "+ "1 means unset and is ignored; every set value must match."+ )+ return next(iter(spatial), 1), next(iter(temporal), 1)++[email protected]_mode()+def main() -> None:+ logging.basicConfig(level=logging.INFO)+ detected = resolve_cli_params()+ params = replace(+ detected,+ video_guider_params=alpha_gen_guider_params(detected.video_guider_params, cfg_scale=1.0),+ )+ parser = default_1_stage_arg_parser(params=params, supports_auto_duration=True)+ parser.set_defaults(negative_prompt=NEGATIVE_PROMPT)+ parser.add_argument(+ "--video-conditioning",+ action=VideoConditioningAction,+ nargs=2,+ metavar=("PATH", "STRENGTH"),+ required=True,+ help="IC-LoRA reference video and strength. Example: --video-conditioning guide.mp4 1.0",+ )+ args = parser.parse_args()++ pipeline = AlphaGenPipeline(+ model_paths=args.model_paths,+ loras=tuple(args.lora) if args.lora else (),+ quantization=args.quantization,+ offload_mode=args.offload_mode,+ diffvae_optimization=args.diffvae_optimization,+ )+ hdr = resolve_hdr_color_space(+ images=args.images, video_paths=[path for path, _ in args.video_conditioning], hdr=args.hdr+ )+ result = pipeline(+ prompt=args.prompt,+ negative_prompt=args.negative_prompt,+ seed=args.seed,+ height=args.height,+ width=args.width,+ num_frames=args.num_frames,+ frame_rate=args.frame_rate,+ num_inference_steps=args.num_inference_steps,+ video_guider_params=MultiModalGuiderParams(+ cfg_scale=args.video_cfg_guidance_scale,+ stg_scale=args.video_stg_guidance_scale,+ rescale_scale=args.video_rescale_scale,+ modality_scale=args.a2v_guidance_scale,+ skip_step=args.video_skip_step,+ stg_blocks=args.video_stg_blocks,+ ),+ images=args.images,+ video_conditioning=args.video_conditioning,+ vae_dtype=vae_dtype_for_hdr(hdr, torch.bfloat16),+ color_space=hdr,+ )+ encode_video(+ video=result.video,+ fps=args.frame_rate,+ audio=result.audio,+ output_path=args.output_path,+ video_chunks_number=get_video_chunks_number(result.num_frames, result.tiling_config),+ color_space=hdr,+ )+++if __name__ == "__main__":+ main()diff --git a/packages/ltx-trainer/pyproject.toml b/packages/ltx-trainer/pyproject.tomlindex 6a79f61..41549f4 100644--- a/packages/ltx-trainer/pyproject.toml+++ b/packages/ltx-trainer/pyproject.toml@@ -1,6 +1,6 @@[project]name = "ltx-trainer"-version = "1.4.1"+version = "1.4.2"description = "LTX-2 training, democratized."readme = "README.md"authors = [