Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat([issue-739]): bump LTX2_PIN to v0.14.8 with dual-pin pipeline adaptation

[._.]/ Adam Eivydec1775ea0bc
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 0a99f3288a..b659cf6410 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -29,6 +29,7 @@
- **[issue-939] Internal: integration test locking pinned single nav rows** — Added a sidebar-level test that pinning a top-level page (Dashboard, Review Hub, City, Goals) renders it in the Pinned section, so a future refactor of the nav indexing can't silently drop pinned top-level pages. No user-facing change.
- **[issue-895] Internal: pinned the goal-organization apex round-trip with a test** — Confirmed "create a new apex from AI suggestions" already works end-to-end and added regression coverage so it can't silently break. No user-facing change.
- **Internal: restored a green lint build** — Added the standard DOM element globals the client lint config was missing, so the build's lint check passes again. No user-facing change.
+- **[issue-739] LTX-2 video runtime updated to v0.14.8** — Bumped the bundled LTX-2 (Apple Silicon) video generator to a newer upstream release with better memory behavior on HD and long renders and a fix that stops character LoRAs from silently dropping on Extend and high-quality modes. All five render modes (text, image, keyframe, extend, audio-to-video) keep working across the upgrade, and the previous version stays supported until an install re-runs its image/video setup.
## Fixed
diff --git a/scripts/generate_ltx2.py b/scripts/generate_ltx2.py
index 0ee15d1f0b..3df6638fc9 100644
--- a/scripts/generate_ltx2.py
+++ b/scripts/generate_ltx2.py
@@ -17,12 +17,20 @@ Why a wrapper at all (vs. spawning `ltx-2-mlx <subcommand>` directly):
the Node side simple — one helper, four subcommands, identical contract
to the existing `python -m mlx_video.generate_av` invocation.
-Modes:
- text → TextToVideoPipeline.generate_and_save
- image → ImageToVideoPipeline.generate_and_save (--image)
+Modes (class names shown new→old; we resolve whichever the installed pin has):
+ text → TI2VidOneStagePipeline / TextToVideoPipeline .generate_and_save
+ image → TI2VidOneStagePipeline / ImageToVideoPipeline .generate_and_save (--image)
fflf → KeyframeInterpolationPipeline.generate_and_save (--image start, --last-image end)
- extend → ExtendPipeline.extend_from_video (--extend-from-video, --extend-frames, --direction)
- a2v → AudioToVideoPipeline.generate_and_save (--audio, optional --image)
+ extend → RetakePipeline / ExtendPipeline .extend_from_video (--extend-from-video, --extend-frames, --direction)
+ a2v → A2VidPipelineTwoStage / AudioToVideoPipeline .generate_and_save (--audio, optional --image)
+
+Pin compatibility — class renames + frame_rate:
+ The v0.14.x line of ltx-2-mlx renamed every public pipeline class and
+ switched the output-rate keyword from `fps` to `frame_rate`. PortOS pins a
+ specific commit (see scripts/setup-image-video.sh LTX2_PIN), but installs
+ upgrade on their own schedule, so this bridge resolves both the pipeline
+ class (_resolve_pipeline / _resolve_pipeline_with_method) and the rate
+ keyword (_rate_kwargs) from the live API — old and new pins both work.
Output: writes the rendered .mp4 to --output. Emits a final JSON line on
stdout ({"video_path": "<output>"}) so the Node parent can read the result
@@ -39,6 +47,7 @@ from __future__ import annotations
import argparse
import importlib
+import inspect
import json
import os
import sys
@@ -70,6 +79,87 @@ def emit_download(msg: str) -> None:
print(f"DOWNLOAD:{msg}", file=sys.stderr, flush=True)
+def _resolve_pipeline(*names: str, method: str | None = None):
+ """Return the first available pipeline class from ltx_pipelines_mlx.
+
+ LTX-2 renamed every public pipeline class in the v0.14.x line
+ (TextToVideoPipeline → TI2VidOneStagePipeline, TwoStagePipeline →
+ TI2VidTwoStagesPipeline, AudioToVideoPipeline → A2VidPipelineTwoStage, …).
+ We try the names in preference order — new name first, legacy name as
+ fallback — so this bridge works against both the v0.14.x pins new installs
+ get AND the pre-rename pins an existing install may still have checked out
+ until it re-runs setup-image-video.sh.
+
+ `method`, when given, additionally requires the class to define it — used by
+ the extend path, where pre-rename pins expose ExtendPipeline.extend_from_video
+ and v0.14.x folds that into RetakePipeline.extend_from_video (deleting the
+ `extend` module). Preferring whichever class actually defines the method
+ avoids selecting a same-named class that happens to lack it.
+
+ Raises a clear SystemExit instead of surfacing an opaque ImportError deep
+ inside a runner.
+ """
+ pkg = importlib.import_module("ltx_pipelines_mlx")
+ for name in names:
+ cls = getattr(pkg, name, None)
+ if cls is not None and (method is None or hasattr(cls, method)):
+ return cls
+ want = f"pipeline with .{method}()" if method else "expected pipelines"
+ raise SystemExit(
+ f"ltx-2-mlx exposes no {want} among {names!r} — the installed pin may "
+ "be too old or too new for this bridge."
+ )
+
+
+def _first_module_with_attr(attr: str, *modnames: str):
+ """Return the first importable module exposing `attr`, or None.
+
+ Best-effort sibling to _resolve_pipeline for module-level symbols: the
+ extend denoise loop lives in `extend` on pre-rename pins and in `retake` on
+ v0.14.x. Unlike _resolve_pipeline this returns None instead of raising —
+ callers treat a miss as "feature unavailable at this pin" and degrade.
+ """
+ for modname in modnames:
+ try:
+ mod = importlib.import_module(modname)
+ except ImportError:
+ continue
+ if hasattr(mod, attr):
+ return mod
+ return None
+
+
+def _rate_kwarg_name(func) -> str | None:
+ """Which output frame-rate keyword `func` accepts: 'frame_rate', 'fps', or None.
+
+ v0.14.x renamed the output-rate parameter from `fps` to `frame_rate` across
+ generate_and_save / _decode_and_save_video. Inspecting the live signature
+ lets one call site feed either API. Only an *explicit* parameter counts — a
+ bare **kwargs is not treated as accepting the rate, so we never smuggle an
+ unknown keyword through.
+ """
+ try:
+ params = inspect.signature(func).parameters
+ except (TypeError, ValueError):
+ return None
+ if "frame_rate" in params:
+ return "frame_rate"
+ if "fps" in params:
+ return "fps"
+ return None
+
+
+def _rate_kwargs(func, fps: float) -> dict:
+ """Return {<rate-keyword>: fps} for `func`, or {} if it takes neither.
+
+ New pins require `frame_rate` on generate_and_save (keyword-only, no
+ default), so passing it is mandatory there; old pins where the rate is
+ bound via bind_output_fps instead return {} and rely on that wrapper.
+ """
+ name = _rate_kwarg_name(func)
+ return {name: fps} if name else {}
+
+
_EXTEND_TC_CONFIG: dict | None = None
_A2V_TC_CONFIG: dict | None = None
_EXTEND_TC_PATCH_OK = False
@@ -77,26 +167,39 @@ _A2V_TC_PATCH_OK = False
def _install_guided_denoise_teacache_patches() -> None:
- """Wire TeaCache into Extend and A2V Stage-1 denoise loops.
-
- `ExtendPipeline` (ltx_pipelines_mlx.extend) and `AudioToVideoPipeline`
- (ltx_pipelines_mlx.a2vid_two_stage) each `from ...samplers import
- guided_denoise_loop` into their OWN module namespace and call it without a
- `teacache=` argument. We must patch the symbol on *those two modules*
- specifically — patching any other module (e.g. `retake`) leaves the real
- call site untouched and silently no-ops. We then activate the controller
- only while the matching runner has a per-call config set.
+ """Wire TeaCache into the Extend and A2V Stage-1 denoise loops.
+
+ The extend pipeline and `A2VidPipelineTwoStage` (ltx_pipelines_mlx.
+ a2vid_two_stage) each `from ...samplers import guided_denoise_loop` into
+ their OWN module namespace and call it without a `teacache=` argument. We
+ must patch the symbol on *those exact modules* — patching any other module
+ leaves the real call site untouched and silently no-ops. We then activate
+ the controller only while the matching runner has a per-call config set.
+
+ The extend denoise loop lives in different modules across pins: pre-rename
+ pins call it from `ltx_pipelines_mlx.extend`; v0.14.x deletes that module
+ and the extend path runs through `ltx_pipelines_mlx.retake`. We resolve
+ whichever module actually exposes `guided_denoise_loop` (preferring `extend`
+ so pre-rename behavior is unchanged), matching how run_extend resolves
+ ExtendPipeline before RetakePipeline.
"""
global _EXTEND_TC_PATCH_OK, _A2V_TC_PATCH_OK
try:
import ltx_pipelines_mlx.a2vid_two_stage as a2v_mod
- import ltx_pipelines_mlx.extend as extend_mod
from ltx_pipelines_mlx.ti2vid_two_stages import (
_build_teacache_controller as build_stage1_teacache,
)
except Exception:
return
+ extend_mod = _first_module_with_attr(
+ "guided_denoise_loop",
+ "ltx_pipelines_mlx.extend",
+ "ltx_pipelines_mlx.retake",
+ )
+ if extend_mod is None:
+ return
+
original_extend_guided_denoise_loop = extend_mod.guided_denoise_loop
original_a2v_guided_denoise_loop = a2v_mod.guided_denoise_loop
@@ -242,24 +345,49 @@ def parse_args() -> argparse.Namespace:
def bind_output_fps(pipe, fps: float) -> None:
- """Make pipeline generate_and_save() calls decode at the requested FPS."""
+ """Make pipeline _decode_and_save_video() calls decode at the requested rate.
+
+ The output-rate keyword is `frame_rate` on v0.14.x pins and `fps` on
+ pre-rename pins; we bind whichever the live method accepts. We inject the
+ rate only when the caller hasn't already supplied it, so a generate_and_save
+ that threads `frame_rate=` through to the decoder internally isn't
+ double-set.
+ """
decode_and_save = pipe._decode_and_save_video
+ rate_name = _rate_kwarg_name(decode_and_save)
- def decode_with_fps(video_latent, audio_latent, output_path, fps=fps):
- return decode_and_save(video_latent, audio_latent, output_path, fps=fps)
+ def decode_with_fps(video_latent, audio_latent, output_path, **kwargs):
+ if rate_name and rate_name not in kwargs:
+ kwargs[rate_name] = fps
+ return decode_and_save(video_latent, audio_latent, output_path, **kwargs)
pipe._decode_and_save_video = decode_with_fps
def configure_image_strength(image_strength: float | None) -> None:
- """Thread PortOS' I2V strength into ltx-2-mlx conditioning constructors."""
+ """Thread PortOS' I2V strength into ltx-2-mlx conditioning constructors.
+
+ Pre-rename pins drive first-frame conditioning through a module-level
+ `VideoConditionByLatentIndex` symbol on ti2vid_one_stage that we subclass to
+ inject the requested strength. v0.14.x reworked image conditioning and no
+ longer exposes that hook, so on those pins we surface a clear notice and
+ leave strength at the pipeline default rather than silently pretending the
+ value applied (distinguish "applied" from "couldn't apply").
+ """
if image_strength is None:
return
if image_strength < 0.0 or image_strength > 1.0:
raise SystemExit("--image-strength must be between 0.0 and 1.0")
- from ltx_core_mlx.conditioning.types.latent_cond import VideoConditionByLatentIndex as BaseCondition
from ltx_pipelines_mlx import ti2vid_one_stage
+ if not hasattr(ti2vid_one_stage, "VideoConditionByLatentIndex"):
+ emit_status(
+ "--image-strength not supported at this ltx-2-mlx pin "
+ "(reworked image conditioning) — using pipeline default"
+ )
+ return
+
+ from ltx_core_mlx.conditioning.types.latent_cond import VideoConditionByLatentIndex as BaseCondition
class PortOSVideoCondition(BaseCondition):
def __init__(self, frame_indices, clean_latent, strength=1.0):
@@ -268,15 +396,37 @@ def configure_image_strength(image_strength: float | None) -> None:
ti2vid_one_stage.VideoConditionByLatentIndex = PortOSVideoCondition
try:
from ltx_pipelines_mlx import ti2vid_two_stages
- ti2vid_two_stages.VideoConditionByLatentIndex = PortOSVideoCondition
+ if hasattr(ti2vid_two_stages, "VideoConditionByLatentIndex"):
+ ti2vid_two_stages.VideoConditionByLatentIndex = PortOSVideoCondition
except ImportError:
pass
emit_status(f"Using image strength {image_strength:g}")
+def _one_stage_kwargs(args: argparse.Namespace, **extra) -> dict:
+ """Shared generate_and_save kwargs for the one-stage text/image runners.
+
+ Omits num_steps when --steps is unset so each pin applies its own default —
+ the new TI2VidOneStagePipeline types num_steps as a non-optional int and
+ would choke on an explicit None.
+ """
+ kwargs: dict = dict(
+ prompt=args.prompt,
+ output_path=args.output,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ seed=args.seed,
+ **extra,
+ )
+ if args.steps is not None:
+ kwargs["num_steps"] = args.steps
+ return kwargs
+
+
def run_two_stage(args: argparse.Namespace, image: str | None = None) -> str:
"""T2V/I2V path that honors CFG via the dgrauet two-stage pipeline."""
- from ltx_pipelines_mlx import TwoStagePipeline
+ TwoStagePipeline = _resolve_pipeline("TI2VidTwoStagesPipeline", "TwoStagePipeline")
emit_status(f"Loading two-stage pipeline ({args.model})…")
emit_stage(1, 0, 1, "Loading model")
pipe = TwoStagePipeline(
@@ -300,27 +450,23 @@ def run_two_stage(args: argparse.Namespace, image: str | None = None) -> str:
stage1_steps=args.steps if args.steps is not None else 30,
stage2_steps=args.stage2_steps,
cfg_scale=args.cfg_scale if args.cfg_scale is not None else 3.0,
+ **_rate_kwargs(pipe.generate_and_save, args.fps),
)
def run_text(args: argparse.Namespace) -> str:
if args.cfg_scale is not None:
return run_two_stage(args)
- from ltx_pipelines_mlx import TextToVideoPipeline
+ OneStagePipeline = _resolve_pipeline("TI2VidOneStagePipeline", "TextToVideoPipeline")
emit_status(f"Loading T2V pipeline ({args.model})…")
emit_stage(1, 0, 1, "Loading model")
- pipe = TextToVideoPipeline(model_dir=args.model, gemma_model_id=args.gemma)
+ pipe = OneStagePipeline(model_dir=args.model, gemma_model_id=args.gemma)
bind_output_fps(pipe, args.fps)
emit_stage(1, 1, 1, "Loaded")
emit_status("Generating T2V…")
return pipe.generate_and_save(
- prompt=args.prompt,
- output_path=args.output,
- height=args.height,
- width=args.width,
- num_frames=args.num_frames,
- seed=args.seed,
- num_steps=args.steps,
+ **_one_stage_kwargs(args),
+ **_rate_kwargs(pipe.generate_and_save, args.fps),
)
@@ -330,24 +476,18 @@ def run_image(args: argparse.Namespace) -> str:
if not args.image:
raise SystemExit("--image is required for image mode")
return run_two_stage(args, image=args.image)
- from ltx_pipelines_mlx import ImageToVideoPipeline
if not args.image:
raise SystemExit("--image is required for image mode")
+ OneStagePipeline = _resolve_pipeline("TI2VidOneStagePipeline", "ImageToVideoPipeline")
emit_status(f"Loading I2V pipeline ({args.model})…")
emit_stage(1, 0, 1, "Loading model")
- pipe = ImageToVideoPipeline(model_dir=args.model, gemma_model_id=args.gemma)
+ pipe = OneStagePipeline(model_dir=args.model, gemma_model_id=args.gemma)
bind_output_fps(pipe, args.fps)
emit_stage(1, 1, 1, "Loaded")
emit_status("Generating I2V…")
return pipe.generate_and_save(
- prompt=args.prompt,
- output_path=args.output,
- image=args.image,
- height=args.height,
- width=args.width,
- num_frames=args.num_frames,
- seed=args.seed,
- num_steps=args.steps,
+ **_one_stage_kwargs(args, image=args.image),
+ **_rate_kwargs(pipe.generate_and_save, args.fps),
)
@@ -408,7 +548,7 @@ def run_fflf(args: argparse.Namespace) -> str:
uses this for character continuity, cross-shot anchoring, and
compositional control.
"""
- from ltx_pipelines_mlx import KeyframeInterpolationPipeline
+ KeyframeInterpolationPipeline = _resolve_pipeline("KeyframeInterpolationPipeline")
keyframe_images, keyframe_indices = _resolve_keyframes(args)
# Keyframe interpolation needs the dev (non-distilled) transformer +
# the distilled LoRA fused on top for stage 2. Defaults match the file
@@ -436,11 +576,11 @@ def run_fflf(args: argparse.Namespace) -> str:
height=args.height,
width=args.width,
num_frames=args.num_frames,
- fps=args.fps,
seed=args.seed,
stage1_steps=args.steps,
stage2_steps=args.stage2_steps,
cfg_scale=args.cfg_scale if args.cfg_scale is not None else 3.0,
+ **_rate_kwargs(pipe.generate_and_save, args.fps),
)
@@ -451,8 +591,12 @@ def run_extend(args: argparse.Namespace) -> str:
free DiT + text encoder before decode (otherwise OOMs at the VAE pass).
"""
global _EXTEND_TC_CONFIG
- from ltx_pipelines_mlx import ExtendPipeline
from ltx_core_mlx.utils.memory import aggressive_cleanup
+ # Pre-rename pins: ExtendPipeline.extend_from_video; v0.14.x folds extend
+ # into RetakePipeline.extend_from_video (and deletes the extend module).
+ ExtendPipeline = _resolve_pipeline(
+ "ExtendPipeline", "RetakePipeline", method="extend_from_video"
+ )
if not args.extend_from_video:
raise SystemExit("--extend-from-video is required for extend mode")
emit_status(f"Loading Extend pipeline ({args.model})…")
@@ -505,7 +649,7 @@ def run_a2v(args: argparse.Namespace) -> str:
way ImageToVideoPipeline does, so motion + audio sync to a chosen still.
"""
global _A2V_TC_CONFIG
- from ltx_pipelines_mlx import AudioToVideoPipeline
+ AudioToVideoPipeline = _resolve_pipeline("A2VidPipelineTwoStage", "AudioToVideoPipeline")
if not args.audio:
raise SystemExit("--audio is required for a2v mode")
emit_status(f"Loading A2V pipeline ({args.model})…")
@@ -527,12 +671,12 @@ def run_a2v(args: argparse.Namespace) -> str:
height=args.height,
width=args.width,
num_frames=args.num_frames,
- fps=args.fps,
seed=args.seed,
stage1_steps=stage1_steps,
stage2_steps=args.stage2_steps,
cfg_scale=args.cfg_scale if args.cfg_scale is not None else 3.0,
audio_start_time=args.audio_start,
+ **_rate_kwargs(pipe.generate_and_save, args.fps),
)
finally:
_A2V_TC_CONFIG = None
diff --git a/scripts/setup-image-video.sh b/scripts/setup-image-video.sh
index 4747e00523..f8c2bb1e3e 100755
--- a/scripts/setup-image-video.sh
+++ b/scripts/setup-image-video.sh
@@ -150,10 +150,15 @@ if [[ "$INSTALL_LTX2" == "1" ]]; then
echo "❌ INSTALL_LTX2=1 requires git." >&2
exit 1
fi
- # Pinned to a known-good commit (2026-05-05). To upgrade: bump this SHA
- # and verify with PortOS's video gen smoke tests. Set LTX2_PIN=main to
- # bypass the pin and track upstream HEAD for development.
- LTX2_PIN="${LTX2_PIN:-f8f20c83ab7e2e929f3196f07ec5232ad1660bab}"
+ # Pinned to v0.14.8 (2026-05-22). To upgrade: bump this SHA and verify with
+ # PortOS's video gen smoke tests (text/image/fflf/extend/a2v). Set
+ # LTX2_PIN=main to bypass the pin and track upstream HEAD for development.
+ # NOTE: v0.14.x renamed every public pipeline class (TextToVideoPipeline →
+ # TI2VidOneStagePipeline, ExtendPipeline → RetakePipeline, etc.) and switched
+ # the output-rate kwarg from `fps` to `frame_rate`. generate_ltx2.py resolves
+ # pipeline classes and the rate kwarg defensively so it works against this pin
+ # AND older pre-rename pins an install may still have checked out.
+ LTX2_PIN="${LTX2_PIN:-d2ad8e9948157c14a063aca54e510d3d80c2c463}"
LTX2_DIR="${HOME}/.portos/ltx-2-mlx"
LTX2_PY="${LTX2_DIR}/.venv/bin/python3"
mkdir -p "${HOME}/.portos"