Conversation
This was referenced Sep 15, 2026
Non-editable installs (pip/uv from git or a wheel) did not include mlx_video/models/ltx_2/prompts/*.txt, so --enhance-prompt failed with FileNotFoundError for both the Gemma 3 and Gemma 4 system prompts.
kiarina
added a commit
to kiarina/kiapi
that referenced
this pull request
Sep 15, 2026
Add ltx-2.5-distilled beside the LTX-2 distilled model and make it the default. LTX-2.5 adds auto_duration, enhance_prompt, the DFR pipeline, and the diffusion video decoder. mlx-video is pinned to the kiarina fork branch kiapi/ltx-2.5 (Blaizzy/mlx-video#52 head) until the PR is merged. HfSnapshotResource gains allow_patterns so LTX-2.5 downloads only the seven checkpoint files it loads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add LTX-2.5 distilled generation on Apple Silicon while preserving the existing
mlx_video.models.ltx_2design and LTX-2/LTX-2.3 compatibility.Review guide by commit
a956b3a— split checkpoints, Gemma 4, 22B transformer, convolutional VAE, T2V, and I2Vb73e6a8— selective component download, documentation, and model-path tests73d919b— extracted ancestral Euler implementation and sampler tests3ca6fef— audio generation, A2V, A2V+I2V, audio VAE/vocoder, and mux fixc8000e1— DurationHead, automatic frame-count prediction, and CLI controls7d8b2f0— T2V/I2V prompt enhancement with a separate generative Gemma 4 modelfae541a— prompt-driven multishot example and limitations5f008b8— initial DFR pipeline with generated keyframes, reference conditioning, and detailing IC-LoRA1e071c7— expose the LTX generator alias used throughout the READMEdc33a96— score-free 3D neighborhood-attention Metal kernel and eager referenceaa18e5a— SIMD-group specialization for the model's head dimension of 64ef28627— absolute RoPE, NA blocks, SwiGLU, and causal pixel shufflee634684— five-stage DiffVAE decoder, strict checkpoint loader, and CLI integration4775630— receptive-field-halo spatial tiling5001b17— DFR keyframe dual-stream joint attentionf9a458a— keyframe-aware spatial tilingd29c248— plain and keyframe-aware temporal tilingSupported scope
Implementation
mlx-vlm>=0.7.1.8k+1frame grid.--auto-duration MIN_SECONDS MAX_SECONDS.--prompt-enhancer-repoand use the official LTX-2.5 T2V/I2V system prompts.Multishot does not require a separate inference path. The README now includes a regular T2V example that describes shots in order, repeats subject and wardrobe details, and allocates enough frames for the sequence. Shot lengths and cut positions are model-controlled, and an explicit hard cut may be rendered as a smooth transition.
DFR adds generated keyframe slots on the official 24/32-frame segment grid and jointly denoises the video, audio, and slots during stage 1. It spatially upscales the video and generated keyframes, then runs stage 2 with the half-resolution video appended as clean reference tokens. The loader reads the reference downscale factor from the official detailing adapter metadata and merges its 480 LoRA pairs at a default strength of 0.5.
The CLI exposes
--pipeline dfr,--detailing-lora, and--detailing-lora-strength. When the internal DFR canvas is padded to a segment boundary, the decoded video and generated audio are trimmed back to the requested duration.The documented
mlx_video.generatecommand is now exposed as a project-script alias while preserving the existingmlx_video.ltx_2.generateentry point.The diffusion video decoder implements the official five-stage 2048/1024/512/512/256-channel architecture. Its final stage runs eight 11x11x11 neighborhood-attention blocks. The fused Metal kernel uses BF16 inputs, float32 accumulation, and online softmax without materializing an attention-score tensor; a 32-lane SIMD-group path specializes the model's head dimension of 64.
The loader splits fused checkpoint QKV tensors into independent projections and strict-loads the 396-tensor checkpoint. Select it with
--video-decoder diffusion; the convolutional decoder remains the default lower-memory path.With DFR, generated keyframe latents pass through all five decoder stages. Each video query attends to its local 3D window and the spatial windows of its two nearest keyframe planes. Each keyframe query attends to its own plane and two nearest video frames in the same online softmax.
--diffusion-vae-spatial-tilesand--diffusion-vae-temporal-tilessplit stage 4/5 with receptive-field halos. Spatial tiling uses a 24-cell stage-4-input halo. Temporal tiling uses a 22-cell halo and preserves the causal leading-frame phase.Mux fix
The existing FFmpeg
-shortestpath could truncate video frames when audio was slightly shorter than the video. In the reproduced case, a 25-frame video became 21 frames.The audio stream is now padded with
apad, preserving every video frame while still ending the mux at the video duration.Not yet supported
Verification
Measured on a Mac Studio M4 Max with 128 GB unified memory at 768x512, 121 frames, and 24 fps:
num_framesproduced a 113-frame MP4 in 29.0 seconds at a 37.03 GB peak.num_frameswith legacy LTX-2 still produces the existing 33-frame default.DiffVAE measurements on the same Mac Studio M4 Max with 128 GB unified memory at 768x512 / 121 frames / 24 fps:
test_ltx25_*tests pass.The repository-wide test suite currently stops during collection because the existing
tests/test_generate_dev.pyimports the removedmlx_video.generate_devmodule. This PR does not change that unrelated test.Model and license
Weights are not redistributed. The loader downloads the required components from
Lightricks/LTX-2.5; users must accept the LTX-2.x Community License on Hugging Face first.The DFR detailing adapter is downloaded separately from the gated
Lightricks/LTX-2.5-22b-IC-LoRA-Pixel-Spatial-Upscalerrepository and is not redistributed.The diffusion decoder checkpoint is downloaded from the gated LTX-2.5 repository only when
--video-decoder diffusionis selected and is not redistributed.Prompt enhancement separately uses
mlx-community/gemma-4-e2b-it-bf16. The LTX-2.5 Gemma 4 Unified text-encoder checkpoint is encode-only, so this follows the official implementation by keeping the generative instruct checkpoint separate.