Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .claude/skills/measuring-hardware-cells/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: measuring-hardware-cells
description: >-
Use when measuring local hardware capability cells on a GPU or Apple Silicon
Mac, benchmarking peak VRAM or unified memory and step times across
resolutions or durations, finding the true OOM or paging cliff in Cautious or
Brave mode, diagnosing silent WDDM shared-memory paging or macOS swap
thrashing, or contributing empirical hardware measurements and budget law
improvements.
---

@../../../docs/skills/measuring-hardware-cells.md
3 changes: 2 additions & 1 deletion .cursor/rules/ltx2-patch-reverify.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ alwaysApply: false

# LTX-2 bump → re-check `services.patches`

Delete-first. If this change updates `ltx-core` or `ltx-pipelines` (version pin, git tag, or `tool.uv.dependency-metadata`), treat every module imported from `backend/services/patches/` in `backend/ltx2_server.py` as suspect — plus any out-of-directory swaps such as `distilled_keyframe_guiding`.
Delete-first. If this change updates `ltx-core` or `ltx-pipelines` (version pin, git tag, or `tool.uv.dependency-metadata`), treat every module imported from `backend/services/patches/` in `backend/ltx2_server.py` as suspect, plus any out-of-directory swap of an upstream symbol.

Those patches rebind private upstream symbols. A bump can rename the target (import-time assert should fail) or change the contract (assert still passes, behavior is wrong). Default is **delete** the patch; keep only what still fails on the new revision.

Expand All @@ -22,6 +22,7 @@ Forked pipeline classes copy upstream bodies, and a signature test does not catc
- `TiledICLoraPipeline._video_conditionings` (`ic_lora_pipeline/tiled_ic_lora_pipeline.py`) copies upstream `ICLoraPipeline._video_conditionings`; keep the `apply_ic_lora` gate and only change `encode_tiling`.
- `DistilledPipelineWithSkipStage2._call_stage_1_only` mirrors stage 1 of `DistilledPipeline`.
- `DistilledA2VPipeline` and `LTXRetakePipeline` call `DiffusionStage` directly.
- `NagDistilledMixin` (`fast_video_pipeline/nag_distilled.py`) wraps `DistilledPipeline._prepare_run` and `stream_chunks`. `nag_cross_attention` replaces `BasicAVTransformerBlock._apply_text_cross_attention`; diff it against upstream, including `apply_cross_attention_adaln` and `Attention.forward`.

Size latents with `stage.video_scale_factors` (transformer geometry). `tiling_scale_factors_for_vae` is the decoder's tiling scale (2x8x8 on the 2.5 DiffVAE) and is only for `ensure_tiling_config`.

Expand Down
12 changes: 12 additions & 0 deletions .cursor/skills/measuring-hardware-cells/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: measuring-hardware-cells
description: >-
Use when measuring local hardware capability cells on a GPU or Apple Silicon
Mac, benchmarking peak VRAM or unified memory and step times across
resolutions or durations, finding the true OOM or paging cliff in Cautious or
Brave mode, diagnosing silent WDDM shared-memory paging or macOS swap
thrashing, or contributing empirical hardware measurements and budget law
improvements.
---

@../../../docs/skills/measuring-hardware-cells.md
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
frontend/generated/** linguist-generated=true
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

- name: Pyright type check
working-directory: backend
run: uv run pyright
run: uv run --frozen pyright

- name: OpenAPI contract check
run: pnpm run openapi:check
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
# The full suite runs on Linux. Windows only runs tests that call the
# real Win32 DLL APIs. `--` keeps `-m` from being read as a uv flag.
- name: Run tests
run: uv run -- pytest -v --tb=short -m ci_os
run: uv run --frozen -- pytest -v --tb=short -m ci_os

# One Linux pytest job was the wait. Four shards run together.
# The matrix length and `--splits` below are the same number.
Expand All @@ -124,7 +124,7 @@ jobs:
# least_duration deals tests round-robin when there is no durations file,
# so a slow module is not collected entirely onto the first shard.
- name: Run tests
run: uv run -- pytest -v --tb=short --splits 4 --group ${{ matrix.shard }} --splitting-algorithm least_duration
run: uv run --frozen -- pytest -v --tb=short --splits 4 --group ${{ matrix.shard }} --splitting-algorithm least_duration

# Branch protection still looks for this name. It passes when every Linux shard passes.
test-python-linux-gate:
Expand Down
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ Budget constants in `backend/runtime_config/` cite internal measurement run keys
Budget comments explain why, not what was measured: mechanism, failure mode,
and what breaks if the constant changes. No run keys, brackets, or fit math in
code prose — those live behind the Evidence links and in the budgets ledger.
What each machine runs, for users, is `docs/hardware-compatibility.md`; when a
budget change moves what a card or Mac offers, update its tables in the same change
and regenerate `docs/local-compat-matrix.md` (never hand-edit it).

## Tests

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ Release notes are on the [GitHub releases page](https://github.com/Lightricks/LT

### System requirements

These are the requirements for local generation. They match the [LTX Desktop page](https://ltx.io/ltx-desktop).
These are the recommended specs for local generation. What each GPU and Mac size can run, and why, is in [`docs/hardware-compatibility.md`](docs/hardware-compatibility.md).

| Platform | Requirements |
| Platform | Recommended |
| --- | --- |
| **Windows 10/11** (64-bit) | NVIDIA GPU with CUDA and **24 GB or more VRAM** (32 GB recommended). 32 GB RAM. |
| **Windows 10/11** (64-bit) | NVIDIA GPU with CUDA and **24 GB or more VRAM** (32 GB recommended). 64 GB RAM; with the models on an NVMe drive, 32 GB runs every tool and 24 GB runs generation and editing. |
| **Linux** (Ubuntu 22.04+ or similar, x64 or arm64) | NVIDIA GPU with CUDA and **24 GB or more VRAM** (32 GB recommended), NVIDIA driver installed. 32 GB RAM. |
| **macOS 26+** (Tahoe) | Apple Silicon (M1 or later) with **48 GB or more** for full local generation. Apple Silicon with 32 GB is limited to 540p and 5 s. Apple Silicon with less than 24 GB, and Intel Macs, use the Gen Space API only. |
| **macOS 26+** (Tahoe) | Apple Silicon (M1 or later) with **48 GB or more** for every local job. 32 GB is the advertised minimum: 32 and 36 GB Macs run most jobs up to 1080p and shorter 1440p and 4K clips. Apple Silicon with less than 24 GB, and Intel Macs, use the Gen Space API only. |

The app itself needs **macOS 14 or later**. On macOS 14 and 15, local generation is not available and the app shows the **Coming soon to your device** notice. macOS 13 and earlier cannot run the app.

All platforms need **100 GB or more** of free disk space. Plan for up to **160 GB or more** if you add LoRAs and IC-LoRAs.

The app offers local generation on lower-spec machines, but we do not recommend them. The app checks 9 GiB VRAM on Windows with an fp8-capable GPU (15 GiB on other CUDA setups), 32 GiB total RAM on macOS, and macOS 26 or later. Below these floors, the app shows a **Coming soon to your device** notice instead of the generation tools. Assets, Settings, Gen Space, and the Video Editor stay available. Cloud APIs are optional. An LTX API key is never required to start.
The app offers local generation on lower-spec machines, but we do not recommend them. The app checks 9 GiB VRAM on Windows with an fp8-capable GPU (15 GiB on other CUDA setups), 24 GiB total memory on macOS, and macOS 26 or later. Below these floors, the app shows a **Coming soon to your device** notice instead of the generation tools. Assets, Settings, Gen Space, and the Video Editor stay available. Cloud APIs are optional. An LTX API key is never required to start.

See [`docs/local-compat-matrix.md`](docs/local-compat-matrix.md) for the tool-by-hardware table.
Smaller cards run longer clips in parts rather than in one pass: a 16 GB card runs Fast 720p/20s in 2 parts and 1080p/10s in 3. See [`docs/hardware-compatibility.md`](docs/hardware-compatibility.md) for what each GPU and memory size can run, and [`docs/local-compat-matrix.md`](docs/local-compat-matrix.md) for the tool-by-hardware table.

## Models

Expand Down Expand Up @@ -128,6 +128,7 @@ For the architecture and API boundary, see [`docs/remote-lan.md`](docs/remote-la
- [`docs/tools-and-options.md`](docs/tools-and-options.md): every tool and setting, and how prompt enhancement works
- [`docs/models-and-loras.md`](docs/models-and-loras.md): models, gated models, LoRA library, custom LoRAs
- [`docs/setup-and-settings.md`](docs/setup-and-settings.md): per-platform requirements, first run, data folders, text encoding, Settings tabs
- [`docs/hardware-compatibility.md`](docs/hardware-compatibility.md): will it run on your machine — per-hardware capabilities for generation, editing, and IC-LoRA
- [`docs/api-keys-and-privacy.md`](docs/api-keys-and-privacy.md): LTX, fal, and Gemini keys, cost, and privacy
- [`docs/desktop-assistant.md`](docs/desktop-assistant.md): the Assistant's tools, runs, providers, and local runtime
- [`docs/remote-lan.md`](docs/remote-lan.md): Remote architecture and API boundary
Expand Down
102 changes: 102 additions & 0 deletions backend/_routes/custom_lora.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from __future__ import annotations

from fastapi import APIRouter, Depends, Path, Query

from api_types import (
ActiveCustomLoraImportResponse,
CustomLoraImportProgressResponse,
CustomLoraImportRequest,
CustomLoraImportStartResponse,
CustomLoraLinkInfoRequest,
CustomLoraLinkInfoResponse,
CustomLoraListResponse,
CustomLoraRestoreRequest,
StatusResponse,
)
from app_handler import AppHandler
from state import get_state_service

# Desktop only: adding and deleting touch the user's disk. The phone gets the read-only list
# from remote/loras.py.
router = APIRouter(prefix="/api")


@router.get("/custom-loras", response_model=CustomLoraListResponse, tags=["custom-loras"])
def route_list_custom_loras(
handler: AppHandler = Depends(get_state_service),
) -> CustomLoraListResponse:
return handler.custom_loras.list_loras()


@router.post("/custom-loras", response_model=CustomLoraImportStartResponse, tags=["custom-loras"])
def route_import_custom_lora(
req: CustomLoraImportRequest,
handler: AppHandler = Depends(get_state_service),
) -> CustomLoraImportStartResponse:
return handler.custom_loras.start_import(req)


@router.post(
"/custom-loras/link-info", response_model=CustomLoraLinkInfoResponse, tags=["custom-loras"]
)
def route_custom_lora_link_info(
req: CustomLoraLinkInfoRequest,
handler: AppHandler = Depends(get_state_service),
) -> CustomLoraLinkInfoResponse:
return handler.custom_loras.link_info(req.url)


@router.get(
"/custom-loras/import/progress",
response_model=CustomLoraImportProgressResponse,
tags=["custom-loras"],
)
def route_custom_lora_import_progress(
sessionId: str = Query(...),
handler: AppHandler = Depends(get_state_service),
) -> CustomLoraImportProgressResponse:
return handler.custom_loras.get_import_progress(sessionId)


@router.get(
"/custom-loras/import/active",
response_model=ActiveCustomLoraImportResponse,
tags=["custom-loras"],
)
def route_custom_lora_import_active(
handler: AppHandler = Depends(get_state_service),
) -> ActiveCustomLoraImportResponse:
return handler.custom_loras.get_active_import()


@router.post(
"/custom-loras/{custom_lora_id}/weights",
response_model=CustomLoraImportStartResponse,
tags=["custom-loras"],
)
def route_restore_custom_lora_weights(
req: CustomLoraRestoreRequest,
custom_lora_id: str = Path(pattern=r"^[a-z0-9-]+$", max_length=64),
handler: AppHandler = Depends(get_state_service),
) -> CustomLoraImportStartResponse:
return handler.custom_loras.restore_weights(custom_lora_id, req)


@router.delete(
"/custom-loras/{custom_lora_id}/weights", response_model=StatusResponse, tags=["custom-loras"]
)
def route_delete_custom_lora_weights(
custom_lora_id: str = Path(pattern=r"^[a-z0-9-]+$", max_length=64),
handler: AppHandler = Depends(get_state_service),
) -> StatusResponse:
handler.custom_loras.delete_weights(custom_lora_id)
return StatusResponse(status="ok")


@router.delete("/custom-loras/{custom_lora_id}", response_model=StatusResponse, tags=["custom-loras"])
def route_delete_custom_lora(
custom_lora_id: str = Path(pattern=r"^[a-z0-9-]+$", max_length=64),
handler: AppHandler = Depends(get_state_service),
) -> StatusResponse:
handler.custom_loras.delete(custom_lora_id)
return StatusResponse(status="ok")
73 changes: 73 additions & 0 deletions backend/_routes/generations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@

from api_types import (
CreateAudioToVideoRequest,
CreateCustomLoraRequest,
IcLoraRecipeCreate,
IcLoraTilePreflightRequest,
IcLoraTilePreflightResponse,
CreateExtendRequest,
CreateImageToVideoRequest,
CreateKeyframesRequest,
CreateLoraRecipeRequest,
CreateRetakeRequest,
CreateTextToImageRequest,
CreateTextToVideoRequest,
EditPreflightRequest,
EditPreflightResponse,
IcLoraRecipeMemoryRequest,
IcLoraRecipeMemoryResponse,
Generation,
QueueSnapshot,
ReorderGenerationQueueRequest,
Expand Down Expand Up @@ -113,6 +120,19 @@ def route_create_text_to_video(
)


@router.post(
"/generations/text-to-image",
response_model=Generation,
tags=["generations"],
)
def route_create_text_to_image(
req: CreateTextToImageRequest, handler: AppHandler = Depends(get_state_service)
) -> Generation:
return handler.queued_generations.create_text_to_image(
req, analytics_client="desktop"
)


@router.post(
"/generations/image-to-video",
response_model=Generation,
Expand All @@ -126,6 +146,19 @@ def route_create_image_to_video(
)


@router.post(
"/generations/keyframes",
response_model=Generation,
tags=["generations"],
)
def route_create_keyframes(
req: CreateKeyframesRequest, handler: AppHandler = Depends(get_state_service)
) -> Generation:
return handler.queued_generations.create_keyframes(
req, analytics_client="desktop"
)


@router.post(
# Bounded under /recipes/ so the `{recipe_id}` wildcard does not swallow the
# whole `POST /generations/*` namespace (a future static create route would
Expand All @@ -144,6 +177,19 @@ def route_create_lora_recipe(
)


@router.post(
"/generations/custom-lora",
response_model=Generation,
tags=["generations"],
)
def route_create_custom_lora(
req: CreateCustomLoraRequest, handler: AppHandler = Depends(get_state_service)
) -> Generation:
return handler.queued_generations.create_custom_lora(
req, analytics_client="desktop"
)


@router.post(
"/generations/audio-to-video",
response_model=Generation,
Expand All @@ -170,6 +216,20 @@ def route_create_retake(
)


@router.post(
"/generations/ic-lora-recipes/{recipe_id}/memory",
response_model=IcLoraRecipeMemoryResponse,
tags=["generations"],
)
def route_ic_lora_recipe_memory(
req: IcLoraRecipeMemoryRequest,
recipe_id: str = Path(pattern=_RECIPE_ID_PATTERN, max_length=64),
handler: AppHandler = Depends(get_state_service),
) -> IcLoraRecipeMemoryResponse:
# Path-free DTO (sizes and verdicts only): no remote projection needed.
return handler.ic_lora.recipe_memory(recipe_id, req)


@router.post(
"/generations/ic-lora-recipes/{recipe_id}",
response_model=Generation,
Expand All @@ -185,6 +245,19 @@ def route_create_ic_lora_recipe(
)


@router.post(
"/generations/ic-lora-recipes/{recipe_id}/preflight",
response_model=IcLoraTilePreflightResponse,
tags=["generations"],
)
def route_preflight_ic_lora_tile_sizes(
req: IcLoraTilePreflightRequest,
recipe_id: str = Path(pattern=_RECIPE_ID_PATTERN),
handler: AppHandler = Depends(get_state_service),
) -> IcLoraTilePreflightResponse:
return handler.queued_generations.preflight_ic_lora_tile_sizes(recipe_id, req)


@router.post(
"/generations/extend",
response_model=Generation,
Expand Down
12 changes: 11 additions & 1 deletion backend/_routes/image_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pixel_resolution,
run_tracked_generation,
)
from api_types import GenerateImageRequest, GenerateImageResponse
from api_types import GenerateImageRequest, GenerateImageResponse, ImageGenerationStatusResponse
from state import get_state_service
from app_handler import AppHandler

Expand Down Expand Up @@ -40,3 +40,13 @@ def route_generate_image(
lambda: handler.image_generation.generate(req),
)


status_router = APIRouter(prefix="/api", tags=["image"])


@status_router.get("/image-generation/status", response_model=ImageGenerationStatusResponse)
def route_image_generation_status(
handler: AppHandler = Depends(get_state_service),
) -> ImageGenerationStatusResponse:
"""Mounted on both Desktop and Remote: the phone cannot read Settings."""
return handler.image_generation.get_status()
17 changes: 17 additions & 0 deletions backend/_routes/ui_preferences.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Route handler for GET /api/ui-preferences. Mounted on both Desktop and Remote."""

from __future__ import annotations

from fastapi import APIRouter, Depends

from api_types import UiPreferences
from app_handler import AppHandler
from state import get_state_service

router = APIRouter(prefix="/api", tags=["ui-preferences"])


@router.get("/ui-preferences", response_model=UiPreferences)
def route_get_ui_preferences(handler: AppHandler = Depends(get_state_service)) -> UiPreferences:
settings = handler.settings.get_settings_snapshot()
return UiPreferences(advancedControls=settings.advanced_controls)
Loading
Loading