# ltx-video - Doramagic AI Context Pack

> Positioning: a pre-install experience and judgment asset. It helps the host AI get off to a good start, but it does not mean the project has already been installed, run, or validated.

## Sufficiency Principle

- **Sufficiency over compression**: The AI Context Pack should be sufficient for the host AI to understand the project's value, capability boundaries, entrypoints, risks, and evidence sources before starting work; it may be layered, but it does not aim for the shortest possible summary.
- **Compression policy**: Compress only noise and duplication, never context that affects judgment or the quality of the work.

## How the Host AI Should Use This

You are reading the AI Context Pack that Doramagic compiled for ltx-video. Treat it as pre-work context: help the user understand who it fits, what it can do, how to start, what must be verified after install, and where the risks are. Do not claim that you have already installed, run, or executed the target project.

## Claim Consumption Rules

- **Fact source**: Repo Evidence + Claim/Evidence Graph; the Human Wiki only supplies salience, terminology, and narrative structure.
- **Minimum status for a fact**: `supported`
- `supported`: May be used as a project fact, but the answer must cite the claim_id and evidence path.
- `weak`: Usable only as a low-confidence lead; the user must be asked to keep verifying.
- `inferred`: Usable only for risk notes or open questions; must not be packaged as a project fact.
- `unverified`: Must not be used as fact; state clearly that evidence is insufficient.
- `contradicted`: Must show the conflicting sources and must not force a single version on the user's behalf.

## Who It Fits Best

- **AI researchers or builders of research-oriented Agents**: The README clearly centers on research, experiment, or paper workflows. Evidence: `README.md` Claim: `clm_0002` supported 0.86

## What It Can Do

- **Command-Line Startup or Install Flow** (Verify after install): The project documentation contains runnable commands; real use requires running them in a local or host environment. Evidence: `README.md` Claim: `clm_0001` supported 0.86

## How to Start

- `git clone https://github.com/Lightricks/LTX-Video.git` Evidence: `README.md` Claim: `clm_0003` supported 0.86

## Continue-or-Stop Decision Card

- **Current recommendation**: Sandbox trial only
- **Why**: The project has signals of install commands, host configuration, or local writes; do not go straight into your primary environment—trial it in isolation first.

### 30-Second Read

- **What to do now**: Sandbox trial only
- **Minimum safe next step**: Run Prompt Preview first; if you still want to install, trial only in an isolated environment
- **Do not trust yet**: Real output quality cannot be trusted before install.
- **Continuing will touch**: Command execution, Local environment or project files, Host AI context

### What You Can Trust Now

- **Target-audience signal: AI researchers or builders of research-oriented Agents** (supported): Backed by a supported claim or project evidence, but that still is not the same as real install results. Evidence: `README.md` Claim: `clm_0002` supported 0.86
- **Capability exists: Command-Line Startup or Install Flow** (supported): You can trust that the project contains signals of this capability; whether it fits your specific task still needs trial or after-install verification. Evidence: `README.md` Claim: `clm_0001` supported 0.86
- **There are Quick Start / install-command signals** (supported): You can trust that the docs mention a startup or install entrypoint; do not run it directly in your primary environment because of that. Evidence: `README.md` Claim: `clm_0003` supported 0.86

### What You Cannot Trust Yet

- **Real output quality cannot be trusted before install.** (unverified): Prompt Preview can only show how it guides you; it cannot prove result quality in the real project.
- **Host AI version compatibility cannot be trusted before install.** (unverified): Host loading rules and version differences across Claude, Cursor, Codex, Gemini, and others must be verified in a real environment.
- **That it will not pollute your existing host AI's behavior cannot be trusted directly.** (inferred): Skill, plugin, and AGENTS/CLAUDE/GEMINI instructions may change the host AI's default behavior.
- **Safe rollback cannot be assumed by default.** (unverified): Unless the project clearly provides uninstall and recovery instructions, verify in an isolated environment first.
- **After a real install, is it compatible with the user's current host AI version?** (unverified): Compatibility can only be verified in the actual host environment.
- **Does the project's output quality meet the user's specific task?** (unverified): The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **Do the install commands require network access, permissions, or global writes?** (unverified): This affects install risk in both enterprise and personal environments. Evidence: `README.md`

### What Continuing Will Touch

- **Command execution**: Package managers, network downloads, the local plugin directory, project config, or the user's home directory. Why: Running the very first command can already change your environment; decide whether it is worth running first. Evidence: `README.md`
- **Local environment or project files**: Install results, plugin caches, project config, or local dependency directories. Why: The write scope and rollback path cannot be proven before install and need isolated verification. Evidence: `README.md`
- **Host AI context**: The AI Context Pack, Prompt Preview, Skill routing, risk rules, and project facts. Why: Importing context affects the host AI's later judgment, so avoid packaging unverified items as facts.

### Minimum Safe Next Steps

- **Run Prompt Preview first**: Use a pre-install interactive trial to judge whether the way of working fits; it needs no authorization or environment change. (applies when: Applies to any project, especially when output quality is unknown.)
- **Trial-install only in an isolated directory or a test account**: Avoid letting install commands pollute your primary host AI, real projects, or home directory. (applies when: When there are signals of command execution, plugin config, or local writes.)
- **After install, verify just one minimal task**: Verify loading, compatibility, output quality, and rollback first, then decide whether to use it deeply. (applies when: When moving from a trial into a real workflow.)

### Exit Plan

- **Preserve the pre-install state**: Record the original host config and project state so you can later judge whether it is recoverable.
- **Record the install commands and written paths**: Without clear uninstall instructions, you at least need to know which directories or configs to clean up manually.
- **If there is no rollback path, do not enter your primary environment**: No rollback is a blocker before continuing; do not proceed on trust or luck.

## What Can Only Be Previewed

- Explain who the project fits and what it can do
- Demonstrate a typical conversation flow based on project docs
- Help the user decide whether it is worth installing or researching further

## What Must Be Verified After Install

- Actually installing the Skill, plugin, or CLI
- Running scripts, modifying local files, or accessing external services
- Verifying real output quality, performance, and compatibility

## Boundary & Risk Decision Card

- **Mistaking the pre-install preview for a real run**: The user may overestimate how much configuration, permission, and compatibility verification the project has already done. Mitigation: Clearly separate prompt_preview_can_do from runtime_required. Claim: `clm_0004` inferred 0.45
- **Command execution will modify the local environment**: Install commands may write to the user's home directory, the host plugin directory, or project configuration. Mitigation: Run in an isolated environment or a test account first. Evidence: `README.md` Claim: `clm_0005` supported 0.86
- **To confirm**: After a real install, is it compatible with the user's current host AI version?. Why: Compatibility can only be verified in the actual host environment.
- **To confirm**: Does the project's output quality meet the user's specific task?. Why: The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **To confirm**: Do the install commands require network access, permissions, or global writes?. Why: This affects install risk in both enterprise and personal environments.

## Pre-Work Working Context

### Loading Order

- First read how_to_use.host_ai_instruction to establish the boundaries of this pre-install judgment asset.
- Read claim_graph_summary to confirm facts come from the Claim/Evidence Graph, not the Human Wiki narrative.
- Then read intended_users, capabilities, and quick_start_candidates to judge whether the user is a match.
- When you need to carry out a concrete task, check role_skill_index first, then evidence_index.
- For real install, file modification, network access, performance, or compatibility questions, turn to risk_card and boundaries.runtime_required.

### Task Routes

- **Command-Line Startup or Install Flow**: State that this is an after-install capability first, then give a pre-install checklist. Boundary: Must be verified after a real install or run. Evidence: `README.md` Claim: `clm_0001` supported 0.86

### Context Scale

- Total files: 47
- Important-file coverage: 40/47
- Evidence index entries: 36
- Role / Skill entries: 1

### Handling Insufficient Evidence

- **missing_evidence**: State that evidence is insufficient and ask the user for the target file, a README section, or after-install verification records; do not fill in facts.
- **out_of_scope_request**: State that the task is beyond the current AI Context Pack's evidence scope and suggest the user check the Human Manual or verify after a real install.
- **runtime_request**: Provide a pre-install checklist and command sources, but do not run commands for the user or claim they have been run.
- **source_conflict**: Show the conflicting sources side by side, mark them as unverified, and do not force a single version.

## Prompt Recipes

### Fit assessment

- Goal: Judge whether this project fits the user's current task.
- Expected output: A fit conclusion, key reasons, evidence citations, what can be previewed before install, what must be verified after install, and a next-step recommendation.

```text
Based on the AI Context Pack for ltx-video, ask me 3 necessary questions first, then judge whether it fits my task. The answer must cover: who it fits, what it can do, what it cannot do, whether it is worth installing, and where the evidence comes from. Every project fact must cite evidence_refs, source_paths, or a claim_id.
```

### Pre-install experience

- Goal: Let the user feel the core workflow before installing, while avoiding packaging the preview as real capability or a marketing promise.
- Expected output: An experience script with boundary labels, an after-install verification checklist, and a cautious recommendation; with no real-run promises or strong marketing language.

```text
Treat ltx-video as a pre-install experience asset, not an already-installed tool or a real runtime environment.

Output exactly four parts:
1. Ask me 3 necessary questions first.
2. Give an "experience script": use the three labels [Previewable before install], [Must verify after install], and [Insufficient evidence] to show how it might guide the workflow.
3. Give an after-install verification checklist: list which capabilities can only be confirmed after a real install, real host loading, and a real project run.
4. Give a cautious recommendation: only "worth researching/trialing further", "add information before deciding", or "not recommended to continue"; do not endorse the project.

Hard boundaries:
- Do not claim you have installed, run, executed tests, modified files, or produced real results.
- Do not write promise-like phrasing such as "auto-adapts", "guarantees passing", "perfect fit", or "strongly recommend installing".
- If you describe how it works after install, you must use a conditional such as "if installed successfully and the host loads the Skill correctly, it might...".
- The experience script may only be written as "example lines / hypothetical flow": use "might ask / might suggest / might show", not "has written, has generated, has passed, is running, is generating".
- Prompt Preview does not hand out install commands; if the user is ready to trial, only prompt them to read Quick Start and the Risk Card first and to verify in an isolated environment.
- Every project fact must come from a supported claim, evidence_refs, or source_paths; inferred/unverified items can only be risks or open questions.

```

### Role / Skill selection

- Goal: Pick the best-matching asset from the project's roles or Skills.
- Expected output: A list of candidate roles or Skills, each with an applicable scenario, evidence paths, risk boundary, and whether after-install verification is needed.

```text
Read role_skill_index and recommend 3-5 of the most relevant roles or Skills for my target task. For each recommendation, state the applicable scenario, likely output, risk boundary, and evidence_refs.
```

### Risk pre-check

- Goal: Identify environment, permission, rule-conflict, and quality risks before installing or adopting.
- Expected output: A checklist of environment, permission, dependency, license, host-conflict, quality risk, and unknown items.

```text
Based on risk_card, boundaries, and quick_start_candidates, give me a pre-install risk pre-check list. Do not run commands for me; only explain what I should check, why, and what impact a failure would have.
```

### Host AI kickoff instruction

- Goal: Turn the project context into a host AI instruction for the start of a conversation.
- Expected output: A pre-work instruction with clear boundaries and clear evidence citations, suitable to copy to a host AI.

```text
Based on the AI Context Pack for ltx-video, generate a pre-work instruction I can paste to my host AI. This instruction must obey not_runtime=true and must not claim the project has been installed, run, or produced real results.
```

## Role / Skill Index

- Indexed 1 role / Skill / project-doc entries.

- **LTX-Video** (project_doc): ! Website https://img.shields.io/badge/Website-LTXV-181717?logo=google-chrome https://ltx.video ! Model https://img.shields.io/badge/HuggingFace-Model-orange?logo=huggingface https://huggingface.co/Lightricks/LTX-Video ! Demo https://img.shields.io/badge/Demo-Try%20Now-brightgreen?logo=vercel https://app.ltx.studio/ltx-2-playground/t2v ! Paper https://img.shields.io/badge/Paper-arXiv-B31B1B?logo=arxiv https://arxiv.… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `README.md`

## Evidence Index

- Indexed 36 evidence entries.

- **LTX-Video** (documentation): ! Website https://img.shields.io/badge/Website-LTXV-181717?logo=google-chrome https://ltx.video ! Model https://img.shields.io/badge/HuggingFace-Model-orange?logo=huggingface https://huggingface.co/Lightricks/LTX-Video ! Demo https://img.shields.io/badge/Demo-Try%20Now-brightgreen?logo=vercel https://app.ltx.studio/ltx-2-playground/t2v ! Paper https://img.shields.io/badge/Paper-arXiv-B31B1B?logo=arxiv https://arxiv.org/abs/2501.00103 ! Trainer https://img.shields.io/badge/LTXV-Trainer-9146FF?logo=github https://github.com/Lightricks/LTX-Video-Trainer ! Discord https://img.shields.io/badge/Join-Discord-5865F2?logo=discord https://discord.gg/ltxplatform Evidence: `README.md`
- **License** (source_file): Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ Evidence: `LICENSE`
- **Ltxv 13B 0.9.8 Dev Fp8** (source_file): pipeline type: multi-scale checkpoint path: "ltxv-13b-0.9.8-dev-fp8.safetensors" downscale factor: 0.6666666 spatial upscaler model path: "ltxv-spatial-upscaler-0.9.8.safetensors" stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "float8 e4m3fn" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false first pass: guidance scale: 1, 1, 6, 8, 6, 1, 1 stg scale: 0, 0, 4, 4, 4, 2, 1 rescali… Evidence: `configs/ltxv-13b-0.9.8-dev-fp8.yaml`
- **Ltxv 13B 0.9.8 Dev** (source_file): pipeline type: multi-scale checkpoint path: "ltxv-13b-0.9.8-dev.safetensors" downscale factor: 0.6666666 spatial upscaler model path: "ltxv-spatial-upscaler-0.9.8.safetensors" stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false first pass: guidance scale: 1, 1, 6, 8, 6, 1, 1 stg scale: 0, 0, 4, 4, 4, 2, 1 rescaling scale:… Evidence: `configs/ltxv-13b-0.9.8-dev.yaml`
- **Ltxv 13B 0.9.8 Distilled Fp8** (source_file): pipeline type: multi-scale checkpoint path: "ltxv-13b-0.9.8-distilled-fp8.safetensors" downscale factor: 0.6666666 spatial upscaler model path: "ltxv-spatial-upscaler-0.9.8.safetensors" stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "float8 e4m3fn" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false first pass: timesteps: 1.0000, 0.9937, 0.9875, 0.9812, 0.9750, 0.9094, 0.7250 gu… Evidence: `configs/ltxv-13b-0.9.8-distilled-fp8.yaml`
- **Ltxv 13B 0.9.8 Distilled** (source_file): pipeline type: multi-scale checkpoint path: "ltxv-13b-0.9.8-distilled.safetensors" downscale factor: 0.6666666 spatial upscaler model path: "ltxv-spatial-upscaler-0.9.8.safetensors" stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false first pass: timesteps: 1.0000, 0.9937, 0.9875, 0.9812, 0.9750, 0.9094, 0.7250 guidance sc… Evidence: `configs/ltxv-13b-0.9.8-distilled.yaml`
- **Ltxv 2B 0.9.8 Distilled Fp8** (source_file): pipeline type: multi-scale checkpoint path: "ltxv-2b-0.9.8-distilled-fp8.safetensors" downscale factor: 0.6666666 spatial upscaler model path: "ltxv-spatial-upscaler-0.9.8.safetensors" stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "float8 e4m3fn" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false first pass: timesteps: 1.0000, 0.9937, 0.9875, 0.9812, 0.9750, 0.9094, 0.7250 gui… Evidence: `configs/ltxv-2b-0.9.8-distilled-fp8.yaml`
- **Ltxv 2B 0.9.8 Distilled** (source_file): pipeline type: multi-scale checkpoint path: "ltxv-2b-0.9.8-distilled.safetensors" downscale factor: 0.6666666 spatial upscaler model path: "ltxv-spatial-upscaler-0.9.8.safetensors" stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false first pass: timesteps: 1.0000, 0.9937, 0.9875, 0.9812, 0.9750, 0.9094, 0.7250 guidance sca… Evidence: `configs/ltxv-2b-0.9.8-distilled.yaml`
- **Inference** (source_file): def main ⋮---- parser = HfArgumentParser InferenceConfig config = parser.parse args into dataclasses 0 Evidence: `inference.py`
- **Split into words** (source_file): logger = logging.get logger "LTX-Video" ⋮---- def get total gpu memory ⋮---- total memory = torch.cuda.get device properties 0 .total memory / 1024 3 ⋮---- def get device ⋮---- image = Image.open image input .convert "RGB" ⋮---- image = image input ⋮---- aspect ratio target = target width / target height aspect ratio frame = input width / input height ⋮---- new width = int input height aspect ratio target new height = input height x start = input width - new width // 2 y start = 0 ⋮---- new width = input width new height = int input width / aspect ratio target x start = 0 y start = input height - new height // 2 ⋮---- image = image.crop x start, y start, x start + new width, y start + new h… Evidence: `ltx_video/inference.py`
- **Causal Conv3D** (source_file): class CausalConv3d nn.Module ⋮---- kernel size = kernel size, kernel size, kernel size ⋮---- dilation = dilation, 1, 1 ⋮---- height pad = kernel size 1 // 2 width pad = kernel size 2 // 2 padding = 0, height pad, width pad ⋮---- def forward self, x, causal: bool = True ⋮---- first frame pad = x :, :, :1, :, : .repeat x = torch.concatenate first frame pad, x , dim=2 ⋮---- last frame pad = x :, :, -1:, :, : .repeat x = torch.concatenate first frame pad, x, last frame pad , dim=2 x = self.conv x ⋮---- @property def weight self Evidence: `ltx_video/models/autoencoders/causal_conv3d.py`
- **out** (source_file): PER CHANNEL STATISTICS PREFIX = "per channel statistics." logger = logging.get logger name ⋮---- class CausalVideoAutoencoder AutoencoderKLWrapper ⋮---- pretrained model name or path = Path pretrained model name or path ⋮---- config local path = pretrained model name or path / "config.json" config = cls.load config config local path, kwargs ⋮---- model local path = pretrained model name or path / "autoencoder.pth" state dict = torch.load model local path, map location=torch.device "cpu" ⋮---- statistics local path = ⋮---- data = json.load file transposed data = list zip data "data" data dict = { std of means = data dict "std-of-means" mean of means = data dict.get ⋮---- config path = pretra… Evidence: `ltx_video/models/autoencoders/causal_video_autoencoder.py`
- **Dual Conv3D** (source_file): class DualConv3d nn.Module ⋮---- kernel size = kernel size, kernel size, kernel size ⋮---- stride = stride, stride, stride ⋮---- padding = padding, padding, padding ⋮---- dilation = dilation, dilation, dilation ⋮---- intermediate channels = ⋮---- def reset parameters self ⋮---- bound1 = 1 / math.sqrt fan in1 ⋮---- bound2 = 1 / math.sqrt fan in2 ⋮---- def forward self, x, use conv3d=False, skip time conv=False ⋮---- def forward with 3d self, x, skip time conv ⋮---- x = F.conv3d ⋮---- def forward with 2d self, x, skip time conv ⋮---- x = rearrange x, "b c d h w - b d c h w" ⋮---- weight1 = self.weight1.squeeze 2 ⋮---- stride1 = self.stride1 1 , self.stride1 2 padding1 = self.padding1 1 , self… Evidence: `ltx_video/models/autoencoders/dual_conv3d.py`
- **Split the image into 512x512 tiles and encode them separately.** (source_file): class AutoencoderKLWrapper ModelMixin, ConfigMixin ⋮---- quant dims = 2 if dims == 2 else 3 ⋮---- def set tiling params self, sample size: int = 512, overlap factor: float = 0.25 ⋮---- num blocks = len self.encoder.down blocks ⋮---- def enable z tiling self, z sample size: int = 8 ⋮---- r""" Enable tiling during VAE decoding. When this option is enabled, the VAE will split the input tensor in tiles to compute decoding in several steps. This is useful to save some memory and allow larger batch sizes. """ ⋮---- def disable z tiling self ⋮---- r""" Disable tiling during VAE decoding. If use tiling was previously invoked, this method will go back to computing decoding in one step. """ ⋮---- def… Evidence: `ltx_video/models/autoencoders/vae.py`
- **Vae Encode** (source_file): xm = None ⋮---- is video shaped = media items.dim == 5 ⋮---- media items = rearrange media items, "b c n h w - b n c h w" ⋮---- encode bs = len media items // split size ⋮---- latents = ⋮---- latents = torch.cat latents, dim=0 ⋮---- latents = vae.encode media items .latent dist.sample ⋮---- latents = normalize latents latents, vae, vae per channel normalize ⋮---- latents = rearrange latents, " b n c h w - b c n h w", b=batch size ⋮---- is video shaped = latents.dim == 5 batch size = latents.shape 0 ⋮---- latents = rearrange latents, "b c n h w - b n c h w" ⋮---- encode bs = len latents // split size image batch = images = torch.cat image batch, dim=0 ⋮---- images = run decoder ⋮---- images… Evidence: `ltx_video/models/autoencoders/vae_encode.py`
- **patchify** (source_file): logger = logging.get logger name ⋮---- class VideoAutoencoder AutoencoderKLWrapper ⋮---- config local path = pretrained model name or path / "config.json" config = cls.load config config local path, kwargs video vae = cls.from config config ⋮---- model local path = pretrained model name or path / "autoencoder.pth" ckpt state dict = torch.load model local path ⋮---- statistics local path = ⋮---- data = json.load file transposed data = list zip data "data" data dict = { ⋮---- @staticmethod def from config config ⋮---- double z = config.get "double z", True latent log var = config.get use quant conv = config.get "use quant conv", True ⋮---- encoder = Encoder ⋮---- decoder = Decoder ⋮---- dims… Evidence: `ltx_video/models/autoencoders/video_autoencoder.py`
- **1. Prepare GLIGEN inputs** (source_file): logger = logging.get logger name ⋮---- @maybe allow in graph class BasicTransformerBlock nn.Module ⋮---- r""" A basic Transformer block. Parameters: dim int : The number of channels in the input and output. num attention heads int : The number of heads to use for multi-head attention. attention head dim int : The number of channels in each head. dropout float , optional , defaults to 0.0 : The dropout probability to use. cross attention dim int , optional : The size of the encoder hidden states vector for cross attention. activation fn str , optional , defaults to "geglu" : Activation function to be used in feed-forward. num embeds ada norm : obj: int , optional : The number of diffusion st… Evidence: `ltx_video/models/transformers/attention.py`
- **Embeddings** (source_file): half dim = embedding dim // 2 exponent = -math.log max period torch.arange exponent = exponent / half dim - downscale freq shift ⋮---- emb = torch.exp exponent emb = timesteps :, None .float emb None, : ⋮---- emb = scale emb ⋮---- emb = torch.cat torch.sin emb , torch.cos emb , dim=-1 ⋮---- emb = torch.cat emb :, half dim: , emb :, :half dim , dim=-1 ⋮---- emb = torch.nn.functional.pad emb, 0, 1, 0, 0 ⋮---- def get 3d sincos pos embed embed dim, grid, w, h, f ⋮---- grid = rearrange grid, "c f h w - c f h w", h=h, w=w grid = rearrange grid, "c f h w - c h w f", h=h, w=w grid = grid.reshape 3, 1, w, h, f pos embed = get 3d sincos pos embed from grid embed dim, grid pos embed = pos embed.trans… Evidence: `ltx_video/models/transformers/embeddings.py`
- **Symmetric Patchifier** (source_file): class Patchifier ConfigMixin, ABC ⋮---- def init self, patch size: int ⋮---- @abstractmethod def patchify self, latents: Tensor - Tuple Tensor, Tensor ⋮---- @property def patch size self ⋮---- latent sample coords = torch.meshgrid latent sample coords = torch.stack latent sample coords, dim=0 latent coords = latent sample coords.unsqueeze 0 .repeat batch size, 1, 1, 1, 1 latent coords = rearrange ⋮---- class SymmetricPatchifier Patchifier ⋮---- def patchify self, latents: Tensor - Tuple Tensor, Tensor ⋮---- latent coords = self.get latent coords f, h, w, b, latents.device latents = rearrange ⋮---- output height = output height // self. patch size 1 output width = output width // self. patch… Evidence: `ltx_video/models/transformers/symmetric_patchifier.py`
- **Transformer3D** (source_file): logger = logging.get logger name ⋮---- @dataclass class Transformer3DModelOutput BaseOutput ⋮---- sample: torch.FloatTensor ⋮---- class Transformer3DModel ModelMixin, ConfigMixin ⋮---- supports gradient checkpointing = True ⋮---- inner dim = num attention heads attention head dim ⋮---- def set use tpu flash attention self ⋮---- r""" Function sets the flag in this object and propagates down the children. The flag will enforce the usage of TPU attention kernel. """ ⋮---- num layers = len self.transformer blocks mask = torch.ones ⋮---- def set gradient checkpointing self, module, value=False ⋮---- def get fractional positions self, indices grid ⋮---- fractional positions = torch.stack ⋮---- de… Evidence: `ltx_video/models/transformers/transformer3d.py`
- **Crf Compressor** (source_file): def encode single frame output file, image array: np.ndarray, crf ⋮---- container = av.open output file, "w", format="mp4" ⋮---- stream = container.add stream ⋮---- av frame = av.VideoFrame.from ndarray image array, format="rgb24" .reformat ⋮---- def decode single frame video file ⋮---- container = av.open video file ⋮---- stream = next s for s in container.streams if s.type == "video" frame = next container.decode stream ⋮---- def compress image: torch.Tensor, crf=29 ⋮---- image array = ⋮---- video bytes = output file.getvalue ⋮---- image array = decode single frame video file tensor = torch.tensor image array, dtype=image.dtype, device=image.device / 255.0 Evidence: `ltx_video/pipelines/crf_compressor.py`
- **Adapted from diffusers.pipelines.deepfloyd if.pipeline if.encode prompt** (source_file): logger = logging.get logger name ⋮---- ASPECT RATIO 1024 BIN = { ⋮---- ASPECT RATIO 512 BIN = { ⋮---- accepts timesteps = "timesteps" in set ⋮---- timesteps = scheduler.timesteps num inference steps = len timesteps ⋮---- timesteps = timesteps ⋮---- @dataclass class ConditioningItem ⋮---- """ Defines a single frame-conditioning item - a single frame or a sequence of frames. Attributes: media item torch.Tensor : shape= b, 3, f, h, w . The media item to condition on. media frame number int : The start-frame number of the media item in the generated video. conditioning strength float : The strength of the conditioning 1.0 = full conditioning . media x Optional int : Optional left x coordinate o… Evidence: `ltx_video/pipelines/pipeline_ltx_video.py`
- **Rf** (source_file): def linear quadratic schedule num steps, threshold noise=0.025, linear steps=None ⋮---- linear steps = num steps // 2 linear sigma schedule = threshold noise step diff = linear steps - threshold noise num steps quadratic steps = num steps - linear steps quadratic coef = threshold noise step diff / linear steps quadratic steps 2 linear coef = threshold noise / linear steps - 2 threshold noise step diff / const = quadratic coef linear steps 2 quadratic sigma schedule = sigma schedule = linear sigma schedule + quadratic sigma schedule + 1.0 sigma schedule = 1.0 - x for x in sigma schedule ⋮---- m = math.prod samples shape 2: ⋮---- snr = timesteps / 1 - timesteps 2 shift snr = torch.log snr + 2… Evidence: `ltx_video/schedulers/rf.py`
- **Diffusers Config Mapping** (source_file): def make hashable key dict key ⋮---- def convert value value ⋮---- DIFFUSERS SCHEDULER CONFIG = { DIFFUSERS TRANSFORMER CONFIG = { DIFFUSERS VAE CONFIG = { ⋮---- OURS SCHEDULER CONFIG = { ⋮---- OURS TRANSFORMER CONFIG = { OURS VAE CONFIG = { ⋮---- diffusers and ours config mapping = { ⋮---- TRANSFORMER KEYS RENAME DICT = { ⋮---- VAE KEYS RENAME DICT = { Evidence: `ltx_video/utils/diffusers_config_mapping.py`
- **Prompt Enhance Utils** (source_file): logger = logging.getLogger name ⋮---- T2V CINEMATIC PROMPT = """You are an expert cinematic director with many award winning movies, When writing prompts based on the user input, focus on detailed, chronological descriptions of actions and scenes. ⋮---- I2V CINEMATIC PROMPT = """You are an expert cinematic director with many award winning movies, When writing prompts based on the user input, focus on detailed, chronological descriptions of actions and scenes. ⋮---- def tensor to pil tensor ⋮---- tensor = tensor + 1 / 2 ⋮---- tensor = tensor.permute 1, 2, 0 ⋮---- numpy image = tensor.cpu .numpy 255 .astype "uint8" ⋮---- prompts = prompt if isinstance prompt, str else prompt ⋮---- prompts = g… Evidence: `ltx_video/utils/prompt_enhance_utils.py`
- **Skip Layer Strategy** (source_file): class SkipLayerStrategy Enum ⋮---- AttentionSkip = auto AttentionValues = auto Residual = auto TransformerBlock = auto Evidence: `ltx_video/utils/skip_layer_strategy.py`
- **Torch Utils** (source_file): def append dims x: torch.Tensor, target dims: int - torch.Tensor ⋮---- dims to append = target dims - x.ndim ⋮---- class Identity nn.Module ⋮---- def init self, args, kwargs - None ⋮---- def forward self, x: torch.Tensor, args, kwargs - torch.Tensor Evidence: `ltx_video/utils/torch_utils.py`
- **.gitattributes** (source_file): .jpg filter=lfs diff=lfs merge=lfs -text .jpeg filter=lfs diff=lfs merge=lfs -text .png filter=lfs diff=lfs merge=lfs -text .gif filter=lfs diff=lfs merge=lfs -text tests/utils/car.png filter=lfs diff=lfs merge=lfs -text Evidence: `.gitattributes`
- **Byte-compiled / optimized / DLL files** (source_file): Byte-compiled / optimized / DLL files pycache / .py cod $py.class Evidence: `.gitignore`
- **.Pre Commit Config** (source_file): repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.2.2 hooks: - id: ruff args: --fix types: python - repo: https://github.com/psf/black rev: 24.2.0 hooks: - id: black name: Black code formatter language version: python3 Evidence: `.pre-commit-config.yaml`
- **Ltxv 2B 0.9.1** (source_file): pipeline type: base checkpoint path: "ltx-video-2b-v0.9.1.safetensors" guidance scale: 3 stg scale: 1 rescaling scale: 0.7 skip block list: 19 num inference steps: 40 stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false Evidence: `configs/ltxv-2b-0.9.1.yaml`
- **Ltxv 2B 0.9.5** (source_file): pipeline type: base checkpoint path: "ltx-video-2b-v0.9.5.safetensors" guidance scale: 3 stg scale: 1 rescaling scale: 0.7 skip block list: 19 num inference steps: 40 stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false Evidence: `configs/ltxv-2b-0.9.5.yaml`
- **Ltxv 2B 0.9.6 Dev** (source_file): pipeline type: base checkpoint path: "ltxv-2b-0.9.6-dev-04-25.safetensors" guidance scale: 3 stg scale: 1 rescaling scale: 0.7 skip block list: 19 num inference steps: 40 stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false Evidence: `configs/ltxv-2b-0.9.6-dev.yaml`
- **Ltxv 2B 0.9.6 Distilled** (source_file): pipeline type: base checkpoint path: "ltxv-2b-0.9.6-distilled-04-25.safetensors" guidance scale: 1 stg scale: 0 rescaling scale: 1 num inference steps: 8 stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: true Evidence: `configs/ltxv-2b-0.9.6-distilled.yaml`
- **Ltxv 2B 0.9** (source_file): pipeline type: base checkpoint path: "ltx-video-2b-v0.9.safetensors" guidance scale: 3 stg scale: 1 rescaling scale: 0.7 skip block list: 19 num inference steps: 40 stg mode: "attention values" decode timestep: 0.05 decode noise scale: 0.025 text encoder model name or path: "PixArt-alpha/PixArt-XL-2-1024-MS" precision: "bfloat16" sampler: "from checkpoint" prompt enhancement words threshold: 120 prompt enhancer image caption model name or path: "MiaoshouAI/Florence-2-large-PromptGen-v2.0" prompt enhancer llm model name or path: "unsloth/Llama-3.2-3B-Instruct" stochastic sampling: false Evidence: `configs/ltxv-2b-0.9.yaml`
- **Pyproject** (source_file): build-system requires = "setuptools =42", "wheel" build-backend = "setuptools.build meta" Evidence: `pyproject.toml`

## Rules the Host AI Must Follow

- **Treat this asset as pre-work context, not a runtime environment.**: The AI Context Pack contains only an evidence-backed understanding of the project, not the project's executable state. Evidence: `README.md`, `LICENSE`, `configs/ltxv-13b-0.9.8-dev-fp8.yaml`
- **When answering the user, distinguish what can be previewed from what can only be verified after install.**: The consumer value of the pre-install experience comes from reducing bad installs and misjudgments, not from pretending to be a real run. Evidence: `README.md`, `LICENSE`, `configs/ltxv-13b-0.9.8-dev-fp8.yaml`

## Questions the User Should Answer First

- Which host AI or local environment do you plan to use it in?
- Do you just want to experience the workflow first, or are you ready to actually install?
- What matters most to you: install cost, output quality, or conflicts with your existing rules?

## Acceptance Checks

- Every capability claim can be traced back to a file path in evidence_refs.
- AI_CONTEXT_PACK.md does not package previews as a real run.
- The user can understand who it fits, what it can do, how to start, and the risk boundaries within 3 minutes.

---

## Doramagic Context Augmentation

The following sections strengthen the repository context for a host AI. Human Manual data is a reading route, and pitfall notes become operating constraints.

## Human Manual Outline

Usage rule: this is only a reading route and salience signal, not factual authority. Concrete claims must still return to repo evidence or Claim Graph.

Host AI hard rules:
- Do not treat page titles, section order, summaries, or importance values as factual project evidence.
- When explaining the Human Manual outline, state that it is only a reading route or salience signal.
- Capability, installation, compatibility, runtime state, and risk claims must cite repo evidence, source paths, or Claim Graph.

- **Overview and LTX-2 Transition**: importance `high`
  - source_paths: README.md, LICENSE
- **System Architecture and Data Flow**: importance `high`
  - source_paths: ltx_video/pipelines/pipeline_ltx_video.py, ltx_video/inference.py, inference.py
- **Inference Pipeline Usage (CLI and Python API)**: importance `high`
  - source_paths: inference.py, ltx_video/inference.py
- **Transformer3D Backbone and Attention**: importance `high`
  - source_paths: ltx_video/models/transformers/transformer3d.py, ltx_video/models/transformers/attention.py, ltx_video/models/transformers/embeddings.py, ltx_video/models/transformers/symmetric_patchifier.py
- **Video Autoencoder (VAE) System**: importance `high`
  - source_paths: ltx_video/models/autoencoders/causal_video_autoencoder.py, ltx_video/models/autoencoders/video_autoencoder.py, ltx_video/models/autoencoders/vae.py, ltx_video/models/autoencoders/vae_encode.py, ltx_video/models/autoencoders/causal_conv3d.py
- **Schedulers, Sampling, and Utilities**: importance `medium`
  - source_paths: ltx_video/schedulers/rf.py, ltx_video/utils/diffusers_config_mapping.py, ltx_video/utils/prompt_enhance_utils.py, ltx_video/utils/skip_layer_strategy.py, ltx_video/utils/torch_utils.py
- **Model Configurations and Variants**: importance `high`
  - source_paths: configs/ltxv-13b-0.9.8-dev.yaml, configs/ltxv-13b-0.9.8-dev-fp8.yaml, configs/ltxv-13b-0.9.8-distilled.yaml, configs/ltxv-13b-0.9.8-distilled-fp8.yaml, configs/ltxv-2b-0.9.8-distilled.yaml
- **Integration, Extensions, and Known Issues**: importance `high`
  - source_paths: inference.py, ltx_video/pipelines/pipeline_ltx_video.py, ltx_video/utils/diffusers_config_mapping.py, ltx_video/models/transformers/attention.py, README.md

## Repo Inspection Evidence

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `4b2d053057623ddd4d0a1d3e9cd28890e9ef487f`
- inspected_files: `README.md`, `pyproject.toml`

Host AI hard rules:
- Without repo_clone_verified=true, do not claim that the source code has been read.
- Without repo_inspection_verified=true, do not write README, docs, or package-file conclusions as facts.
- Without quick_start_verified=true, do not claim that the Quick Start path has run successfully.

## Doramagic Pitfall Constraints

These rules come from Doramagic discovery, validation, or compilation findings. The host AI must treat them as operating constraints, not background notes.

### Constraint 1: Capability evidence risk requires verification

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: capability.assumptions | https://github.com/Lightricks/LTX-Video
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 2: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: downstream_validation.risk_items | https://github.com/Lightricks/LTX-Video
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 3: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: risks.scoring_risks | https://github.com/Lightricks/LTX-Video
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 4: Maintenance risk requires verification

- Trigger: issue_or_pr_quality=unknown。
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: evidence.maintainer_signals | https://github.com/Lightricks/LTX-Video
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 5: Maintenance risk requires verification

- Trigger: release_recency=unknown。
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: evidence.maintainer_signals | https://github.com/Lightricks/LTX-Video
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.
