Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

release(v4.0.5): Turbo installs again, the dead speed control is gone, and a real one takes its place

mrbizarroa0f6860af72c
diff --git a/VERSION b/VERSION
index c5106e6..7636e75 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.0.4
+4.0.5
diff --git a/docs/STATE.md b/docs/STATE.md
index 96c07cb..1b77582 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -1,5 +1,7 @@
# Phosphene — project state, history, open work
+> **🔧 2026-08-14 night — v4.0.5 ASSEMBLED on dev/beta (`65880b3` + version `66f0dbd`), HELD for the owner's word.** The two recovered audits' punch-list, closed in one campaign. (1) **H3 Turbo install is LIVE again**: the v1.0 runner-layout repack is a published release asset on `weights-ltx25-v1` (sha256 `d51d626f…`, verified byte-identical against the local repack the selection was graded on); `/h3/turbo/install` streams it partial→verify→atomic-rename, `install_h3.js` fetches the same asset best-effort via `scripts/fetch_h3_turbo.py` (resumable, digest-checked, short Pinokio-safe lines), and the retired **ckpt500-EMA is accepted again as the LAST fallback** — dropping it in 4.0.4 un-Turboed installs that rendered fine on it. Raw v0.1 stays refused by name. Turbo gate 5→11 tests incl. script↔panel pin parity. (2) **The dead HQ Speed control is gone** (skip-step fields were dropped at the engine boundary; both pills ran identical settings under a "~12% faster" claim), and the collapsed summary stops printing "exact speed" from the retired accel input. (3) **The real speed control**: the engine's 2.5-only `fast` schedule preset (F6S2, 5+2 forwards, owner-graded, **a different take**) wired end to end — Speed pills → `schedule_preset` → make_job (lane-gated: dropped with a sentence on 2.3/HQ/H3) → helper → `generate_two_stage`; tier cells carry `fast_eta` (cost-model 5+2/8+2 ratio, so fixed costs aren't discounted), chips re-price while Fast is armed, and Load Params round-trips it from day one (`test_schedule_preset.py`, 8). (4) **Geometry truth**: make_job floors LTX canvases to the two-stage engine's /64 grid and frames to 8k+1 (floored, never raised) and pushes a sentence when it does; dims inputs step by 64; warnings state what WILL render; H3 tier-cell geometry untouched (`test_geometry_grid.py`, 6). (5) **Load Params restores the cast** (owner-reported): the fire-and-forget IIFE is replaced by an awaited restore through `applyCharacterSelection()` — the new non-toggling hydrator — with visible failure when the character left the library; quality chip by the sidecar's own token, explicit `no_voice` with touched provenance, Extend's four fields, STG (absence = Off), and the Length chip repaints after programmatic frame assignment. A hidden checked No-voice can no longer rewrite a plain render (submit gated on a cast; every hide path clears the box). (6) **One health cluster**: the six machine-state pills live in a single bordered container that is the header's only shrinkable region — narrow windows degrade it to colored state dots, then collapse it; the creator avatar is never clipped again. (7) **Stale-process pill**: `/version` compares HEAD-on-disk to HEAD-at-boot each poll; a promote landing under a running panel renders "Restart to finish update" — **validated live**: the dev panel booted at `90b8a6e` reported `stale_process: true` the moment `65880b3` landed. (8) Keyframe sidecars stamp the resolved q8 pack, not the 2.3-defaulting `MODEL_ID_HQ`. **Gates all green at the tree** (pinokio scripts 377/500 worst · ltx pin unmoved at `v0.14.19+ltx25.4` · post_update · registry 169 · schedules 45 · character round-trip 35 · lora_compat · stage_live_preview · spicy · turbo 11 · schedule_preset 8 · geometry 6 · storyboard suites · py_compile · page parse). **Known-remaining / descoped**: the owner's "stray −1 bar" did not reproduce in either live panel's idle state (needs a screenshot the moment it appears); HDR Load-Params restore is moot while the HDR pill ships commented out (roadmap-parked); render validation of the fast preset + Turbo v1.0 timing run deferred until the GPU frees (the eltrumpo retrain holds both locks overnight). **Audit sources**: `~/AI/projects/phosphene/notes/customize_audit_2026-08-14.md` + `journey_audit_2026-08-14.md` (recovered from the sandboxed sessions' stdout; the FIELD REGISTRY campaign spec in the journey audit is the post-4.0.5 systemic fix).
+
**Public release: `v4.0.4`** (2026-08-14 — the live preview leaves the postage stamp and plays full-size on the main stage; the Spicy option follows the Settings switch on both engines; H3's Turbo adapter selection moves to LightX2V v1.0 768p and its automatic install is paused until the repack is published. Carries v4.0.3's picker-LoRA crash fix and the v4.0.2 content: the 720p High tier, i2v that animates the image you gave it, characters on the engine's native runtime-LoRA route, and the vendored pin at `v0.14.19+ltx25.4`; see the entries below. The narrative in this paragraph stops at v3.1.1 and is kept as history). **The 2.3/2.5 divergence that ran through the v3.8.x line was closed by v4.0.0** — LTX-2.5 is the registered default and the vendored port is pinned at the tag `v0.14.19+ltx25.4`. v3.8.x registered 2.3 only and pinned `871694d`, because the 2.5 packs were not publicly downloadable at cut time; they are now. See `CLAUDE.md`'s pin table. The entire v3.0 line shipped — v3.0.0 (Characters / Voice / Image Studio / A2V, May 23) → v3.0.1 (FFLF crash fix) → v3.0.2 (Boost/Turbo accel restored after a 2-month silent regression) → v3.0.3 (HiDream hidden, #15) → v3.0.4 (CivitAI SSL) → v3.0.5 (A2V kwarg signature shim, #5) → v3.0.6 (deep-review hardening) → v3.0.7 (GPU-race fix + /status version surfacing) → **v3.0.8 (ltx-2-mlx v0.14.8 catch-up — codec-only patches, I2V "mosaic"/Metal-watchdog fix #17, ASCII version-skew handshake fix)** → **v3.0.9 (custom I2V Width×height inputs restored for power users; Train-tab dev-transformer Download "unknown install key" fix — form-encoding, reported by @cocktailpeanut)** → **v3.0.10 (model-integrity self-heal — boot scan + `/status.model_integrity` + a one-click Repair banner for corrupt/partial weights, the leading *non-Metal* "mosaic" garbage-decode cause; safetensors header+size check)** → **v3.0.11 (latent helper-handshake hang fixed: `_read_until` mixed `select()` on the raw fd with a buffered `readline()`, so any event the helper emitted *right before* `ready` — a version-skew line, the new runtime fingerprint — got stranded in the TextIOWrapper buffer and the panel hung 120 s → "helper failed to start: None". This is the true root cause behind the mislabeled "⚠️-emoji" handshake break. Now reads the raw fd via `os.read()` into a carry buffer and drains every complete line before re-`select()`-ing. PLUS: every render log self-documents its runtime — mlx/mlx-metal version + Apple chip + macOS — surfaced in `/status`, the `helper ready ·` line, and a standalone `runtime |` line, the exact data needed to triangulate the remaining MLX-numerical "mosaic")** → **v3.0.12 (the REAL mosaic fix + 3 more. The mosaic is NOT a code bug or the missing-upscaler theory (both disproved by local repro — the bare 6-file Q4 set renders byte-identical-clean on M4 Max); it's stale/corrupt weight *content* — right size, wrong bytes — that v3.0.10's header+size check can't see (confirmed: ronyeoh/#18 + claude3d/#5 fixed it only by a fresh full re-download). Added **deep checksum verify vs upstream**: Settings → Model files → "Verify model files (checksum)" / `/models/verify-deep` hashes every weight + compares to HuggingFace's published SHA-256 (proven to match local), mismatches feed the existing one-click Repair re-download. Validated: flipped 16 bytes mid-file → header+size passed, deep-verify caught it. ALSO in v3.0.12: character-LoRA-shows-as-"style-only" fix (#5 — `list_user_loras` recovers trigger+kind from the `_v2` filename when the sidecar is missing); `cgi`→`email` multipart migration (Python-3.13-ready, removes the boot DeprecationWarning, adopted from @ssfeather's PR #22); dynamic 3–8 multi-keyframe UI (adopted from @youngbee12's PR #20, ported clean with the integrity feature preserved + a JS ReferenceError fixed). Folds in v3.0.11's handshake fix + runtime fingerprint.)** → **v3.0.13 (character LoRA fixes, #5 @claude3d: a multi-word/spaced character filename no longer mislabels as style-only — the id regex gated out spaces before the sidecar was read; and the Character tab no longer silently falls back to plain T2V — a UI desync left the avatar's selection ring lit after `character_id` was cleared. Plus an `enhancePrompt` element-id fix. Cherry-picked to prod `ce03139`, release `814dc2d`.)** → **v3.1.0 (Ideogram 4 — open-weight 9.3B text-rendering image model + a visual text-placement canvas that places exact text via normalized-bbox captions. mflux 0.18 `mflux-generate-ideogram4`; gated `ideogram-ai/ideogram-4-fp8` ~26 GB, needs a HF Read token + license. Fixed the gated-download 401 that would have hit EVERY user — the panel now exports its configured token to subprocess env via `_sync_hf_token_to_env` so a stale `hf auth login` cache can't shadow it; proven clean-room. Validated end-to-end: 8-text-element field-guide poster rendered clean, every label placed per its bbox.)** → **v3.1.1 (Ideogram output-card buttons hotfix, reported by Mr Bizarro: an Ideogram image's prompt is a caption JSON, which broke every output surface that fed it into a plain box / inline onclick — the Recent-list Animate button was worked-but-dead because apostrophes/&/< in the caption terminated the single-quoted onclick. Display-layer fix: `_displayPromptFor` derives `high_level_description`, `escapeHtml` the onclick args, friendly `_imgEngineLabel`, and `loadParams` restores an Ideogram image into the visual canvas instead of dumping JSON. `params.prompt` stays the caption JSON; renders unaffected. Validated live.)** All validated end-to-end on the dev panel (deep-verify corrupt-detect + repair, /loras, byte-identical upload, multi-keyframe render, FFLF regression). See §4 for the full version history. The May-17 Codex C+ UI restructure (capability tiers, Q4 surface, Character as 5th mode pill, accel kill, HQ-speed move) and the Train-tab / LoRA-chrome work that followed are all baseline now, folded into v3.0.x. There is no `v2.0.6` tag.
> **🎬 2026-08-14 — v4.0.4: the forming take plays on the MAIN STAGE.** The live preview existed since v3.7 and lived in a postage stamp next to the queue, which is not where anyone looks while they wait. It now takes the big player.
diff --git a/install_h3.js b/install_h3.js
index 1ee6c6b..60150fe 100644
--- a/install_h3.js
+++ b/install_h3.js
@@ -223,28 +223,36 @@ module.exports = {
}
},
- // ---- Turbo v1.0 release asset (publication TODO; no fetch yet) ---------
- // LightX2V publishes the Apache-2.0 source, but the H3 runner cannot load
- // that diffusers-layout file directly: its alpha/rank scale lives outside
- // the checkpoint. A raw download would therefore be a successful install
- // followed by coloured noise at `--lora ...:1.0`, which is worse than a
- // loud missing-asset state.
- //
- // TODO(release asset): repack and publish EXACTLY:
- // target: lightx2v_v1.0_768p_ourlayout.safetensors
- // source repo: lightx2v/Minimax-h3-Turbo (Apache-2.0)
- // source file: minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors
- // source SHA-256:
- // 1bdabc2e9fce20b1db563b96bcf6e46adcad4c1964f423676436bf266cc7416c
- // release-asset SHA-256: REQUIRED BEFORE WIRING (record the digest of
- // the finished `lightx2v_v1.0_768p_ourlayout.safetensors` here)
- //
- // Once published, add a digest-checked release fetch into:
- // {{cwd}}/mlx_models/hailuo-h3/models/turbo-lora/
+ // ---- Turbo v1.0 release asset (digest-checked fetch) -------------------
+ // Target: lightx2v_v1.0_768p_ourlayout.safetensors — the runner-layout
+ // repack, published as a release asset on the weights-ltx25-v1 lane,
+ // digest-pinned. Provenance: repacked from
+ // lightx2v/Minimax-h3-Turbo (Apache-2.0),
+ // minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors (source SHA-256
+ // 1bdabc2e9fce20b1db563b96bcf6e46adcad4c1964f423676436bf266cc7416c).
// Do not substitute the raw v0.1 file
- // `minimax_h3_fl2v_turbo_4step_v0.1.safetensors`. The ONLY accepted v0.1
- // fallback is the already alpha-folded release name
+ // `minimax_h3_fl2v_turbo_4step_v0.1.safetensors`: its alpha/rank scale
+ // lives OUTSIDE the checkpoint and at `--lora ...:1.0` it renders
+ // coloured noise. The ONLY accepted v0.1 fallback is the alpha-folded
// `lightx2v_v0.1_ourlayout_alpha8.safetensors`.
+ //
+ // BEST-EFFORT ON PURPOSE: the panel's /h3/turbo/install endpoint fetches
+ // this same asset on demand with the same digest check, so a transient
+ // network failure here must not fail a 75 GB install that is otherwise
+ // complete. scripts/fetch_h3_turbo.py resumes partials, verifies
+ // SHA-256 d51d626fe0845da7e5845a47c323cf3f29086d44d24cb1a4b980882488746197
+ // and renames into place only after the check — a corrupt transfer is
+ // deleted, never installed. (One short line per command: Pinokio 8.0.x
+ // wedges its shell on ~350+ character lines.)
+ {
+ method: "shell.run",
+ params: {
+ path: "minimax-h3-mlx",
+ message: [
+ ".venv/bin/python '{{cwd}}/scripts/fetch_h3_turbo.py' --dir '{{cwd}}/mlx_models/hailuo-h3/models/turbo-lora' || echo 'TURBO FETCH FAILED - panel offers a one-click retry'"
+ ]
+ }
+ },
// ---- TAE: the fast draft decoder (~23 MB) ------------------------------
// H3's video decoder is a 36-layer ViT and it is the biggest FIXED cost in
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 8907050..b43c085 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -420,11 +420,10 @@ MODEL_VERSIONS: tuple[dict, ...] = (
# barely locks identity. On 2.5 the reasoning INVERTS: the recipe the
# owner graded — "insane quality", voice PASS by ear — is q8 + the
# DISTILLED pipeline at 1024x576x121, and every graded 2.5 character
- # clip in the campaign ran that path. Forcing "high" would route
- # characters onto a pipeline nobody has graded them on AND charge a
- # 29.5 GB add-on for a result the q8 pack already delivers, in 139 s
- # instead of 246 s. It lives in the registry so the two generations do
- # not each own a copy of the rule and the markup never decides it.
+ # clip in the campaign ran that path. High is now a separately graded,
+ # explicit option; it must not replace this faster default or silently
+ # charge a 29.5 GB add-on. The default lives in the registry so the two
+ # generations do not each own a copy of the rule.
"character_quality": "balanced",
# NOT optional and NOT interchangeable with 2.3's. 2.5 conditions on a
# Gemma 4 12B fine-tune (`gemma4_unified`); the vendored tower refuses
@@ -2322,14 +2321,92 @@ def _train_install_dev_transformer(push_log) -> dict:
"filename": "transformer-dev.safetensors"}
-def _h3_install_turbo(push_log) -> dict:
- """Refuse an unpinned Turbo repack download rather than install raw weights.
+# One in-flight Turbo fetch at a time, mirroring the sample-character lane:
+# a daemon thread streaming to .partial, sha256 + exact-size verified, and an
+# atomic rename so a killed download never leaves a file h3_turbo_paths()
+# would resolve. status: idle | downloading | done | error.
+_h3_turbo_dl_lock = threading.Lock()
+# total_mb is a plain literal here because the H3_TURBO_ASSET_* pins are
+# declared with the rest of the Turbo constants further down; every writer
+# below stamps the real total at runtime.
+_h3_turbo_dl_state: dict = {"status": "idle", "mb": 0, "total_mb": 0,
+ "error": None}
+
+
+def _set_h3_turbo_dl(**kw) -> None:
+ with _h3_turbo_dl_lock:
+ _h3_turbo_dl_state.clear()
+ _h3_turbo_dl_state.update(kw)
+
+
+def _h3_turbo_download_bg(target_dir, push_log) -> None:
+ """Stream the digest-pinned v1.0 repack release asset into the H3 pack."""
+ import urllib.request
+ import hashlib
+ total_mb = H3_TURBO_ASSET_BYTES // (1 << 20)
+ tmp = None
+ try:
+ target_dir.mkdir(parents=True, exist_ok=True)
+ target = target_dir / H3_TURBO_LORA_FILE
+ if target.is_file():
+ _set_h3_turbo_dl(status="done", mb=total_mb, total_mb=total_mb,
+ error=None)
+ return
+ tmp = target.with_suffix(target.suffix + ".partial")
+ push_log(f"[h3:turbo] downloading {H3_TURBO_LORA_FILE} "
+ f"(~{total_mb} MB)…")
+ req = urllib.request.Request(H3_TURBO_ASSET_URL,
+ headers={"User-Agent": "Phosphene"})
+ h = hashlib.sha256()
+ written = 0
+ last_log = 0.0
+ with urllib.request.urlopen(req, timeout=60) as resp, \
+ open(tmp, "wb") as fh:
+ while True:
+ chunk = resp.read(1 << 20)
+ if not chunk:
+ break
+ fh.write(chunk)
+ h.update(chunk)
+ written += len(chunk)
+ now = time.time()
+ if now - last_log > 2.5:
+ _set_h3_turbo_dl(status="downloading",
+ mb=written // (1 << 20),
+ total_mb=total_mb, error=None)
+ push_log(f"[h3:turbo] {written // (1 << 20)} / "
+ f"{total_mb} MB")
+ last_log = now
+ if written != H3_TURBO_ASSET_BYTES:
+ raise RuntimeError(
+ f"size mismatch: got {written}, expected "
+ f"{H3_TURBO_ASSET_BYTES} — please retry")
+ if h.hexdigest() != H3_TURBO_ASSET_SHA256:
+ raise RuntimeError("checksum mismatch (download corrupt) — "
+ "please retry")
+ tmp.replace(target)
+ _set_h3_turbo_dl(status="done", mb=total_mb, total_mb=total_mb,
+ error=None)
+ push_log(f"[h3:turbo] adapter installed → {target}")
+ except Exception as e: # noqa: BLE001
+ if tmp is not None:
+ try:
+ tmp.unlink()
+ except OSError:
+ pass
+ _set_h3_turbo_dl(status="error", mb=0, total_mb=total_mb,
+ error=str(e)[:200])
+ push_log(f"[h3:turbo] FAILED: {e}")
- LightX2V publishes the Apache-2.0 source adapter, but the H3 runner needs
- the panel's repacked layout. The v1.0 release asset and its output SHA-256
- have not been published yet, so there is deliberately no URL to execute.
- install_h3.js carries the exact source/target publication TODO. Once that
- asset exists, this endpoint can use the ordinary guarded release fetch.
+
+def _h3_install_turbo(push_log, download_fn=None) -> dict:
+ """Fetch the digest-pinned runner-layout Turbo adapter on demand.
+
+ The v1.0 repack is a published release asset with a pinned SHA-256
+ (H3_TURBO_ASSET_SHA256, verified byte-identical against the repack the
+ adapter selection was graded on). The raw LightX2V v0.1 file is still
+ refused by name in the resolver: its alpha/rank factor lives outside the
+ checkpoint, and at scale 1.0 it renders coloured noise.
"""
paths = h3_paths()
if paths["missing"]:
@@ -2344,16 +2421,23 @@ def _h3_install_turbo(push_log) -> dict:
"from the Phosphene sidebar in Pinokio to update the "
"clone — it keeps every weight already on disk."}
target = _h3_turbo_dir()
- message = (
- "Automatic H3 Turbo install is paused until the runner-layout release "
- f"asset {H3_TURBO_LORA_FILE} is published with a pinned SHA-256. "
- f"Upstream source: {H3_TURBO_REPO}/{H3_TURBO_SOURCE_FILE} "
- f"(SHA-256 {H3_TURBO_SOURCE_SHA256}). Do not substitute "
- f"{H3_TURBO_RAW_V01_FILE}: raw v0.1 renders coloured noise at scale "
- f"1.0. Expected the repack under {target}."
- )
- push_log(f"[h3:turbo] {message}")
- return {"ok": False, "error": message, "dir": str(target)}
+ if (target / H3_TURBO_LORA_FILE).is_file():
+ return {"ok": True, "started": False, "already_installed": True,
+ "dir": str(target)}
+ with _h3_turbo_dl_lock:
+ if _h3_turbo_dl_state.get("status") == "downloading":
+ return {"ok": False,
+ "error": "a Turbo adapter download is already active"}
+ _h3_turbo_dl_state.clear()
+ _h3_turbo_dl_state.update(status="downloading", mb=0,
+ total_mb=H3_TURBO_ASSET_BYTES // (1 << 20),
+ error=None)
+ fn = download_fn or _h3_turbo_download_bg
+ threading.Thread(target=fn, args=(target, push_log), daemon=True,
+ name="h3-turbo-download").start()
+ return {"ok": True, "started": True, "dir": str(target),
+ "asset": H3_TURBO_ASSET_URL, "sha256": H3_TURBO_ASSET_SHA256,
+ "bytes": H3_TURBO_ASSET_BYTES}
# Compatibility taxonomy for LoRAs across the panel's two render lanes
@@ -3168,7 +3252,8 @@ _CHARACTER_QUALITY_RESOLUTION = {
# to, so this chip advertised a canvas it never delivered either.
"draft": (704, 384), # ~3:30 wall for 7s, Q8, lower per-frame detail
"balanced": (1024, 576), # reserved for a real fast-but-quality-equal tier
- "high": (1024, 576), # locked production recipe
+ "high": (1024, 576), # two-stage HQ character option
+ "high_720p": (1280, 704), # two-stage HQ at the native 720p delivery canvas
}
@@ -3448,9 +3533,25 @@ def version_check_loop() -> None:
def get_version_state() -> dict:
"""Snapshot of _VERSION_STATE for the /version endpoint. Returns a copy
- so the caller can't mutate the live state under the lock."""
+ so the caller can't mutate the live state under the lock.
+
+ STALE-PROCESS DETECTION (v4.0.5): local_* is the boot snapshot, so a
+ checkout that advances UNDER a running panel — a promote landing while a
+ long-lived daemon serves, the exact 2026-08-14 incident where :8198
+ served pre-4.0.4 HTML for three hours after the folder updated — used to
+ be invisible: /version reported the boot SHA and nothing compared it to
+ disk. One git rev-parse per /version request (the pill polls every 5
+ minutes) answers the only question that matters: is the code on disk the
+ code this process loaded?"""
with _VERSION_LOCK:
- return dict(_VERSION_STATE)
+ snap = dict(_VERSION_STATE)
+ disk_sha = _git_capture(["rev-parse", "HEAD"])
+ boot_sha = snap.get("local_sha")
+ snap["stale_process"] = bool(disk_sha and boot_sha and disk_sha != boot_sha)
+ if snap["stale_process"]:
+ snap["disk_short"] = disk_sha[:7]
+ snap["disk_version"] = _read_local_version()
+ return snap
# ---------------------------------------------------------------------------
@@ -6361,22 +6462,40 @@ H3_TURBO_REPO = "lightx2v/Minimax-h3-Turbo"
H3_TURBO_LORA_FILE = "lightx2v_v1.0_768p_ourlayout.safetensors"
H3_TURBO_FALLBACK_LORA_FILE = "lightx2v_v0.1_ourlayout_alpha8.safetensors"
H3_TURBO_RAW_V01_FILE = "minimax_h3_fl2v_turbo_4step_v0.1.safetensors"
+# The retired ckpt500-EMA adapter is accepted again — LAST, and only as a
+# fallback. v4.0.4 dropped it outright, which un-Turboed every install that had
+# been rendering fine on it, for the crime of not having the newer file yet.
+# It stays behind both LightX2V layouts so a completed v1.0 download always
+# wins, and it carries the fallback flag so the UI labels it honestly.
+H3_TURBO_CKPT500_FILE = "minimax_h3_turbo_4step_ema_ckpt500.safetensors"
H3_TURBO_LORA_CANDIDATES = (
(H3_TURBO_LORA_FILE, "v1.0", False),
(H3_TURBO_FALLBACK_LORA_FILE, "v0.1", True),
+ (H3_TURBO_CKPT500_FILE, "ckpt500-EMA", True),
)
-# Exact upstream source for the v1.0 repack. Automatic installation remains
-# disabled until the runner-layout repack is published as a Phosphene release
-# asset with its own pinned digest; install_h3.js carries the publication TODO.
+# Exact upstream source for the v1.0 repack, kept for provenance.
H3_TURBO_SOURCE_FILE = "minimax_h3_fl2v_turbo_4step_v1.0_768p_bf16.safetensors"
H3_TURBO_SOURCE_SHA256 = (
"1bdabc2e9fce20b1db563b96bcf6e46adcad4c1964f423676436bf266cc7416c"
)
+# The runner-layout repack, published 2026-08-14 as a digest-pinned release
+# asset on the same lane as the LTX-2.5 packs. The digest below was verified
+# against the local repack that core_tan's testing and the owner's visual
+# review selected — byte-identical before the pin was written down.
+H3_TURBO_RELEASE_TAG = "weights-ltx25-v1"
+H3_TURBO_ASSET_URL = (
+ "https://github.com/mrbizarro/Phosphene/releases/download/"
+ + H3_TURBO_RELEASE_TAG + "/" + H3_TURBO_LORA_FILE
+)
+H3_TURBO_ASSET_SHA256 = (
+ "d51d626fe0845da7e5845a47c323cf3f29086d44d24cb1a4b980882488746197"
+)
+H3_TURBO_ASSET_BYTES = 1956165254
H3_TURBO_DIRNAME = "turbo-lora"
# Sigma POINTS, matching --steps. 4 points = 3 forwards = what the adapter was
# distilled for; it is visibly softer at fewer and gains nothing at more.
H3_TURBO_STEPS = 4
-H3_TURBO_DOWNLOAD_GB = 1.4
+H3_TURBO_DOWNLOAD_GB = 2.0 # the published asset is 1,956,165,254 bytes
# Size floors for the "is it really there" probe. An interrupted fetch leaves a
# short file that loads far enough to fail 30 s into a render, which is exactly
# the failure mode the H3-vanish lesson says to catch at status time instead.
@@ -7315,6 +7434,12 @@ def ltx_estimate_minutes(w: int, h: int, frames: int,
# mistake this table exists to prevent. It is a good seed for the model, not a
# measurement.
LTX_MEASURED_ETA: dict[tuple[str, str, str, str], tuple[float, str]] = {
+ # LTX-2.5, q8 + HQ add-on, 1024x576 x 121 @ 10+3 with the trained
+ # character stack intact. The owner has now graded this exact lane and
+ # explicitly unlocked it for Characters. Keep the character chip on this
+ # SAME row the main High tier reads; a second character-only ETA would
+ # immediately drift again.
+ ("ltx25", "high", "5s", "q8"): (4.14, "~4 min"), # 248.5 s, panel path
# LTX-2.5, q8 + HQ add-on, 1280×704 × 121 @ 10+3 — the owner's own render,
# 491.03 s end to end through the panel with a character stack on it
# (mlx_outputs/bizarrotrn_bizarro_stands_on_a_windswept.mp4.json). This row
@@ -7324,10 +7449,6 @@ LTX_MEASURED_ETA: dict[tuple[str, str, str, str], tuple[float, str]] = {
# "says ~4 min, takes ~8". The rule is the same either way: the key that
# owns the measurement is the key whose canvas was measured.
("ltx25", "high_720p", "5s", "q8"): (8.18, "~8 min"), # 491.0 s, panel path
- # `high` (1024×576) has NO measured row. The 248.5 s number it used to carry
- # was taken at 8+3 and the lane has always run 10+3, so it was never this
- # tier's price; the model prices it now and the chip says `eta_measured:
- # false`, which is the honest state until someone times the real thing.
# The three distilled 5s cells, 2026-08-14 three-arm bench through the
# REAL panel path: isolated dev panel, /run submissions, helper restarted
# before each arm so every render pays the load, GPU locks held, M4 Max
@@ -7414,6 +7535,15 @@ LTX_TIER_STANDARD_NOTE = (
# DRAFT-lane verdict and retuning HQ stage 2 is ungraded and out of scope.
LTX_DISTILLED_STAGE1 = 8
LTX_DISTILLED_STAGE2 = 2
+# The engine's named 'fast' preset on the 2.5 distilled lane (F6S2 in the
+# perf lab): 5+2 forwards against the default 8+2. Owner-graded 2026-08-12 —
+# "quality is fine" — WITH the caveat the UI must carry: it renders a
+# DIFFERENT take (same prompt + seed land on a different shot; composition
+# corr 0.918 vs the control). Measured 121.6 s vs the default's 139.4 s at
+# 1024×576×121 (~13% faster; the −29% sometimes quoted is vs the pre-S2
+# control that no longer ships). The engine refuses named presets on 2.3.
+LTX_FAST_STAGE1 = 5
+LTX_SCHEDULE_PRESETS = ("fast", "default", "vendor")
# 10+3, from the 1280×704 High-tier lab (2026-08-14): the 10+2 tail candidate
# saved 60.18 s of a 408 s render but the owner judged its lip-sync worse than
# 10+3's, so 10+3 ships. 10 also matches what the HQ dispatch
@@ -7652,7 +7782,25 @@ def _build_ltx_tiers() -> dict[str, dict]:
allowed = ln.get("qualities") or ()
restricted = bool(allowed) and q["key"] not in allowed
notes = [n for n in (q["note"], ln["note"]) if n]
+ # 'fast' preset pricing — stamped ONLY on cells that can run it
+ # (2.5 + distilled), which is also how the client gates the
+ # control: a cell without fast_eta offers no Fast draft, so the
+ # UI never parses a version string. Priced by the cost model's
+ # own 5+2-vs-8+2 ratio applied to this cell's eta (the same
+ # anchor-ratio idiom the length scaling above uses), so the fixed
+ # load/decode cost is not discounted along with the forwards.
+ fast_fields = {}
+ if version_id == "ltx25" and q["pipeline"] != "hq":
+ model_default = ltx_estimate_minutes(
+ w, h, frames, LTX_DISTILLED_STAGE1, LTX_DISTILLED_STAGE2)
+ model_fast = ltx_estimate_minutes(
+ w, h, frames, LTX_FAST_STAGE1, LTX_DISTILLED_STAGE2)
+ if model_default > 0:
+ fast_min = eta_min * (model_fast / model_default)
+ fast_fields = {"fast_eta": _fmt_eta(fast_min),
+ "fast_min": round(fast_min, 2)}
tiers[key] = {
+ **fast_fields,
"key": key,
"label": f"{q['label']} · {ln['label']}",
"quality": q["key"], "quality_label": q["label"],
@@ -7856,45 +8004,135 @@ def character_render_quality(version_id: str | None = None) -> str:
barely locks identity, so the character strip forces the two-stage HQ path.
That reasoning is real and it is why the strip exists.
- 2.5 -> "balanced". On 2.5 the reasoning INVERTS. The recipe the owner graded
+ 2.5 -> "balanced". On 2.5 the reasoning INVERTS. The default the owner graded
— "insane quality", voice PASS by ear — is q8 + the DISTILLED pipeline at
1024x576x121 with the face LoRA at 1.0, and every graded 2.5 character clip
- in the campaign ran that path. Forcing `high` there would (a) route
- characters onto a pipeline nobody has graded them on and (b) require a
- 29.5 GB add-on for a result the 30 GB q8 pack already delivers, in 139 s
- instead of 246 s. Two mistakes, so: the graded path is the default.
+ in the campaign ran that path. High and High 720p are now explicit graded
+ options, but choosing neither must not silently require the 29.5 GB add-on.
+ The fast graded path therefore remains the default.
"""
return str(model_version(version_id).get("character_quality") or "high")
-def character_strip_payload() -> dict:
- """The two character chips, priced from the same table everything else uses.
+def character_strip_payload(version_id: str | None = None) -> dict:
+ """The character quality contract consumed by BOTH character surfaces.
- "~2 min" here is not typed: it is the MEASURED 139.4 s row for
- (ltx25, balanced, 5s, q8) — the character lane really does submit balanced
- at q8, which is exactly why ltx_measured_eta takes a quant."""
- q = character_render_quality()
+ ``draft`` and ``pro`` keep using the generation's graded default pipeline.
+ LTX-2.5 additionally offers the two real HQ qualities. Their ETA strings
+ come straight from ``LTX_TIERS`` — the same cells the main quality strip
+ renders — and their pack/pipeline fields let both clients reuse the main
+ High chip's install gate instead of inventing another one.
+ """
+ version = model_version(version_id)
+ vid = str(version["id"])
+ default_quality = character_render_quality(vid)
pack = "q8"
- hit = ltx_measured_eta(q, "5s", pack)
+ hit = ltx_measured_eta(default_quality, "5s", pack, vid)
pro_eta = hit[1] if hit else _fmt_eta(
- ltx_estimate_minutes(1024, 576, 121,
- LTX_QUALITIES[q]["stage1"], LTX_QUALITIES[q]["stage2"],
- LTX_QUALITIES[q].get("stage2_evals") or 1))
+ ltx_estimate_minutes(
+ 1024, 576, 121,
+ LTX_QUALITIES[default_quality]["stage1"],
+ LTX_QUALITIES[default_quality]["stage2"],
+ LTX_QUALITIES[default_quality].get("stage2_evals") or 1,
+ )
+ )
draft_eta = _fmt_eta(
- ltx_estimate_minutes(704, 384, 121,
- LTX_QUALITIES[q]["stage1"], LTX_QUALITIES[q]["stage2"],
- LTX_QUALITIES[q].get("stage2_evals") or 1))
- label = "Q8 HQ" if ltx_quality_uses_hq(q) else "Q8"
- return {
- "quality": q,
- "draft": {"width": 704, "height": 384,
- "tier": f"{label} · {draft_eta} / 5s",
- "title": f"Q8 at 704×384 — faster, slightly less per-frame detail."},
- "pro": {"width": 1024, "height": 576,
- "tier": f"{label} · {pro_eta} / 5s · best identity",
- "title": "Q8 at 1024×576 — the recipe the character LoRAs were "
- "graded on."},
+ ltx_estimate_minutes(
+ 704, 384, 121,
+ LTX_QUALITIES[default_quality]["stage1"],
+ LTX_QUALITIES[default_quality]["stage2"],
+ LTX_QUALITIES[default_quality].get("stage2_evals") or 1,
+ )
+ )
+ default_lane = "Q8 HQ" if ltx_quality_uses_hq(default_quality) else "Q8"
+
+ def option(key: str, label: str, quality: str, width: int, height: int,
+ eta: str, title: str, *, best_identity: bool = False) -> dict:
+ cell = LTX_QUALITIES[quality]
+ tier = f"{'Q8 HQ' if cell['pipeline'] == 'hq' else default_lane} · {eta} / 5s"
+ if best_identity:
+ tier += " · best identity"
+ return {
+ "key": key, "label": label, "quality": quality,
+ "width": width, "height": height,
+ # Character LoRAs always fuse into q8, including the distilled
+ # Draft/Pro lane. HQ also needs the generation's add-on; the
+ # shared JS gate infers that from pipeline='hq'.
+ "pack": pack, "pipeline": cell["pipeline"],
+ "tier": tier, "title": title,
+ }
+
+ tokens = [
+ option(
+ "draft", "Q8 Draft", default_quality, 704, 384, draft_eta,
+ "Q8 at 704×384 — faster, slightly less per-frame detail.",
+ ),
+ option(
+ "pro", "Q8 Pro", default_quality, 1024, 576, pro_eta,
+ "Q8 at 1024×576 — the graded default character recipe.",
+ best_identity=True,
+ ),
+ ]
+ if vid == "ltx25":
+ high = LTX_TIERS["high_5s"]
+ high720 = LTX_TIERS["high_720p_5s"]
+ tokens.extend([
+ option(
+ "high", "High", "high", 1024, 576, str(high["eta"]),
+ "Two-stage High at 1024×576. Honest note: trained faces hold "
+ "best on Q8 Pro — the High pipeline repaints fine detail the "
+ "character cannot fully control.",
+ ),
+ option(
+ "high720", "High · 720p", "high_720p", 1280, 704,
+ str(high720["eta"]),
+ "Two-stage High at 1280×704. Honest note: trained faces hold "
+ "best on Q8 Pro — the High pipeline repaints fine detail the "
+ "character cannot fully control.",
+ ),
+ ])
+
+ payload = {
+ "quality": default_quality, # compatibility: graded pipeline default
+ "default": "pro",
+ "tokens": tokens,
}
+ # Keep the named rows during the bootstrap shape transition. Older clients
+ # read c.draft/c.pro; current clients iterate tokens.
+ payload.update({row["key"]: row for row in tokens})
+ return payload
+
+
+def resolve_character_quality(value: str | None,
+ version_id: str | None = None) -> dict | None:
+ """Resolve a character UI token to the real pipeline quality + canvas.
+
+ Missing values always mean the graded ``pro`` default. Direct historic
+ pipeline names remain accepted for API/sidecar replay. On LTX-2.5, ``high``
+ now names the first-class High token; there is no reliable feature-schema
+ marker in old sidecars with which to distinguish the retired mapping.
+ """
+ payload = character_strip_payload(version_id)
+ options = {row["key"]: dict(row) for row in payload["tokens"]}
+ raw = str(value or "").strip().lower()
+ if not raw:
+ return options[payload["default"]]
+ if raw in options:
+ return options[raw]
+ if raw == "high_720p" and "high720" in options:
+ return options["high720"]
+
+ # Historic callers submitted the actual pipeline rather than the chip
+ # token. Preserve that lane while giving Load Params a current chip key.
+ if raw in ("balanced", "high"):
+ if raw == "high" and "high" in options:
+ return options["high"]
+ row = dict(options["pro"])
+ row["quality"] = raw
+ row["pipeline"] = (LTX_QUALITIES.get(raw) or {}).get("pipeline", "distilled")
+ row["width"], row["height"] = _CHARACTER_QUALITY_RESOLUTION[raw]
+ return row
+ return None
def ltx_measured_eta(quality: str, length: str, quant: str,
@@ -7962,7 +8200,7 @@ def ltx_tiers_payload() -> dict:
# notice above uses `live_preview.engines` to know which jobs it is
# even about, and `blocking` is the only thing allowed to hard-block.
"capabilities": capabilities_state(),
- # The character strip's two chips, and the PIPELINE they submit —
+ # The generation-scoped character tokens and the PIPELINE each submits —
# resolved per generation so the markup never owns that rule.
"character": character_strip_payload(),
# What the install CTAs offer, keyed and sized from the registry for the
@@ -8350,9 +8588,14 @@ def h3_turbo_status() -> dict:
"adapter": str(paths["lora"]) if paths["lora"] else None,
"adapter_version": paths["version"],
"fallback": paths["fallback"],
- # Fail closed until the repack is a real, digest-pinned release asset.
- "install_available": False,
- "install_note": (f"{H3_TURBO_LORA_FILE} release asset pending; raw "
+ # The v1.0 repack is a published, digest-pinned release asset, so the
+ # one-click install is live whenever the runner can take a LoRA at
+ # all. `installing` mirrors the in-flight download so /status never
+ # claims idle while a fetch is streaming.
+ "install_available": bool(supported),
+ "installing": _h3_turbo_dl_state.get("status") == "downloading",
+ "install_note": (f"Downloads the digest-pinned {H3_TURBO_LORA_FILE} "
+ f"release asset (~{H3_TURBO_DOWNLOAD_GB} GB); raw "
f"{H3_TURBO_RAW_V01_FILE} is not compatible."),
"dir": str(paths["dir"]),
"missing": paths["missing"],
@@ -9125,8 +9368,9 @@ def h3_status() -> dict:
"reason": "h3_" + paths["reason"], "steps": H3_TURBO_STEPS,
"download_gb": H3_TURBO_DOWNLOAD_GB, "repo": H3_TURBO_REPO,
"adapter": None, "adapter_version": None, "fallback": False,
- "install_available": False,
- "install_note": f"{H3_TURBO_LORA_FILE} release asset pending",
+ "install_available": False, "installing": False,
+ "install_note": "Turbo is an add-on to the Hailuo H3 "
+ "pack — install H3 first.",
"dir": str(_h3_turbo_dir()), "missing": [],
"note": H3_TURBO_NOTE, "label": "Turbo"}),
# User LoRAs — the CivitAI lane. A separate block from `turbo` for the
@@ -13752,7 +13996,26 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
prompt = override_prompt if override_prompt is not None else f("prompt", "")
if not prompt:
prompt = "A cinematic atmospheric scene"
- quality = f("quality", "balanced")
+ # Resolve a character token BEFORE reading the quality cell. The two
+ # character surfaces submit ``quality_choice`` (draft/pro/high/high720),
+ # while API replay may submit the real pipeline quality. Both must become
+ # the same job dict, and High · 720p must reach ``high_720p`` rather than an
+ # unknown string that falls through to the distilled lane.
+ _character_id = f("character_id", "")
+ _quality_choice_raw = f("quality_choice", "")
+ _quality_raw = f("quality", "")
+ _character_quality = None
+ if _character_id:
+ _character_quality = resolve_character_quality(
+ _quality_choice_raw or _quality_raw, ACTIVE_MODEL_VERSION)
+ if _character_quality is None:
+ raise CharacterRequestError(
+ "character quality must be draft, pro, high or high720")
+ quality = str(_character_quality["quality"])
+ _quality_choice = str(_character_quality["key"])
+ else:
+ quality = _quality_raw or "balanced"
+ _quality_choice = _quality_choice_raw
# THE CANVAS COMES FROM THE CELL. This was a per-quality if/elif of literal
# sizes that had to be edited in lockstep with the registry — and once two
# tiers shared the HQ pipeline, the `uses_hq` branch handed BOTH of them
@@ -13760,8 +14023,10 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# already states every tier's width and height; reading it is what makes a
# sixth tier a data change instead of a code change.
_qcell = LTX_QUALITIES.get(quality) or {}
- default_w = int(_qcell.get("width") or 1024)
- default_h = int(_qcell.get("height") or 576)
+ default_w = int((_character_quality or {}).get("width")
+ or _qcell.get("width") or 1024)
+ default_h = int((_character_quality or {}).get("height")
+ or _qcell.get("height") or 576)
upscale = f("upscale", "fit_720p" if quality == "balanced" else "off")
requested_upscale_method = (f("upscale_method", "lanczos") or "lanczos").strip().lower()
if requested_upscale_method == "model":
@@ -13780,11 +14045,9 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# the original character pre-selected and chips pre-filled. When absent
# (every other code path) these stay None and never reach the sidecar.
_source = f("source", "")
- _character_id = f("character_id", "")
_framing_choice = f("framing", "")
_duration_choice = f("duration", "")
_prompt_body = f("prompt_body", "")
- _quality_choice = f("quality_choice", "")
_full_prompt_override = f("full_prompt_override", "")
# Derive `frames` from `duration` when the caller didn't send frames
@@ -13944,6 +14207,9 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
"H3' from the Phosphene sidebar to update the clone; your "
"weights stay.")
_h3_chain_prompts = []
+ # An LTX schedule preset means nothing on the H3 lane; a leftover
+ # value from an engine switch must not ride onto the job.
+ _schedule_preset = ""
else:
# A chained shot list means nothing on the LTX lane, and a fallback to
# LTX above must not leave one on the job.
@@ -13955,6 +14221,30 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# stack, so there is no slot to allocate and a leftover "user" here
# would only be a confusing field in the sidecar.
_h3_lora_slot = H3_LORA_SLOT_DEFAULT
+ # LTX-2.5 distilled schedule preset ("fast" = the graded F6S2 draft
+ # schedule, 5+2 forwards, renders a DIFFERENT take). Gated server-side
+ # like every H3 rule above: the value rides only when the job will
+ # actually run the lane that defines it. The engine REFUSES named
+ # presets on 2.3, and the HQ lane resolves its own res_2s schedule —
+ # so a leftover value from a stale tab or a Load-Params replay is
+ # dropped with a sentence, never queued into a refusal.
+ _schedule_preset = (f("schedule_preset", "") or "").strip().lower()
+ if _schedule_preset in ("", "default"):
+ _schedule_preset = ""
+ elif _schedule_preset not in LTX_SCHEDULE_PRESETS:
+ push(f"Unknown schedule preset {_schedule_preset!r} — the tuned "
+ "default schedule runs.")
+ _schedule_preset = ""
+ elif ACTIVE_MODEL_VERSION != "ltx25":
+ push("The fast draft schedule is an LTX-2.5 preset and this "
+ f"install renders {model_version()['label']} — the default "
+ "schedule runs.")
+ _schedule_preset = ""
+ elif ltx_quality_uses_hq(quality):
+ push("The fast draft schedule applies to the distilled lanes "
+ "only — High tiers run their own two-stage schedule. The "
+ "default runs.")
+ _schedule_preset = ""
if _h3_turbo and _h3_steps:
# The adapter is distilled FOR 4 sigma points. Honouring a Steps pill on
# top of it would quietly render a configuration nobody validated, so
@@ -14018,6 +14308,11 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# trap as every key in this dict: leave it out and the whole
# control looks wired and silently no-ops on /queue/add.
"h3_chain_prompts": _h3_chain_prompts,
+ # LTX-2.5 distilled schedule preset — "" (tuned default) or
+ # "fast"/"vendor", already gated above to the lane that defines
+ # it. SAME allowlist trap as every key in this dict: leave it out
+ # and the Speed control looks wired and silently no-ops.
+ "schedule_preset": _schedule_preset,
"prompt": prompt,
"negative_prompt": f("negative_prompt", ""),
"width": max(32, int(f("width", str(default_w)) or default_w)),
@@ -14124,10 +14419,10 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# (matches upstream). Lower values save latent algebra time
# without skipping any model forwards. See helper for details.
"bongmath_max_iter": max(0, int(f("bongmath_max_iter", "100") or 100)),
- # Upstream HQ exposes per-modality guidance skip. Keep it off by
- # default; experiments can opt in through the raw job form.
- "video_skip_step": max(0, int(f("video_skip_step", "0") or 0)),
- "audio_skip_step": max(0, int(f("audio_skip_step", "0") or 0)),
+ # video_skip_step / audio_skip_step removed in v4.0.5: the pinned
+ # engine's generate_and_save accepts neither, the helper filtered
+ # both out before invocation, and the UI sold the difference as
+ # "~12% faster". Dead at the boundary = not stamped on jobs.
# Stage-2 image-conditioning mode for HQ I2V. Empty string =
# "let the dispatch decide" (auto-routes I2V>49f to "off" on
# 48-79 GB tier to dodge boundary OOM). User can override
@@ -14200,6 +14495,33 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
job["params"]["upscale"] = "off"
job["params"]["temporal_mode"] = "native"
job["params"]["accel"] = "off"
+ else:
+ # LTX geometry rides the ENGINE'S OWN GRID, normalized here so the
+ # job record carries the dims the render will actually produce.
+ # Every registered LTX lane is two-stage (stage 1 runs at half
+ # resolution, itself /32-aligned), so the engine floors the canvas to
+ # /64 — while the UI's number inputs stepped by 32 and the old
+ # max(32, v) accepted anything. A 1000-wide request silently rendered
+ # 960 wide with a sidecar claiming 1000: the CUSTOMIZE audit's
+ # "Width × Height LIES" row. Same for frames: the engine delivers on
+ # the 8k+1 grid, so an off-grid request is floored (never raised —
+ # matching the "never render more" promise) and recorded as what will
+ # be delivered. If a single-stage /32 lane ever registers, gate this
+ # on the cell's own pipeline instead of relaxing it everywhere.
+ _req_w, _req_h = job["params"]["width"], job["params"]["height"]
+ _req_f = job["params"]["frames"]
+ job["params"]["width"] = max(64, (_req_w // 64) * 64)
+ job["params"]["height"] = max(64, (_req_h // 64) * 64)
+ if _req_f > 1:
+ job["params"]["frames"] = ((_req_f - 1) // 8) * 8 + 1
+ if (job["params"]["width"], job["params"]["height"]) != (_req_w, _req_h):
+ push(f"Canvas {_req_w}×{_req_h} isn't on the engine's /64 grid — "
+ f"rendering {job['params']['width']}×"
+ f"{job['params']['height']} (the two-stage pipeline floors "
+ "to multiples of 64).")
+ if job["params"]["frames"] != _req_f:
+ push(f"{_req_f} frames isn't on the 8k+1 grid — rendering "
+ f"{job['params']['frames']} frames.")
# STG (Spatio-Temporal Guidance) — "detail guidance" slider. Only stamp
# `stg_scale` onto params when the form actually sent a value, so each
# dispatch keeps its OWN default when the user didn't touch the slider:
@@ -14257,8 +14579,6 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# prompt_body stays verbatim — separate from the assembled `prompt`
# so Load Params can repopulate the textarea exactly as typed.
job["params"]["prompt_body"] = _prompt_body
- if _quality_choice:
- job["params"]["quality_choice"] = _quality_choice
if _full_prompt_override:
job["params"]["full_prompt_override"] = _full_prompt_override
@@ -14395,6 +14715,11 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
# later restore the picker selection.
if "character_id" not in job["params"]:
job["params"]["character_id"] = _character_id
+ # This is the UI token, while params.quality above is the pipeline token.
+ # Recording both is what lets all four chips round-trip even when Pro
+ # and High share 1024×576. Missing/legacy requests resolve to Pro here,
+ # preserving the graded default explicitly in new sidecars.
+ job["params"]["quality_choice"] = _quality_choice
# Persist BOTH strengths so Load Params restores the exact sliders
# and the sidecar records what actually rendered. The voice value is
# stamped even when it equals the default: the number in a clip's
@@ -17128,7 +17453,10 @@ def run_job_inner(job: dict) -> None:
"started": job.get("started_at"),
"elapsed_sec": round(time.time() - job["started_ts"], 2) if job.get("started_ts") else None,
"video_duration_sec": video_duration(frames),
- "fps": FPS, "model": MODEL_ID_HQ, "queue_id": job["id"],
+ # The pack the render ACTUALLY used (same resolution as the
+ # job_spec's model_dir above) — not MODEL_ID_HQ, whose default is
+ # the 2.3 repo and which mislabeled every 2.5 keyframe clip.
+ "fps": FPS, "model": str(pack_path("q8")), "queue_id": job["id"],
"helper_elapsed_sec": result.get("elapsed_sec"),
"output_codec": output_codec_settings(),
"memory_policy": memory_plan,
@@ -17315,7 +17643,7 @@ def run_job_inner(job: dict) -> None:
# was measured on 2.3's two-stage HQ pipeline. On 2.5 this silently
# rerouted quality=balanced onto `high`, which means:
# * a CHARACTER render, whose graded 2.5 recipe is q8 + DISTILLED, landed
- # on the two-stage HQ path nobody has graded 2.5 characters on; and
+ # on the two-stage HQ path even though the user chose Balanced; and
# * it then demanded the 29.5 GB HQ add-on, so on a machine with the full
# q8 pack and no add-on it did not render at all — "High quality
# requires the full Q8 model", for a job the user asked to run on
@@ -17323,8 +17651,8 @@ def run_job_inner(job: dict) -> None:
# Found exactly that way: the step-13 proof render failed on a stock 2.5
# install with the add-on withheld.
#
- # 2.3 keeps the routing unchanged. When someone measures the equivalent on
- # 2.5's pipeline it can come back, per generation, with its own numbers.
+ # 2.3 keeps the routing unchanged. The now-graded 2.5 HQ path is reached by
+ # explicit quality=high/high_720p, never by silently rewriting Balanced.
balanced_q8_fast = (
quality == "balanced"
and ACTIVE_MODEL_VERSION == "ltx23"
@@ -17608,8 +17936,8 @@ def run_job_inner(job: dict) -> None:
# 1.0 after the 2026-05-20 chartest v3 diagnostic).
"teacache_thresh": float(p.get("teacache_thresh", 1.8)),
"bongmath_max_iter": int(p.get("bongmath_max_iter", 100)),
- "video_skip_step": int(p.get("video_skip_step", 0)),
- "audio_skip_step": int(p.get("audio_skip_step", 0)),
+ # skip-step fields no longer forwarded (v4.0.5): the engine
+ # boundary dropped them, so they were provenance-only noise.
# Stage-2 image conditioning mode. "full" re-encodes the
# reference image at full res for stage 2 (upstream default,
# best I2V anchor quality). "off" skips that full-res VAE
@@ -17669,7 +17997,7 @@ def run_job_inner(job: dict) -> None:
# 2.3 (whose characters go to `high` and never reach this branch) is
# untouched.
_char_pack = "q4"
- if p.get("character_id") and not ltx_quality_uses_hq(character_render_quality()):
+ if p.get("character_id") and not ltx_quality_uses_hq(quality):
_char_pack = "q8"
push(f"[character] {model_version()['label']} characters render on "
f"the Q8 weights with the distilled pipeline — the recipe they "
@@ -17707,6 +18035,10 @@ def run_job_inner(job: dict) -> None:
"image": p["image"] if mode != "t2v" else None,
"loras": loras,
"accel": p.get("accel", "off"),
+ # The 2.5 distilled schedule preset, already lane-gated by
+ # make_job; the helper forwards it to generate_two_stage,
+ # whose resolver validates it before any GPU is spent.
+ "schedule_preset": p.get("schedule_preset") or "",
"memory_policy": memory_plan["effective"],
"vae_full_decode_max_frames": memory_plan["full_decode_max_frames"],
# Sharp/PiperSR is a panel-side post-render pass. Do not pass it
@@ -21866,10 +22198,9 @@ class Handler(BaseHTTPRequestHandler):
#
# This endpoint now does ONLY:
# 1. look up the character → resolve face + (optional) audio LoRA
- # 2. map duration string → frames (5s/7s/10s)
- # 3. map the SIZE token → width/height (draft = 704x384, pro = 1024x576;
- # 704x384 because both old sizes were off the 64-grid the two-stage
- # lane snaps to, so the chip advertised a canvas it never delivered)
+ # 2. map duration string → frames
+ # 3. resolve the shared character quality token (Draft / Pro, plus
+ # High / High 720p on LTX-2.5) to its real pipeline + canvas
# 4. take the user's prompt verbatim — no prefix, no suffix, no
# negative-prompt injection, no framing word
# 5. build the same form payload /queue/add accepts and call
@@ -21901,40 +22232,16 @@ class Handler(BaseHTTPRequestHandler):
f"{sorted(_CHARACTER_DURATION_FRAMES)}"}, 400); return
frames = _CHARACTER_DURATION_FRAMES[duration]
- # The DEFAULT is resolved per generation, not hardcoded: 2.3 renders
- # characters on the two-stage HQ path, 2.5 on q8 + distilled (the
- # recipe every graded 2.5 character clip ran). An explicit `quality`
- # in the form still wins — this endpoint stays a thin wrapper — but
- # a caller that says nothing gets the graded path for the generation
- # actually installed.
- # TWO SEPARATE QUESTIONS, and conflating them is what kept this
- # tab on the wrong pipeline.
- #
- # SIZE which canvas — the tab's two chips, Q8 Draft (704x384)
- # and Q8 Pro (1024x576).
- # PIPELINE which schedule runs — and that is NOT the user's
- # choice, it is the generation's: ltx25 -> balanced
- # (q8 + distilled, the recipe every graded 2.5 character
- # clip ran), ltx23 -> high (its LoRAs are dev-trained and
- # distilled inference barely locks identity).
- #
- # `quality` used to mean both at once, so picking the small canvas
- # also picked a pipeline, and the only two tokens on offer were
- # 2.3's. A caller that names a real pipeline quality still wins —
- # this endpoint stays a thin wrapper — but the chips no longer have
- # to lie to ask for a size.
- _char_default = character_render_quality()
_q_raw = (form.get("quality", [""])[0] or "").strip().lower()
- _SIZE_TOKENS = {"draft": (704, 384), "pro": (1024, 576)}
- if _q_raw in _SIZE_TOKENS:
- width, height = _SIZE_TOKENS[_q_raw]
- quality = _char_default
- else:
- quality = _q_raw or _char_default
- if quality not in _CHARACTER_QUALITY_RESOLUTION:
- self._json({"error": "quality must be draft, pro, balanced "
- "or high"}, 400); return
- width, height = _CHARACTER_QUALITY_RESOLUTION[quality]
+ _resolved_quality = resolve_character_quality(
+ _q_raw, ACTIVE_MODEL_VERSION)
+ if _resolved_quality is None:
+ self._json({"error": "quality must be draft, pro, high or "
+ "high720"}, 400); return
+ quality_choice = str(_resolved_quality["key"])
+ quality = str(_resolved_quality["quality"])
+ width = int(_resolved_quality["width"])
+ height = int(_resolved_quality["height"])
seed = (form.get("seed", ["-1"])[0] or "-1").strip()
try:
@@ -22046,10 +22353,10 @@ class Handler(BaseHTTPRequestHandler):
# THE RESOLVED quality, not a hardcoded "high". This line was
# missed by the commit that added character_render_quality(),
# so the Characters TAB kept doing exactly the two things that
- # function's docstring says it exists to prevent: routing 2.5
- # characters onto the two-stage HQ path nobody has graded them
- # on (~246 s instead of ~139 s), and demanding the 29.5 GB High
- # add-on for a result the q8 pack already delivers. The main
+ # function's docstring says it exists to prevent: routing a
+ # DEFAULT 2.5 character onto the slower two-stage HQ path and
+ # demanding the 29.5 GB High add-on without an explicit choice.
+ # The main
# form was fixed; this lane was not, so the same character
# rendered differently depending on which tab launched it —
# the exact split the strength unification closed earlier.
@@ -22067,8 +22374,8 @@ class Handler(BaseHTTPRequestHandler):
"teacache_thresh": [_val("teacache_thresh", "1.8")],
"cfg_scale": [_val("cfg_scale", "3.0")],
"bongmath_max_iter": [_val("bongmath_max_iter", "100")],
- "video_skip_step": [_val("video_skip_step", "1")],
- "audio_skip_step": [_val("audio_skip_step", "1")],
+ # skip-step entries removed (v4.0.5): make_job no longer
+ # allowlists them and the engine boundary dropped them anyway.
"upscale": ["fit_720p"],
"upscale_method": ["lanczos"],
"accel": ["off"],
@@ -22097,7 +22404,7 @@ class Handler(BaseHTTPRequestHandler):
job_form["character_id"] = [cid]
job_form["source"] = ["characters"]
job_form["duration"] = [duration]
- job_form["quality_choice"] = [quality]
+ job_form["quality_choice"] = [quality_choice]
# prompt_body kept as a back-compat alias to the verbatim prompt
# so older Load-Params restorers still find something.
job_form["prompt_body"] = [prompt]
@@ -26779,6 +27086,16 @@ HTML = r"""<!doctype html>
border-color: rgba(94, 234, 255, 0.40);
color: var(--accent-bright, #5EEAFF);
}
+ .characters-chip.needs-install {
+ border-style: dashed;
+ border-color: rgba(47, 129, 247, 0.55);
+ color: var(--accent-bright, #5EEAFF);
+ background: rgba(47, 129, 247, 0.04);
+ }
+ .characters-chip.needs-install::before {
+ content: '↓ ';
+ font-weight: 700;
+ }
/* Quality row gets a small Turbo toggle alongside the chips — small,
secondary-looking, opt-in. Locked-recipe defaults stay the path of
least resistance. */
@@ -28160,10 +28477,8 @@ HTML = r"""<!doctype html>
was being ignored and BOTH the default + character quality strips
showed at once (Mr Bizarro screenshot 2026-05-17). Restore intent. */
.quality-strip[hidden] { display: none !important; }
- /* Character-quality strip has 2 chips, not 4 — distribute evenly. */
- #qualityGroupCharacter.quality-strip {
- grid-template-columns: repeat(2, 1fr);
- }
+ /* Character columns are set from BOOT.ltx.character.tokens: two on 2.3,
+ four on 2.5. The data contract, not static CSS, owns the count. */
/* Skip-step boost toggle — small secondary affordance under the
character quality chips. Reads as opt-in (not a noisy default
chip), keeps the row visually quieter than the main strip. */
@@ -31289,6 +31604,53 @@ HTML = r"""<!doctype html>
flex-shrink: 0;
text-decoration: none;
}
+ /* ONE HEALTH CLUSTER (v4.0.5). One bordered unit for the machine-state
+ pills — and the header's single SHRINKABLE region: min-width:0 +
+ overflow:hidden here means a narrow window compresses/clips INSIDE
+ the cluster, while everything to its right (version pill, bug,
+ settings, creator chip) is flex-shrink:0 and stays visible. Before
+ this, the header's own overflow:hidden ate its rightmost children
+ first — the creator avatar led the casualty list. */
+ body > header #healthCluster {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ padding: 4px 6px;
+ border-radius: 10px;
+ border: 1px solid var(--ph-border-soft);
+ background: rgba(140, 160, 220, 0.04);
+ min-width: 0;
+ overflow: hidden;
+ flex-shrink: 1;
+ }
+ body > header #healthCluster .pill {
+ border: none;
+ background: transparent;
+ white-space: nowrap;
+ }
+ body > header #versionPill,
+ body > header #bugBtn,
+ body > header #settingsBtn,
+ body > header .creator-link,
+ body > header .engine-switch {
+ flex-shrink: 0;
+ }
+ /* Narrow windows: the cluster degrades to its STATE DOTS instead of
+ vanishing — each pill keeps its click target, tooltip and colored
+ dot, drops its words. The full-text cluster needs roughly a 1600px
+ row alongside the brand banner, switcher and version pill. */
+ /* span.pill (not .pill) on purpose: the Linear-style pill restyle
+ further down shares the bare selector at equal specificity and would
+ win on source order — a media query adds no specificity of its own. */
+ @media (max-width: 1600px) {
+ body > header #healthCluster > span.pill {
+ font-size: 0;
+ gap: 0;
+ padding: 4px 5px;
+ }
+ body > header #healthCluster > span.pill .dot { margin: 0; }
+ body > header #healthCluster > span.pill svg { width: 12px; height: 12px; }
+ }
body > header .brand img {
/* Phosphene brand mark — the rings + wordmark composed as ONE wide
banner (1291×392, transparent bg). Replaces the previous setup
@@ -31344,7 +31706,7 @@ HTML = r"""<!doctype html>
/* Unified chip language for every header pill — Tier, RAM, Helper,
Models, Queue, current job, version, etc. */
- body > header > .pill {
+ body > header > .pill, body > header #healthCluster > .pill {
display: inline-flex;
align-items: center;
gap: 8px;
@@ -31360,29 +31722,29 @@ HTML = r"""<!doctype html>
white-space: nowrap;
transition: border-color var(--t-base), color var(--t-base);
}
- body > header > .pill:hover {
+ body > header > .pill:hover, body > header #healthCluster > .pill:hover {
border-color: var(--ph-border-strong);
color: var(--text);
}
- body > header > .pill .dot {
+ body > header > .pill .dot, body > header #healthCluster > .pill .dot {
width: 7px; height: 7px;
border-radius: 999px;
margin-right: 0;
box-shadow: none;
}
- body > header > .pill-good { color: var(--success); border-color: rgba(63,185,80,0.30); }
- body > header > .pill-good .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
- body > header > .pill-warn { color: var(--warning); border-color: rgba(210,153,34,0.35); }
- body > header > .pill-danger { color: var(--danger); border-color: rgba(248,81,73,0.35); }
- body > header > .pill-running {
+ body > header > .pill-good, body > header #healthCluster > .pill-good { color: var(--success); border-color: rgba(63,185,80,0.30); }
+ body > header > .pill-good .dot, body > header #healthCluster > .pill-good .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
+ body > header > .pill-warn, body > header #healthCluster > .pill-warn { color: var(--warning); border-color: rgba(210,153,34,0.35); }
+ body > header > .pill-danger, body > header #healthCluster > .pill-danger { color: var(--danger); border-color: rgba(248,81,73,0.35); }
+ body > header > .pill-running, body > header #healthCluster > .pill-running {
color: var(--accent-bright);
border-color: rgba(47,129,247,0.30);
background: rgba(47,129,247,0.06);
animation: pulse 1.6s ease-in-out infinite;
}
- body > header > .pill-current { color: var(--success); border-color: rgba(63,185,80,0.25); }
- body > header > .pill-update { color: var(--warning); border-color: rgba(240,185,64,0.40); background: rgba(240,185,64,0.06); }
- body > header > .pill-restart { color: var(--accent-bright); border-color: rgba(126,152,255,0.40); background: rgba(126,152,255,0.06); }
+ body > header > .pill-current, body > header #healthCluster > .pill-current { color: var(--success); border-color: rgba(63,185,80,0.25); }
+ body > header > .pill-update, body > header #healthCluster > .pill-update { color: var(--warning); border-color: rgba(240,185,64,0.40); background: rgba(240,185,64,0.06); }
+ body > header > .pill-restart, body > header #healthCluster > .pill-restart { color: var(--accent-bright); border-color: rgba(126,152,255,0.40); background: rgba(126,152,255,0.06); }
/* === ENGINE SWITCHER (header, top right) ====================
The one control in the header row that is an INPUT rather than a
@@ -32002,7 +32364,7 @@ HTML = r"""<!doctype html>
leading row, the form sections start right under them. */
/* === FALLBACK: Hide unwanted inline icons in version pill === */
- body > header > .pill svg { width: 12px; height: 12px; }
+ body > header > .pill svg, body > header #healthCluster > .pill svg { width: 12px; height: 12px; }
/* === PHOSPHOR ICONS (MIT) ===================================
@@ -32270,17 +32632,25 @@ HTML = r"""<!doctype html>
<!-- Hardware tier badge — clickable, opens a dialog explaining what
this Mac's RAM tier allows. Modes / qualities the tier doesn't
support are visibly disabled in the form below. -->
- <span id="tierPill" class="pill" style="cursor:pointer" onclick="openTierModal()" title="Click to see what this Mac can do">click for system info</span>
- <span id="memPill" class="pill">memory…</span>
- <span id="comfyPill" class="pill" style="display:none">comfy…</span>
- <span id="helperPill" class="pill">helper…</span>
- <!-- Models pill: shows roll-up status (X / Y models ready) and click-opens
- a modal with per-repo download buttons. Color reflects readiness:
- pill-good = all models present, pill-warn = base ready but Q8 missing,
- pill-bad = base incomplete (panel can't render). -->
- <span id="modelsPill" class="pill" style="cursor:pointer" onclick="openModelsModal()" title="View / download model status">models…</span>
- <span id="queuePill" class="pill">queue 0</span>
- <span id="jobPill" class="pill">idle</span>
+ <!-- ONE HEALTH CLUSTER (v4.0.5) — every machine-state pill lives in a
+ single container: one visual unit to scan instead of six loose pills
+ bleeding across the header, and one SHRINKABLE region, so a narrow
+ window compresses the cluster instead of shoving the creator chip
+ into the header's overflow:hidden (the "avatar clipped" report).
+ Individual pill ids and their JS updaters are untouched. -->
+ <div id="healthCluster" role="group" aria-label="System health">
+ <span id="tierPill" class="pill" style="cursor:pointer" onclick="openTierModal()" title="Click to see what this Mac can do">click for system info</span>
+ <span id="memPill" class="pill">memory…</span>
+ <span id="comfyPill" class="pill" style="display:none">comfy…</span>
+ <span id="helperPill" class="pill">helper…</span>
+ <!-- Models pill: shows roll-up status (X / Y models ready) and click-opens
+ a modal with per-repo download buttons. Color reflects readiness:
+ pill-good = all models present, pill-warn = base ready but Q8 missing,
+ pill-bad = base incomplete (panel can't render). -->
+ <span id="modelsPill" class="pill" style="cursor:pointer" onclick="openModelsModal()" title="View / download model status">models…</span>
+ <span id="queuePill" class="pill">queue 0</span>
+ <span id="jobPill" class="pill">idle</span>
+ </div>
<!-- Update-available pill. Hidden by default; renders only when the
/version poller finds the install behind origin/main. Click → modal
listing the unseen commits. We do this because users keep telling
@@ -32447,6 +32817,9 @@ HTML = r"""<!doctype html>
<input type="hidden" name="preset_label" id="preset_label" value="">
<input type="hidden" name="mode" id="mode" value="t2v">
<input type="hidden" name="quality" id="quality" value="balanced">
+ <!-- UI token is separate from the pipeline quality: Pro and High share
+ 1024×576 but must round-trip to different schedules. -->
+ <input type="hidden" name="quality_choice" id="quality_choice" value="">
<!-- The DURATION axis's own field. It is a LABEL for the shape, not the
shape itself: #duration and #frames remain what the render reads, and
_ltxApplyShape writes all three together. A cell key here means "the
@@ -32463,8 +32836,12 @@ HTML = r"""<!doctype html>
lora-lab/outputs/overnight_2026-05-15/SPEED_RESULTS_CODEX.md
for the validation grid. Patches in samplers.py + helper line
1625-26 land the value at the HQ pipeline. -->
- <input type="hidden" name="video_skip_step" id="video_skip_step" value="0">
- <input type="hidden" name="audio_skip_step" id="audio_skip_step" value="0">
+ <!-- video_skip_step / audio_skip_step hidden inputs removed in v4.0.5:
+ the engine boundary dropped both, so they were provenance noise. -->
+ <!-- LTX-2.5 distilled schedule preset: "" = tuned default, "fast" = the
+ graded 5+2 draft schedule (a DIFFERENT take). make_job gates it to
+ the lane that defines it; the Speed pills in Customize write it. -->
+ <input type="hidden" name="schedule_preset" id="schedule_preset" value="">
<div id="warnBanner" class="warn-banner"></div>
@@ -32966,13 +33343,9 @@ HTML = r"""<!doctype html>
for the click handler that filters by it.
When a character is selected in the Characters chip strip,
selectManualCharacter() hides this strip and reveals the
- character-only strip below — the Q4 distilled paths
- (Quick / Balanced / Standard) would produce a base-fine-
- tune mismatch on dev-trained character LoRAs (the LoRA
- was trained against transformer-dev.safetensors; distilled
- inference uses transformer-distilled.safetensors and the
- identity barely locks). Forcing quality=high here means
- the user can't accidentally ship a Q4 character render. -->
+ character-only strip below. Its Draft/Pro rows use q8 distilled,
+ while its High rows use the real q8 HQ lane; no character chip
+ ever falls through to the ordinary q4 quality strip. -->
<!-- LTX's CANVAS axis. Rendered by renderTierAxes('ltx') from
BOOT.ltx.qualities / .lengths / .tiers, exactly as H3's two
strips are, so the server-side table is the single source of
@@ -33005,39 +33378,16 @@ HTML = r"""<!doctype html>
#h3TierNote. Empty and hidden when the combination has nothing
to warn about, which is most of them. -->
<div class="engine-hint" id="ltxTierNote" hidden></div>
- <!-- Character-only quality strip — revealed by selectManualCharacter
- when a character is selected. Both buttons submit quality=high
- (the only inference path that matches dev-trained character
- LoRAs); the difference is resolution. Draft renders smaller
- + faster, Pro renders at the canonical 1024x576. Both upscale
- on save to the final delivery resolution. Hidden by default;
- .show class adds the actual display. -->
+ <!-- Character-only quality strip — revealed by selectManualCharacter.
+ Rendered entirely from BOOT.ltx.character so the Manual surface
+ and Characters tab expose the same generation-specific tokens. -->
<!-- data-ltx-only for a reason the `hidden` attribute can't cover:
its visibility is owned by _applyCharacterQualityStripVisibility,
which only ever asks "is a character selected?". With a character
active, switching to H3 left this strip lit BESIDE the H3 tier
strip — two primary strips, both claiming to set the render. The
fold rule settles it declaratively, whatever the JS believes. -->
- <!-- The two chips' PIPELINE and their ETAs are filled by
- renderCharacterStrip() from BOOT.ltx.character, which the server
- resolves per generation. The markup carries geometry and nothing
- else, deliberately: 2.3 renders characters on the two-stage HQ
- path and 2.5 on q8 + distilled (the exact recipe every graded 2.5
- character clip ran), and two generations each carrying a copy of
- that rule is how they drift. "~2 min" on Q8 Pro is the MEASURED
- 139.4 s row, not a typed number. -->
- <div class="quality-strip pill-group" id="qualityGroupCharacter" hidden data-ltx-only>
- <button type="button" class="q-chip pill-btn pill-quality char-quality" data-char-quality="draft" data-width="704" data-height="384">
- <span class="ql-name">Q8 Draft</span>
- <span class="q-spec ql-spec sub">704×384</span>
- <span class="ql-tier"></span>
- </button>
- <button type="button" class="q-chip pill-btn pill-quality char-quality active" data-char-quality="pro" data-width="1024" data-height="576">
- <span class="ql-name">Q8 Pro</span>
- <span class="q-spec ql-spec sub">1024×576</span>
- <span class="ql-tier"></span>
- </button>
- </div>
+ <div class="quality-strip pill-group" id="qualityGroupCharacter" hidden data-ltx-only></div>
<!-- Hailuo H3 render shape — TWO INDEPENDENT AXES, not one fixed tier
menu. This shipped as six baked combinations (Draft 3s, HQ 3s,
HQ 5s, Wide 5s, Long 10s, Long 15s) and the owner's report was
@@ -33240,17 +33590,9 @@ HTML = r"""<!doctype html>
hidden inputs for all three live up in the engine-state block;
every one is in the make_job allowlist, which is the only place
they could silently die. -->
- <!-- 2026-05-17 (Codex C+ pass 6): the character-only skip-step
- toggle moved out of here into the Customize section as
- "HQ speed". It's a Q8 sampler control, not a character
- control — applies equally to Character / FFLF / Extend
- renders (anything that hits the HQ pipeline). Visible
- only when quality=high. Old IDs preserved as a hidden
- legacy stub so any saved-state restore paths that
- reference `charSkipstepToggle` keep working. -->
- <label class="char-skipstep-toggle" id="charSkipstepToggleWrap" hidden style="display:none">
- <input type="checkbox" id="charSkipstepToggle" checked>
- </label>
+ <!-- The skip-step toggle (and its charSkipstepToggle legacy stub)
+ is gone as of v4.0.5 — the control was dead at the engine
+ boundary; see the HQ-speed removal note in Customize. -->
</div>
<!-- ============== ORIENTATION (compact, top-level) ==============
@@ -33462,10 +33804,18 @@ HTML = r"""<!doctype html>
overwrites on the next click was the loudest thing wrong with
the old H3 Customize. -->
<div id="dimsRow" class="cz-control" data-ltx-only>
- <div class="cz-label">Width × height</div>
+ <div class="cz-label">Width × height
+ <span class="cz-label-hint">multiples of 64 — the two-stage engine floors anything else</span>
+ </div>
<div class="row">
- <div><input name="width" id="width" value="1024" type="number" min="32" step="32" aria-label="Width"></div>
- <div><input name="height" id="height" value="576" type="number" min="32" step="32" aria-label="Height"></div>
+ <!-- step/min 64, not 32: every registered LTX lane is
+ two-stage (stage 1 at half resolution, itself /32), so
+ the engine floors the canvas to /64. A /32 step offered
+ sizes the render would silently shrink — the CUSTOMIZE
+ audit's "Width × Height LIES" row. make_job floors the
+ job to the same grid and says so. -->
+ <div><input name="width" id="width" value="1024" type="number" min="64" step="64" aria-label="Width"></div>
+ <div><input name="height" id="height" value="576" type="number" min="64" step="64" aria-label="Height"></div>
</div>
</div>
@@ -33509,30 +33859,42 @@ HTML = r"""<!doctype html>
</div>
</div>
- <!-- HQ speed — Codex C+ pass 6, 2026-05-17. The Q8 HQ res_2s
- sampler honors `video_skip_step` / `audio_skip_step`
- (patched into ti2vid_two_stages_hq.py + samplers.py
- 2026-05-15). At skip_step=1 the sampler reuses the last
- denoised prediction on alternating outer passes — 12.6%
- wall-time saving on a 7s 1024×576 character clip with
- no visible quality cost (Codex contact-sheet sweep,
- SPEED_RESULTS_CODEX.md). Fast = skip=1, Exact = skip=0.
- Visible only when quality=high (Q8 HQ pipeline active);
- hidden CSS rule belongs in the Q8 capability block. -->
- <div id="hqSpeedRow" class="cz-control" data-ltx-only hidden>
- <div class="cz-label">HQ speed
- <span class="cz-label-hint">Q8 sampler · skip-step cache reuse</span>
+ <!-- HQ speed (Fast/Exact) REMOVED in v4.0.5. The 2026-05-15
+ skip-step patch it described belongs to the pre-vendored
+ engine era: the pinned port's `generate_and_save` accepts
+ neither `video_skip_step` nor `audio_skip_step`, and the
+ helper's `_filter_unsupported_kwargs` silently dropped both
+ before invocation — so Fast and Exact ran IDENTICAL settings
+ while the UI claimed "~12% faster" (CUSTOMIZE audit,
+ 2026-08-14: DEAD on both generations). Low-level sampler
+ support exists (`MultiModalGuiderParams.skip_step`); if it is
+ ever wired for real, rebenchmark and bring the control back
+ with a measured number, not this one. -->
+
+ <!-- Speed — the LTX-2.5 distilled lane's REAL speed control
+ (v4.0.5), replacing the dead one above. "Fast draft" selects
+ the engine's named `fast` schedule preset: 5+2 forwards vs
+ the tuned 8+2, ~13% faster, and it renders a DIFFERENT take
+ (same prompt + seed land on a different shot) — which is why
+ it sits next to draft affordances and never on a quality
+ slider. Visibility is SERVER-OWNED: the row shows only when
+ the current tier cell carries `fast_eta`, which the registry
+ stamps only on 2.5 distilled cells — the UI never parses a
+ version string. -->
+ <div id="schedPresetRow" class="cz-control" data-ltx-only hidden>
+ <div class="cz-label">Speed
+ <span class="cz-label-hint">draft schedule · changes the take</span>
</div>
- <div class="pill-group cols-2" id="hqSpeedGroup">
- <button type="button" class="pill-btn active" data-hq-speed="fast"
- title="TeaCache + skip-step (validated 2026-05-15: ~12% faster, no visible quality cost on character renders)">
- <span>Fast</span>
- <span class="sub">TeaCache + skip-step · ~12% faster</span>
+ <div class="pill-group cols-2" id="schedPresetGroup">
+ <button type="button" class="pill-btn active" data-sched-preset=""
+ title="The tuned schedule every graded 2.5 clip runs (8+2 forwards).">
+ <span>Tuned</span>
+ <span class="sub" id="schedTunedSub">default schedule</span>
</button>
- <button type="button" class="pill-btn" data-hq-speed="exact"
- title="TeaCache only (no skip-step). Use if a specific LoRA / prompt looks degraded under Fast.">
- <span>Exact</span>
- <span class="sub">TeaCache only · slower, reference</span>
+ <button type="button" class="pill-btn" data-sched-preset="fast"
+ title="The engine's fast draft schedule (5+2 forwards). Renders a DIFFERENT take — the same prompt and seed land on a different shot than Tuned, so use it to explore, then re-render keepers on Tuned.">
+ <span>Fast draft</span>
+ <span class="sub" id="schedFastSub">different take</span>
</button>
</div>
</div>
@@ -38928,19 +39290,14 @@ function trainUpdateAdvancedFields() {
// Recipe defaults (TC=1.8, stage1=10/stage2=3, cfg=3.0, seed=-1,
// enhance=false, video_skip=1+audio_skip=1) are applied server-side per
// docs/API.md. The UI collects prompt (trigger pre-filled) + duration +
-// quality. Quality maps server-side to resolution + recipe:
-// draft → 704x384; pro → 1024x576. Both render on the generation's own
-// character recipe (2.5: q8 + distilled), resolved server-side — the chips
-// carry a SIZE, never a pipeline. The wall times that used to sit here were
-// 2.3-era and the canvas was the retired 736x416; measured 2.5 numbers live
-// in LTX_MEASURED_ETA, which is where the UI reads them from.
+// quality. Draft/Pro use the generation's graded default; LTX-2.5 also offers
+// the two-stage High canvases. All four tokens come from BOOT.ltx.character.
window.CHARACTERS = {
list: [], // [{id, name, trigger, pronoun, subject_noun, sample_image_url, ...}]
selected: null, // currently-composing character (object from list)
duration: '7s', // 5s | 7s | 10s | 15s
- quality: 'pro', // SIZE token: draft | pro. The PIPELINE is the
- // generation's answer, resolved server-side (§5.6).
+ quality: 'pro', // token: draft | pro | high | high720 (last two: 2.5)
// ONE CHARACTER, ONE PAIR OF STRENGTHS, WHICHEVER SURFACE LAUNCHED IT.
// These were 0.8 and "applied to both face_lora and audio_lora" — a 2.3-era
// correction for over-baked quirks at 5000 steps, and a comment that stopped
@@ -38990,17 +39347,22 @@ const CHARACTERS_DURATION = (((BOOT.ltx || {}).lengths) || [])
// HQ pipeline plus the 29.5 GB add-on — so the tab was offering the only two
// choices that were wrong.
//
-// The values are now SIZE tokens. Which pipeline runs is the generation's
-// answer, resolved server-side (§5.6); the chips pick a canvas, not a schedule.
+// Each tuple's fourth item is the server row. That makes install routing use
+// the same pack/pipeline fields as the main High chips.
const CHARACTERS_QUALITY = (() => {
const c = ((BOOT.ltx || {}).character) || {};
- if (!c.draft || !c.pro) {
- return [['pro', 'Q8 Pro', 'Q8 Pro — the recipe the character LoRAs were graded on']];
- }
- return [
- ['draft', 'Q8 Draft', `Q8 Draft — ${c.draft.width}×${c.draft.height}, ${c.draft.tier}`],
- ['pro', 'Q8 Pro', `Q8 Pro — ${c.pro.width}×${c.pro.height}, ${c.pro.tier}`],
- ];
+ const rows = Array.isArray(c.tokens) && c.tokens.length
+ ? c.tokens
+ : [c.draft, c.pro].filter(Boolean);
+ if (!rows.length) {
+ return [['pro', 'Q8 Pro', 'Q8 Pro — the graded default character recipe', null]];
+ }
+ return rows.map(row => [
+ row.key,
+ row.label,
+ `${row.label} — ${row.width}×${row.height}, ${row.tier}`,
+ row,
+ ]);
})();
// Look-up by value → full descriptive text (the third tuple slot).
const CHARACTERS_FRAMING_TEXT = Object.fromEntries(
@@ -39133,18 +39495,25 @@ function charactersRenderGrid() {
}
function charactersRenderChips() {
- // Each option is [value, shortLabel, fullText]. The chip face shows
+ // Each option is [value, shortLabel, fullText, serverRow]. The chip face shows
// the short label (so 5 framing options fit on one row at ~420px);
// the full text lives on `title` for accessibility / hover discovery.
const renderGroup = (containerId, options, current, fieldName) => {
const el = document.getElementById(containerId);
if (!el) return;
- el.innerHTML = options.map(([val, label, full]) => (
- `<button type="button" class="characters-chip${val === current ? ' active' : ''}"
+ el.innerHTML = options.map(([val, label, full, row]) => {
+ const needsInstall = fieldName === 'quality' && row
+ && typeof ltxCellNeedsInstall === 'function' && ltxCellNeedsInstall(row);
+ const title = needsInstall && typeof ltxCellInstallLabel === 'function'
+ ? ltxCellInstallLabel(row) : (full || label);
+ return (
+ `<button type="button" class="characters-chip${val === current ? ' active' : ''}${needsInstall ? ' needs-install' : ''}"
data-val="${charactersEscapeAttr(val)}"
- title="${charactersEscapeAttr(full || label)}"
+ data-pipeline="${charactersEscapeAttr((row && row.pipeline) || '')}"
+ title="${charactersEscapeAttr(title)}"
onclick="charactersPickChip('${fieldName}', '${charactersEscapeAttr(val)}')">${charactersEscapeHtml(label)}</button>`
- )).join('');
+ );
+ }).join('');
};
renderGroup('charactersDurationChips', CHARACTERS_DURATION, window.CHARACTERS.duration, 'duration');
renderGroup('charactersQualityChips', CHARACTERS_QUALITY, window.CHARACTERS.quality, 'quality');
@@ -39152,6 +39521,15 @@ function charactersRenderChips() {
function charactersPickChip(field, val) {
if (field !== 'duration' && field !== 'quality') return;
+ if (field === 'quality') {
+ const option = CHARACTERS_QUALITY.find(([key]) => key === val);
+ const row = option && option[3];
+ if (row && typeof ltxCellNeedsInstall === 'function'
+ && ltxCellNeedsInstall(row)) {
+ if (typeof openModelsModal === 'function') openModelsModal();
+ return;
+ }
+ }
window.CHARACTERS[field] = val;
charactersRenderChips();
}
@@ -39332,6 +39710,13 @@ function charactersSyncStrengthControls() {
async function charactersGenerate() {
const c = window.CHARACTERS.selected;
if (!c) return;
+ const qualityRow = (CHARACTERS_QUALITY.find(
+ ([key]) => key === window.CHARACTERS.quality) || [])[3];
+ if (qualityRow && typeof ltxCellNeedsInstall === 'function'
+ && ltxCellNeedsInstall(qualityRow)) {
+ if (typeof openModelsModal === 'function') openModelsModal();
+ return;
+ }
const btn = document.getElementById('charactersGenerateBtn');
const labelSpan = btn ? btn.querySelector('.characters-generate-label') : null;
const busySpan = btn ? btn.querySelector('.characters-generate-busy') : null;
@@ -39481,16 +39866,8 @@ async function charactersLoadParams(p) {
throw new Error(`character ${p.character_id} not in list`);
}
- // Restore skip-step toggle BEFORE selecting the character — that way
- // _setCharacterQuality (called via selectManualCharacter) reads the
- // restored state and writes the right values into the hidden inputs.
- // If the sidecar has no skip-step value (older clips, non-Codex
- // renders) default to ON, matching the new default behavior.
- const skipToggle = document.getElementById('charSkipstepToggle');
- if (skipToggle) {
- const v = String(p.video_skip_step ?? p.audio_skip_step ?? '1');
- skipToggle.checked = (v !== '0');
- }
+ // (Skip-step restore removed in v4.0.5 — the control was dead at the
+ // engine boundary, so an old sidecar's value has nothing to restore into.)
// Pre-select character. selectManualCharacter() writes the id to the
// hidden #characterIdInput, appends the trigger to the prompt
@@ -39500,29 +39877,39 @@ async function charactersLoadParams(p) {
selectManualCharacter(p.character_id);
}
- // Restore the quality CHIP (Draft vs Pro) by checking the recorded
- // dimensions. 736×416 = Draft; everything else = Pro. The character-
- // quality strip's click handler sets quality=high + the right w/h
- // already; calling _setCharacterQuality bypasses setQuality() so our
- // exact dims survive.
- // 704×384 IS THE DRAFT CANVAS. This recognised only the retired 736×416, so
- // every Draft render made since the size moved reopened as Pro — Load Params
- // silently changing the shot's geometry, which is the one thing it exists not
- // to do. Both are listed because sidecars written before the move are still
- // on disk and must still round-trip.
+ // Restore the UI TOKEN, not merely the canvas. Pro and High are both
+ // 1024×576, so dimensions alone cannot reproduce the selected pipeline.
+ // New sidecars carry quality_choice; older ones fall back to their real
+ // quality and finally to geometry. There is no schema/version marker on the
+ // old dc0051c sidecars that mapped `high` to Pro, so on LTX-2.5 an old bare
+ // `quality=high` now reopens as the newly first-class High token.
const sidecarW = parseInt(p.width || '0', 10);
const sidecarH = parseInt(p.height || '0', 10);
+ const charCfg = ((BOOT.ltx || {}).character) || {};
+ const charRows = Array.isArray(charCfg.tokens) ? charCfg.tokens : [];
+ const charKeys = charRows.map(row => row.key);
+ const aliases = {
+ high_720p: 'high720', balanced: 'pro', standard: 'pro', quick: 'draft'
+ };
+ let charChoice = String(p.quality_choice || '').toLowerCase();
+ charChoice = aliases[charChoice] || charChoice;
+ if (!charKeys.includes(charChoice)) {
+ const pipelineQuality = String(p.quality || '').toLowerCase();
+ charChoice = aliases[pipelineQuality] || pipelineQuality;
+ }
const _draftPairs = [[704, 384], [736, 416]]; // current, then legacy
const isDraft = _draftPairs.some(([w, h]) =>
(sidecarW === w && sidecarH === h) || (sidecarW === h && sidecarH === w));
+ if (!charKeys.includes(charChoice)) charChoice = isDraft ? 'draft' : 'pro';
const charQualityGroup = document.getElementById('qualityGroupCharacter');
if (charQualityGroup) {
- const sel = isDraft ? '[data-char-quality="draft"]' : '[data-char-quality="pro"]';
+ const sel = `[data-char-quality="${charChoice}"]`;
const btn = charQualityGroup.querySelector(sel);
if (btn && typeof _setCharacterQuality === 'function') {
- _setCharacterQuality(btn);
+ _setCharacterQuality(btn, { allowMissing: true });
}
}
+ if (window.CHARACTERS) window.CHARACTERS.quality = charChoice;
// Restore aspect (landscape vs vertical). If the sidecar's recorded
// h > w, it was a vertical render. setAspect already exists and
@@ -40877,9 +41264,6 @@ function setQuality(q) {
updateAccelAvailability();
updateTemporalAvailability();
updateCustomizeSummary();
- if (typeof _applyHqSpeedRowVisibility === 'function') {
- try { _applyHqSpeedRowVisibility(); } catch (_) {}
- }
if (typeof _applyStgRowVisibility === 'function') {
try { _applyStgRowVisibility(); } catch (_) {}
}
@@ -41031,8 +41415,17 @@ function updateCustomizeSummary() {
if (q !== 'quick' && (w !== expectedW || h !== expectedH)) {
parts.push(`${w}×${h} custom`);
}
- // Speed
- parts.push(accel === 'off' ? 'exact speed' : (accel === 'boost' ? 'boost' : 'turbo'));
+ // Speed — say something ONLY when a non-default accel is set (an old
+ // sidecar restore). "exact speed" used to print whenever accel was off,
+ // while the separate HQ Speed control defaulted to Fast — the summary
+ // could contradict the open panel. That control is gone (v4.0.5, dead at
+ // the engine boundary), and a default deserves no words.
+ if (accel === 'boost' || accel === 'turbo') parts.push(accel);
+ // The REAL speed control: the folded-away disclosure must name a
+ // non-default schedule, because it changes the take, not just the clock.
+ if (typeof schedPresetActive === 'function' && schedPresetActive()) {
+ parts.push('fast draft · different take');
+ }
if ((document.getElementById('temporal_mode')?.value || 'native') === 'fps12_interp24') {
parts.push('12→24fps long clip');
}
@@ -41453,7 +41846,7 @@ function h3SpeedSub(which) {
}
const t = h3TurboState();
if (!t.downloaded && !t.install_available) return 'adapter asset pending';
- if (!t.downloaded) return (t.download_gb || 1.4) + ' GB download';
+ if (!t.downloaded) return (t.download_gb || 2.0) + ' GB download';
const eta = cell && cell.turbo_eta ? _h3EtaPlain(cell.turbo_eta) : '';
return eta || '4-step adapter';
}
@@ -41485,11 +41878,15 @@ function renderH3Turbo() {
: ' Estimated for this shape: Turbo runs ' + ((tier && tier.turbo_forwards) || 3)
+ ' forwards instead of ' + ((tier && tier.forwards) || 8)
+ ', over the same fixed load/decode time. Not measured at this canvas.';
+ const fallbackNote = (t.downloaded && t.fallback && t.adapter_version)
+ ? ' Running the ' + t.adapter_version + ' fallback adapter — the v1.0 '
+ + 'download replaces it.'
+ : '';
pill.title = t.downloaded
- ? (t.note || '') + basis
+ ? (t.note || '') + basis + fallbackNote
: (t.install_available
? 'Downloads the LightX2V v1.0 runner-layout adapter (~'
- + (t.download_gb || 1.4) + ' GB) into the H3 pack.'
+ + (t.download_gb || 2.0) + ' GB) into the H3 pack.'
: (t.install_note || 'The runner-layout adapter release asset is pending.'));
// The pack could have gone away (or arrived) since boot without a reload.
if (!t.available && (document.getElementById('h3_turbo') || {}).value === '1') {
@@ -41572,7 +41969,7 @@ async function h3TurboClick() {
}
return;
}
- const gb = t.download_gb || 1.4;
+ const gb = t.download_gb || 2.0;
if (!confirm('Download the H3 Turbo adapter?\n\n'
+ '~' + gb + ' GB, into the H3 pack’s models folder.\n'
+ 'The LightX2V source adapter is Apache-2.0.\n\n'
@@ -41909,6 +42306,12 @@ function renderTierAxes(engine) {
note.textContent = txt;
note.hidden = !txt;
}
+ // Every LTX repaint settles the Speed row too — one hook covers boot,
+ // shape changes, Load Params and engine switches, and the function
+ // deliberately clears the preset without re-entering this repaint.
+ if (engine === 'ltx' && typeof _applySchedPresetRowVisibility === 'function') {
+ try { _applySchedPresetRowVisibility(); } catch (e) {}
+ }
}
// The shipped name, kept so every H3 call site is unchanged.
function renderH3Axes() { return renderTierAxes('h3'); }
@@ -41971,6 +42374,14 @@ function ltxCurrentCell() {
function ltxCellEta(cell) {
if (!cell) return '';
if (cell.eta === 'custom') return 'custom';
+ // Chips must not advertise the tuned wall clock while the Fast draft
+ // schedule is armed — the same lie the H3 Turbo repaint exists to kill.
+ // fast_eta exists only on cells that can run the preset (server-stamped),
+ // so HQ cells keep their own number untouched.
+ if (cell.fast_eta && typeof schedPresetActive === 'function'
+ && schedPresetActive()) {
+ return cell.fast_eta + ' · fast draft';
+ }
const tail = (cell.pack === 'q8' && cell.pipeline === 'hq') ? ' · Q8 HQ' : '';
return (cell.eta || '') + tail;
}
@@ -43122,8 +43533,11 @@ function snapFramesTo8kPlus1() {
if (!el) return;
const v = parseInt(el.value) || 0;
if (v < 1) { el.value = 9; return; }
- // Nearest 8k+1: round (v-1)/8 to nearest int, multiply back, +1.
- const k = Math.max(1, Math.round((v - 1) / 8));
+ // FLOOR to the 8k+1 grid — never up. Math.round could snap 100 → 105,
+ // which broke the "never render more than you asked for" promise the
+ // hint makes; the server (make_job) floors the same way, so what the box
+ // settles on is what the job records and what the engine delivers.
+ const k = Math.max(1, Math.floor((v - 1) / 8));
const snapped = k * 8 + 1;
if (snapped !== v) {
el.value = snapped;
@@ -43186,14 +43600,30 @@ function updateDerived() {
const warns = [];
// Hailuo H3 counts frames on a 17n+5 grid, not LTX's 8k+1, and its tiers
// are fixed — so the 8k+1 nudge is not just irrelevant there, it's wrong
- // (it told the user 124 was a mistake when 124 is the HQ·5s tier). The
- // 32-alignment rule holds for both engines and stays.
+ // (it told the user 124 was a mistake when 124 is the HQ·5s tier). H3's
+ // canvas rule is /32 (its runner's own grid, stamped from the tier cell
+ // anyway); every LTX lane is TWO-STAGE and floors the canvas to /64 —
+ // warning about /32 there let a 1000-wide request pass while the engine
+ // rendered 960 with a sidecar claiming 1000 (the CUSTOMIZE audit's
+ // "Width × Height LIES" row). Each warning states what WILL render;
+ // make_job normalizes the job to the same numbers.
const _h3Active = document.body.dataset.engine === 'h3';
- if (w % 32 !== 0) warns.push(`Width ${w} isn't a multiple of 32 (closest ${Math.round(w/32)*32})`);
- if (h % 32 !== 0) warns.push(`Height ${h} isn't a multiple of 32 (closest ${Math.round(h/32)*32})`);
+ const _grid = _h3Active ? 32 : 64;
+ if (w % _grid !== 0) {
+ const eff = Math.max(_grid, Math.floor(w / _grid) * _grid);
+ warns.push(_h3Active
+ ? `Width ${w} isn't a multiple of 32 (closest ${Math.round(w / 32) * 32})`
+ : `Width ${w} renders at ${eff} — the two-stage engine needs multiples of 64`);
+ }
+ if (h % _grid !== 0) {
+ const eff = Math.max(_grid, Math.floor(h / _grid) * _grid);
+ warns.push(_h3Active
+ ? `Height ${h} isn't a multiple of 32 (closest ${Math.round(h / 32) * 32})`
+ : `Height ${h} renders at ${eff} — the two-stage engine needs multiples of 64`);
+ }
if (!_h3Active && f > 1 && (f - 1) % 8 !== 0) {
- const closest = Math.max(1, Math.round((f - 1) / 8) * 8 + 1);
- warns.push(`Frames work best as 8k+1 (closest ${closest})`);
+ const eff = Math.max(1, Math.floor((f - 1) / 8) * 8 + 1);
+ warns.push(`Frames snap down to ${eff} (the 8k+1 grid)`);
}
if (temporal === 'fps12_interp24') {
warns.push('12→24fps is experimental; check dialogue lip-sync and fast motion');
@@ -44122,12 +44552,6 @@ async function poll() {
// pack and no add-on must not be told to install the pack they already have.
const q8PackOk = (s.q8_pack_available !== undefined) ? s.q8_pack_available : s.q8_available;
document.body.dataset.q8Pack = q8PackOk ? 'ready' : 'missing';
- // The character chips name Q8 weights, so with no pack on disk they are an
- // install CTA rather than a dead choice — the same contract the High chip has.
- document.querySelectorAll('#qualityGroupCharacter .char-quality').forEach(b => {
- b.classList.toggle('needs-install', !q8PackOk);
- });
-
// The High chip's install state is rendered by renderTierAxes now
// (ltxCellNeedsInstall / ltxCellInstallLabel), so the chip's third slot
// names the download instead of an ETA the user cannot have yet, and a click
@@ -44143,12 +44567,14 @@ async function poll() {
//
// Repaint so the chips follow pack state as a download lands or a file goes
// missing, without a reload.
- if (typeof renderTierAxes === 'function' && document.body.dataset.engine !== 'h3') {
- const packSig = `${s.q8_available}|${(s.q8_missing || []).length}|${(s.hq_addon_missing || []).length}`;
- if (window._lastPackSig !== packSig) {
- window._lastPackSig = packSig;
+ const packSig = `${s.q8_available}|${q8PackOk}|${(s.q8_missing || []).length}|${(s.hq_addon_missing || []).length}`;
+ if (window._lastPackSig !== packSig) {
+ window._lastPackSig = packSig;
+ if (typeof renderTierAxes === 'function' && document.body.dataset.engine !== 'h3') {
try { renderTierAxes('ltx'); } catch (e) {}
}
+ try { renderCharacterStrip(); } catch (e) {}
+ try { charactersRenderChips(); } catch (e) {}
}
// Balanced subtitle: on the "standard" (48–79 GB) tier with Q8 installed,
@@ -44635,7 +45061,17 @@ function applyPackIncompleteGate(s) {
}
};
if (engine !== 'ltx') { clear(); return; }
- const cell = (typeof ltxCurrentCell === 'function') ? ltxCurrentCell() : null;
+ let cell = (typeof ltxCurrentCell === 'function') ? ltxCurrentCell() : null;
+ const charId = (document.getElementById('characterIdInput') || {}).value || '';
+ const charChip = charId
+ ? document.querySelector('#qualityGroupCharacter .char-quality.active') : null;
+ if (charChip) {
+ cell = {
+ pack: charChip.dataset.pack || 'q8',
+ pipeline: charChip.dataset.pipeline || '',
+ quality_label: charChip.querySelector('.ql-name')?.textContent || 'This tier',
+ };
+ }
// The cell knows its pack. Falling back to the raw quality field keeps this
// correct before the table has rendered, and on any surface that sets
// #quality directly.
@@ -44645,7 +45081,10 @@ function applyPackIncompleteGate(s) {
// incomplete BASE pack is already a hard block in the models card above, and
// duplicating it here would give the same fact two voices.
if (pack !== 'q8') { clear(); return; }
- const missing = [].concat(s.q8_missing || [], s.hq_addon_missing || []);
+ const missing = [].concat(
+ s.q8_missing || [],
+ cell && cell.pipeline === 'hq' ? (s.hq_addon_missing || []) : [],
+ );
if (!missing.length) { clear(); return; }
// A pack with NOTHING installed is an install offer, not an incomplete
// download — the High chip's .needs-install state and the Models modal
@@ -45562,6 +46001,12 @@ async function loadParams() {
if (p.width) document.getElementById('width').value = p.width;
if (p.height) document.getElementById('height').value = p.height;
if (p.accel) setAccel(p.accel);
+ // Schedule preset round-trips from day one (the journey audit's rule: a
+ // new field ships WITH its restore path or it joins the 20 orphans).
+ // Always applied — a clip rendered on Tuned must clear a leftover Fast.
+ if (typeof setSchedPreset === 'function') {
+ try { setSchedPreset(p.schedule_preset || ''); } catch (e) {}
+ }
if (p.temporal_mode) setTemporalMode(p.temporal_mode);
if (p.upscale) setUpscale(p.upscale);
if (p.upscale_method) setUpscaleMethod(p.upscale_method);
@@ -45636,8 +46081,46 @@ async function loadParams() {
if (restoredStartImage) pickerSetImage('start_image', restoredStartImage, { snapAspect: false });
if (restoredEndImage) pickerSetImage('end_image', restoredEndImage, { snapAspect: false });
if (p.audio) document.getElementById('audio').value = p.audio;
- // Extend-specific: restore source video path
+ // Extend-specific: restore the WHOLE request, not just the source path.
+ // Duration, direction, sampler depth and CFG were all saved to the sidecar
+ // and never read back — a Load Params + Generate on an Extend silently
+ // re-rendered with the defaults (journey audit, High).
if (p.video_path) document.getElementById('video_path').value = p.video_path;
+ if (p.mode === 'extend') {
+ const extFrames = parseInt(p.extend_frames, 10);
+ if (Number.isFinite(extFrames) && extFrames > 0) {
+ const fEl = document.getElementById('extend_frames');
+ const sEl = document.getElementById('extend_seconds');
+ if (fEl) fEl.value = String(extFrames);
+ // extend_frames counts LATENT frames (8 video frames each at 24 fps);
+ // the visible seconds field derives from it, then the sync refreshes
+ // the hint line with the same arithmetic the input handler uses.
+ if (sEl) sEl.value = String((extFrames * 8) / 24);
+ if (typeof syncExtendDuration === 'function') {
+ try { syncExtendDuration(); } catch (_) {}
+ }
+ }
+ if (p.extend_direction) {
+ const dEl = document.getElementById('extend_direction');
+ if (dEl) dEl.value = p.extend_direction;
+ }
+ const extSteps = parseInt(p.extend_steps, 10);
+ const extCfg = parseFloat(p.extend_cfg);
+ if (Number.isFinite(extSteps)) {
+ const el = document.getElementById('extend_steps');
+ if (el) el.value = String(extSteps);
+ }
+ if (Number.isFinite(extCfg)) {
+ const el = document.getElementById('extend_cfg');
+ if (el) el.value = String(extCfg);
+ }
+ // Reflect the Fast/Quality pills: light the preset that matches the
+ // restored values; a hand-set API pair lights neither (it IS custom).
+ const extMode = (extSteps === 30 && extCfg === 3.0) ? 'quality'
+ : (extSteps === 12 && extCfg === 1.0) ? 'fast' : '';
+ document.querySelectorAll('#extendModeGroup .pill-btn').forEach(b =>
+ b.classList.toggle('active', !!extMode && b.dataset.extendMode === extMode));
+ }
if (p.label) document.getElementById('preset_label').value = p.label;
// Manual-tab Characters picker — restore the selection if the sidecar
@@ -45650,32 +46133,61 @@ async function loadParams() {
// submission.
let lorasForPicker = Array.isArray(p.loras) ? p.loras : null;
if (p.character_id && typeof refreshManualCharacters === 'function') {
- // Re-pull the list so selectManualCharacter has fresh data, then
- // pick the saved character if it still exists on disk.
- (async () => {
- try { await refreshManualCharacters(); } catch (_) {}
+ // AWAITED, and through the real cascade (v4.0.5, owner-reported): the
+ // old restore was a fire-and-forget IIFE that wrote _selectedCharacterId
+ // and the hidden input directly — no avatar ring on slow registry loads,
+ // no quality-strip swap, "Loaded" flashed before the cast existed, and
+ // a character deleted since the render restored to silence. loadParams
+ // is async; there is nothing to gain by not waiting.
+ try { await refreshManualCharacters(); } catch (_) {}
+ const exists = (_manualCharacters || []).some(c => c.id === p.character_id);
+ if (exists) {
+ // The non-toggling hydrator: full cascade, no trigger injection (the
+ // sidecar prompt, already restored above, carries the trigger).
+ try { applyCharacterSelection(p.character_id); } catch (_) {}
+ // The cascade snaps the character-quality strip to its default chip,
+ // which stomps quality + dims — re-assert the CLIP's own record.
+ // Chip first (by the UI token the sidecar carries), then dims.
try {
- const exists = (_manualCharacters || []).some(c => c.id === p.character_id);
- if (exists) {
- // Set hidden input directly — selectManualCharacter would
- // also append the trigger word, but loadParams already set
- // the prompt from the sidecar so re-injecting would duplicate.
- _selectedCharacterId = p.character_id;
- const inp = document.getElementById('characterIdInput');
- if (inp) inp.value = p.character_id;
- if (typeof _renderManualCharactersList === 'function') {
- _renderManualCharactersList();
- }
+ const chipKey = String(p.quality_choice || '').toLowerCase();
+ const strip = document.getElementById('qualityGroupCharacter');
+ const chip = chipKey && strip
+ ? strip.querySelector(`[data-char-quality="${chipKey}"]`) : null;
+ if (chip && typeof _setCharacterQuality === 'function') {
+ _setCharacterQuality(chip, { allowMissing: true });
}
} catch (_) {}
- })();
+ if (p.quality) document.getElementById('quality').value = p.quality;
+ if (p.width) document.getElementById('width').value = p.width;
+ if (p.height) document.getElementById('height').value = p.height;
+ if (p.frames) document.getElementById('frames').value = p.frames;
+ // Explicit No-voice restore (provenance: the sidecar's own value).
+ // Marking it touched stops the prompt auto-default from overriding
+ // a value the user explicitly rendered with.
+ const nv = document.getElementById('noVoice');
+ if (nv && p.no_voice != null && p.no_voice !== '') {
+ nv.checked = (p.no_voice === 'on' || p.no_voice === true
+ || p.no_voice === 'true');
+ if (typeof markNoVoiceTouched === 'function') markNoVoiceTouched();
+ }
+ } else {
+ // FAIL VISIBLY. The saved cast is gone from disk; restoring the rest
+ // of the form silently is how the owner's clip reopened castless with
+ // a green "Loaded" flash on top.
+ if (typeof phosToast === 'function') {
+ phosToast(`This clip's character "${p.character_id}" is no longer in `
+ + 'the library — everything else was restored, but the '
+ + 'cast could not be. Re-train or re-download it to '
+ + 're-render this clip faithfully.', { kind: 'danger' });
+ }
+ }
// BOTH strengths, because the character has two and the sidecar records
// two. Only the face was restored here, so a clip rendered with a
// deliberately hotter or colder voice reopened with the voice silently
// back at its default — Load Params quietly changing the render it claims
// to reload. The hidden inputs are the source the strip re-renders from,
// so setting them and re-rendering restores both sliders and the value the
- // next submit will send.
+ // next submit will send. AFTER the selection cascade, which resets both.
_restoreCharacterStrengths(p);
// Strip the character's face/audio LoRA paths out of the loras list
// so the picker doesn't show duplicate state. The backend will
@@ -45768,6 +46280,28 @@ async function loadParams() {
if (_seedEl && _seedBefore != null) _seedEl.value = _seedBefore;
}
+ // STG round-trips (journey audit, High): the slider only means anything on
+ // an effective HQ pipeline, and a sidecar without the field means the
+ // render ran without it — so absence resets to Off instead of leaving a
+ // stale slider armed for the next submit.
+ const _stgEl = document.getElementById('stgScale');
+ if (_stgEl) {
+ const stg = parseFloat(p.stg_scale);
+ const val = Number.isFinite(stg) ? Math.max(0, Math.min(4, stg)) : 0;
+ _stgEl.value = String(val);
+ const lbl = document.getElementById('stgScaleValue');
+ if (lbl) lbl.textContent = val === 0 ? 'Off' : val.toFixed(1);
+ if (typeof _applyStgRowVisibility === 'function') {
+ try { _applyStgRowVisibility(); } catch (_) {}
+ }
+ }
+ // Repaint the LTX strips AFTER frames landed (journey audit, High): the
+ // programmatic frame assignment fires no input event, so a loaded
+ // 10-second clip used to sit under a Length chip still lit at 5 s.
+ if (_eng !== 'h3' && typeof renderTierAxes === 'function') {
+ try { renderTierAxes('ltx'); } catch (_) {}
+ }
+
updateCustomizeSummary();
updateDerived();
// Say it out loud. This whole function ran silently before — the form
@@ -45983,6 +46517,10 @@ function renderOutputInfoBody(path, data) {
if (p.accel && p.accel !== 'off') {
genRows.push(`<dt>Speed</dt><dd>${escapeHtml(p.accel.replace(/^./, c => c.toUpperCase()))}</dd>`);
}
+ // A non-default schedule changed the take, so the record must name it.
+ if (p.schedule_preset && p.schedule_preset !== 'default') {
+ genRows.push(`<dt>Schedule</dt><dd>${escapeHtml(String(p.schedule_preset))} · draft schedule — a different take than Tuned</dd>`);
+ }
if (accelMetrics && p.accel && p.accel !== 'off') {
const cachedCount = accelMetrics.cached_steps_count || 0;
const totalSteps = accelMetrics.total_steps || p.steps || 0;
@@ -46197,6 +46735,7 @@ document.getElementById('genForm').addEventListener('submit', async e => {
fd.set('negative_prompt', ''); // guidance-distilled: no unconditional branch
fd.set('character_id', ''); // character LoRAs are an LTX construct
fd.set('no_voice', ''); // only ever meant "skip the character's voice LoRA"
+ fd.set('schedule_preset', ''); // an LTX-2.5 distilled schedule; H3 has its own axes
// `loras` IS NOT SCRUBBED, and the line that used to scrub it said "the H3
// runner stacks nothing" — true when it was written, false since the H3
// LoRA import shipped in 3.7.0. H3 takes ONE adapter from its own family
@@ -46338,10 +46877,12 @@ document.getElementById('genForm').addEventListener('submit', async e => {
// No voice — drops the character's audio LoRA server-side (see
// make_job character_id branch) AND nudges the prompt toward ambient
// audio so the model doesn't fill the silence with generic speech.
- // The toggle is only visible when a voice-capable character is
- // selected, so we don't need to gate by character state here.
+ // GATED on a cast character: "only visible when a character is selected"
+ // was the old justification for not checking, and the journey audit
+ // showed the hidden checkbox could stay checked across a mode switch —
+ // quietly rewriting a plain T2V prompt with a no-speech constraint.
const noVoice = document.getElementById('noVoice');
- if (noVoice && noVoice.checked) {
+ if (noVoice && noVoice.checked && (fd.get('character_id') || '')) {
const original = fd.get('prompt') || '';
const constraint = ' Audio: ambient sounds and environmental noise only, no speech, no dialogue, no narration.';
if (!original.toLowerCase().includes('no speech') &&
@@ -48697,18 +49238,27 @@ function _renderCharsAppliedNote() {
// voice to skip.
const note = document.getElementById('charsAppliedNote');
const voicePill = document.getElementById('noVoicePill');
+ // A hidden No-voice pill must never keep a live checkbox: leaving the
+ // check behind let a character-mode "No voice" ride into a later PLAIN
+ // render's prompt as a no-speech constraint (journey audit, High). The
+ // silent-character branch below already cleared it; these two paths —
+ // no selection, selection no longer on disk — did not.
+ const _clearNoVoice = () => {
+ const cb = document.getElementById('noVoice');
+ if (cb) cb.checked = false;
+ };
if (!note) return;
if (!_selectedCharacterId) {
note.hidden = true;
note.innerHTML = '';
- if (voicePill) voicePill.hidden = true;
+ if (voicePill) { voicePill.hidden = true; _clearNoVoice(); }
return;
}
const c = _manualCharacters.find(x => x.id === _selectedCharacterId);
if (!c) {
note.hidden = true;
note.innerHTML = '';
- if (voicePill) voicePill.hidden = true;
+ if (voicePill) { voicePill.hidden = true; _clearNoVoice(); }
return;
}
// Show the No-voice pill only when the active character actually has
@@ -48779,24 +49329,44 @@ function _renderCharsAppliedNote() {
note.hidden = false;
}
-// The character strip's two chips, filled from the server-resolved table. Runs
-// once at boot and again whenever pack presence changes, because the chips are
-// an install CTA when the weights they name are not on disk.
+// The character strip, filled from the server-resolved table. LTX-2.3 gets the
+// two graded-default canvases; LTX-2.5 gets those plus both real HQ qualities.
+// Runs again whenever pack presence changes because every q8 row is an install
+// CTA when its own weights are absent.
function renderCharacterStrip() {
const cfg = ((BOOT.ltx || {}).character) || {};
const group = document.getElementById('qualityGroupCharacter');
- if (!group || !cfg.pro) return;
- [['draft', cfg.draft], ['pro', cfg.pro]].forEach(([key, c]) => {
- if (!c) return;
- const btn = group.querySelector(`[data-char-quality="${key}"]`);
- if (!btn) return;
- btn.title = c.title || '';
- btn.dataset.tooltipDefault = c.title || '';
- const tier = btn.querySelector('.ql-tier');
- if (tier) tier.textContent = c.tier || '';
- const spec = btn.querySelector('.q-spec');
- if (spec) spec.textContent = `${c.width}×${c.height}`;
- });
+ if (!group) return;
+ const rows = Array.isArray(cfg.tokens) && cfg.tokens.length
+ ? cfg.tokens
+ : [cfg.draft, cfg.pro].filter(Boolean);
+ if (!rows.length) return;
+ const previous = group.querySelector('.char-quality.active')?.dataset.charQuality;
+ const keys = rows.map(row => row.key);
+ const current = keys.includes(previous) ? previous
+ : (keys.includes(cfg.default) ? cfg.default : keys[0]);
+ group.style.gridTemplateColumns = `repeat(${rows.length}, 1fr)`;
+ group.innerHTML = rows.map(row => {
+ const needsInstall = typeof ltxCellNeedsInstall === 'function'
+ && ltxCellNeedsInstall(row);
+ const foot = needsInstall && typeof ltxCellInstallLabel === 'function'
+ ? ltxCellInstallLabel(row) : (row.tier || '');
+ const cls = 'q-chip pill-btn pill-quality char-quality'
+ + (row.key === current ? ' active' : '')
+ + (needsInstall ? ' needs-install' : '');
+ return `<button type="button" class="${cls}"
+ data-char-quality="${escapeHtml(row.key)}"
+ data-quality="${escapeHtml(row.quality || cfg.quality || 'high')}"
+ data-width="${Number(row.width || 1024)}"
+ data-height="${Number(row.height || 576)}"
+ data-pack="${escapeHtml(row.pack || 'q8')}"
+ data-pipeline="${escapeHtml(row.pipeline || '')}"
+ title="${escapeHtml(row.title || '')}">
+ <span class="ql-name">${escapeHtml(row.label || row.key)}</span>
+ <span class="q-spec ql-spec sub">${Number(row.width)}×${Number(row.height)}</span>
+ <span class="ql-tier">${escapeHtml(foot)}</span>
+ </button>`;
+ }).join('');
}
// ---- One live-preview model, two consumers ----------------------------------
@@ -49139,6 +49709,20 @@ function renderNowPreview(s, prog, previewData) {
const actions = document.getElementById('nowCardActions');
if (!box) return;
const prev = previewData && previewData.available ? previewData : null;
+ // THE THUMB FOLLOWS THE RENDER'S SHAPE. A fixed 16:9 box center-cropped a
+ // vertical (9:16) preview into a landscape strip of torso — the render's own
+ // params say what shape it is, so the box matches it, clamped so a portrait
+ // thumb widens the card by nothing and grows it by at most ~2x.
+ {
+ const jp = ((s.current || {}).params) || {};
+ const jw = parseInt(jp.width, 10), jh = parseInt(jp.height, 10);
+ if (jw > 0 && jh > 0) {
+ const ar = Math.min(16 / 9, Math.max(9 / 16, jw / jh));
+ box.style.aspectRatio = String(ar);
+ } else {
+ box.style.aspectRatio = '';
+ }
+ }
// A MISSING DECODER MUST SAY SO. Without this, a render on an install whose
// 22 MB decoder never arrived looks identical to one where the user switched
// the preview off: nothing appears, and a feature the release announced simply
@@ -49578,21 +50162,20 @@ async function _charactersManageDelete(cid, btn) {
}
}
-function selectManualCharacter(id) {
- // Click-to-toggle: clicking the currently-active avatar deselects it
- // (2026-05-18 round 3 — the explicit "None" chip is gone; this is
- // how the user clears a selection now). Passing id === '' also
- // deselects, kept for callsites that always want to clear.
- const next = (id === _selectedCharacterId) ? '' : (id || '');
- _selectedCharacterId = next;
+// The NON-TOGGLING setter — the one safe hydrator (journey audit's fix for
+// the owner-reported cast-restore failure). Sets the selection to exactly
+// `id` ('' clears), runs the FULL cascade — hidden input, avatar ring,
+// quality-strip swap, applied-note/No-voice sync — and never injects the
+// trigger into the prompt (Load Params restores the prompt verbatim from
+// the sidecar, which already carries it). Click handlers decide toggle
+// semantics; hydrators call this directly.
+function applyCharacterSelection(id, opts) {
+ opts = opts || {};
+ _selectedCharacterId = id || '';
const inp = document.getElementById('characterIdInput');
if (inp) inp.value = _selectedCharacterId;
- // Auto-insert the trigger word into the prompt so the user doesn't
- // have to remember + retype it. Same UX the LoRA picker uses on
- // toggle (single biggest source of "I selected it but it didn't fire"
- // is the trigger missing from the prompt). Idempotent — skips if the
- // word is already present, case-insensitive.
- if (_selectedCharacterId) {
+ // Trigger injection is CLICK behaviour, not hydration behaviour.
+ if (_selectedCharacterId && opts.injectTrigger) {
const c = _manualCharacters.find(x => x.id === _selectedCharacterId);
if (c && c.trigger && typeof appendTriggerToPrompt === 'function') {
try { appendTriggerToPrompt(c.trigger); } catch (_) {}
@@ -49610,6 +50193,16 @@ function selectManualCharacter(id) {
_applyCharacterQualityStripVisibility();
}
+function selectManualCharacter(id) {
+ // Click-to-toggle: clicking the currently-active avatar deselects it
+ // (2026-05-18 round 3 — the explicit "None" chip is gone; this is
+ // how the user clears a selection now). Passing id === '' also
+ // deselects, kept for callsites that always want to clear. The actual
+ // state change + cascade live in applyCharacterSelection.
+ const next = (id === _selectedCharacterId) ? '' : (id || '');
+ applyCharacterSelection(next, { injectTrigger: true });
+}
+
// Toggle the visibility of the default vs character-only quality strips
// based on whether a character is currently selected. Idempotent — safe
// to call any time the selection state changes.
@@ -49631,7 +50224,7 @@ function _applyCharacterQualityStripVisibility() {
// picked Draft earlier and switched between characters).
const anyActive = char.querySelector('.char-quality.active');
const target = anyActive || char.querySelector('[data-char-quality="pro"]');
- if (target) _setCharacterQuality(target);
+ if (target) _setCharacterQuality(target, { allowMissing: true });
} else {
def.hidden = false;
char.hidden = true;
@@ -49642,141 +50235,123 @@ function _applyCharacterQualityStripVisibility() {
if (typeof setQuality === 'function') {
try { setQuality('balanced'); } catch (_) {}
}
- // 2026-05-17 bug 1.1 (code-review caught): this branch USED to call
- // _setSkipStepEnabled(false) here. That was destructive because:
- // * at boot, _updateCharsPickerVisibility('t2v') fires this else
- // branch (no character selected yet) — and the call clobbered
- // the HTML-default-active Fast pill BEFORE the user ever got
- // to Character mode. First character render then went out with
- // skip_step=0, missing the Codex 12.6% optimization.
- // * the HQ-speed pills in Customize are the source of truth for
- // skip-step now (Pass 6). The character mode cascade should
- // not be touching that state independently.
- // Leaving skip-step where the user put it is the correct semantic:
- // a user who picked "Fast" in HQ-speed before selecting a character
- // gets Fast when they deselect that character too.
- }
-}
-
-// Click handler for the character-only quality chips (Q8 Draft / Q8 Pro).
-// Forces quality=high + sets width/height directly. Both chips submit
-// the same `quality=high` so the backend routes to the HQ pipeline; the
-// resolution distinction is the only difference. Skips setQuality() —
-// that helper would re-derive width/height from QUALITY_PRESETS.high and
-// stomp our 736×416 / 1024×576 character-specific values.
-function _setCharacterQuality(btn) {
+ // (History: a skip-step reset used to live here; the whole HQ Speed
+ // control was removed in v4.0.5 after the audit proved it dead at
+ // the engine boundary, so there is no skip-step state to manage.)
+ }
+}
+
+// Apply one server-resolved character row. ``data-quality`` is the real
+// pipeline token; ``data-char-quality`` is the UI token recorded in the
+// sidecar. Keeping both is what distinguishes Pro from High at 1024×576.
+function _setCharacterQuality(btn, opts) {
if (!btn) return;
+ opts = opts || {};
+ if (btn.classList.contains('needs-install') && !opts.allowMissing) {
+ if (typeof openModelsModal === 'function') openModelsModal();
+ return;
+ }
const group = document.getElementById('qualityGroupCharacter');
if (group) {
group.querySelectorAll('.char-quality').forEach(b =>
b.classList.toggle('active', b === btn));
}
const qInp = document.getElementById('quality');
+ const choiceInp = document.getElementById('quality_choice');
const wInp = document.getElementById('width');
const hInp = document.getElementById('height');
const aspect = document.getElementById('aspect');
const w = parseInt(btn.dataset.width || '1024', 10);
const h = parseInt(btn.dataset.height || '576', 10);
- // RESOLVED SERVER-SIDE, never decided here. On 2.3 this is 'high' (its
- // character LoRAs are dev-trained and distilled inference barely locks
- // identity); on 2.5 it is 'balanced', because q8 + distilled is the exact
- // path every graded 2.5 character clip ran. The markup must not own that
- // rule — two generations each carrying a copy is how they drift.
- if (qInp) qInp.value = ((BOOT.ltx || {}).character || {}).quality || 'high';
+ if (qInp) qInp.value = btn.dataset.quality
+ || ((BOOT.ltx || {}).character || {}).quality || 'high';
+ if (choiceInp) choiceInp.value = btn.dataset.charQuality || 'pro';
// Honor the orientation chip — swap w/h for vertical renders.
const vertical = aspect && aspect.value === 'vertical';
if (wInp) wInp.value = vertical ? h : w;
if (hInp) hInp.value = vertical ? w : h;
- // Skip-step state — Pass 6 moved the toggle to Customize "HQ speed",
- // but the legacy #charSkipstepToggle stub still exists for Load Params
- // restoration. Read whichever is the current source of truth: prefer
- // the new HQ-speed pill state (if Fast pill active, skip=on); fall
- // back to the legacy checkbox; default ON.
- const hqGroup = document.getElementById('hqSpeedGroup');
- const fastActive = hqGroup
- ? hqGroup.querySelector('[data-hq-speed="fast"]')?.classList.contains('active')
- : true;
- const skipToggle = document.getElementById('charSkipstepToggle');
- const skipOn = (hqGroup ? !!fastActive : (skipToggle ? !!skipToggle.checked : true));
- _setSkipStepEnabled(skipOn);
+ // (Skip-step application removed in v4.0.5 — the HQ Speed control was
+ // dead at the engine boundary and no longer exists.)
if (typeof setUpscale === 'function') {
try { setUpscale('fit_720p'); } catch (_) {}
}
if (typeof updateCustomizeSummary === 'function') {
try { updateCustomizeSummary(); } catch (_) {}
}
- // Quality is now 'high'; reveal the HQ-speed row + STG slider.
- if (typeof _applyHqSpeedRowVisibility === 'function') {
- try { _applyHqSpeedRowVisibility(); } catch (_) {}
- }
+ // Quality is now 'high'; reveal the STG slider.
if (typeof _applyStgRowVisibility === 'function') {
try { _applyStgRowVisibility(); } catch (_) {}
}
}
-// Skip-step boost toggle handler. Writes 1/0 into the hidden form
-// inputs that the backend HQ pipeline reads. Standalone function so
-// _setCharacterQuality can re-apply on each chip click + the checkbox
-// onchange handler can call it directly. Also keeps the new Customize
-// "HQ speed" pill row in sync (Pass 6 — the toggle moved out of the
-// Character chip area into Customize).
-function _setSkipStepEnabled(enabled) {
- const v = enabled ? '1' : '0';
- const vSkip = document.getElementById('video_skip_step');
- const aSkip = document.getElementById('audio_skip_step');
- if (vSkip) vSkip.value = v;
- if (aSkip) aSkip.value = v;
- // Mirror state into the new HQ-speed pill row + the legacy checkbox.
- const group = document.getElementById('hqSpeedGroup');
- if (group) {
- const want = enabled ? 'fast' : 'exact';
- group.querySelectorAll('.pill-btn').forEach(b =>
- b.classList.toggle('active', b.dataset.hqSpeed === want));
+// (v4.0.5) _setSkipStepEnabled, _wireHqSpeedPills and
+// _applyHqSpeedRowVisibility are gone with the HQ Speed control: the
+// hidden inputs they wrote were dropped at the engine boundary, so the
+// entire cluster managed state that never reached a render.
+
+// ---- Speed (LTX-2.5 distilled schedule preset) -----------------------------
+// The REAL speed control that replaced the dead one. Server-owned gating:
+// the row shows only when the current tier cell carries `fast_eta`, which
+// the registry stamps only on 2.5 distilled cells.
+function setSchedPreset(v) {
+ const val = (v === 'fast') ? 'fast' : '';
+ const inp = document.getElementById('schedule_preset');
+ if (inp) inp.value = val;
+ document.querySelectorAll('#schedPresetGroup [data-sched-preset]').forEach(b =>
+ b.classList.toggle('active', (b.dataset.schedPreset || '') === val));
+ // Chips re-price under the preset (ltxCellEta reads the hidden input), the
+ // summary names the state — same discipline as H3's Turbo repaint.
+ if (typeof renderTierAxes === 'function') { try { renderTierAxes('ltx'); } catch (e) {} }
+ if (typeof updateDerived === 'function') { try { updateDerived(); } catch (e) {} }
+ if (typeof updateCustomizeSummary === 'function') { try { updateCustomizeSummary(); } catch (e) {} }
+}
+function schedPresetActive() {
+ return (document.getElementById('schedule_preset') || {}).value === 'fast';
+}
+function _applySchedPresetRowVisibility() {
+ const row = document.getElementById('schedPresetRow');
+ if (!row) return;
+ let cell = null;
+ try { cell = ltxCellFor(ltxCurrentQuality(), ltxCurrentLength()); } catch (e) {}
+ const offered = !!(cell && cell.fast_eta)
+ && document.body.dataset.engine !== 'h3';
+ row.hidden = !offered;
+ // A preset the current lane cannot run must not ride on the form — the
+ // server would drop it anyway (make_job gates it), this keeps the UI and
+ // the wire agreeing. Moving to an HQ tier or H3 resets the pill to Tuned.
+ // Direct clear (not setSchedPreset) — this runs from renderTierAxes and
+ // the setter repaints the axes, which would recurse.
+ if (!offered && schedPresetActive()) {
+ const inp = document.getElementById('schedule_preset');
+ if (inp) inp.value = '';
+ document.querySelectorAll('#schedPresetGroup [data-sched-preset]').forEach(b =>
+ b.classList.toggle('active', (b.dataset.schedPreset || '') === ''));
+ }
+ if (offered && cell) {
+ const fastSub = document.getElementById('schedFastSub');
+ if (fastSub) fastSub.textContent = cell.fast_eta + ' · different take';
+ const tunedSub = document.getElementById('schedTunedSub');
+ if (tunedSub) tunedSub.textContent = cell.eta || 'default schedule';
}
- const cb = document.getElementById('charSkipstepToggle');
- if (cb) cb.checked = enabled;
}
-
-// Wire the new Customize "HQ speed" pills (Fast / Exact). Pill click
-// flips the hidden skip-step inputs via _setSkipStepEnabled — same
-// plumbing the character-only toggle used before, just relocated.
-// Visibility (show only when quality=high) is handled separately by
-// _applyHqSpeedRowVisibility called from setQuality + _setCharacterQuality.
-function _wireHqSpeedPills() {
- const group = document.getElementById('hqSpeedGroup');
+function _wireSchedPresetPills() {
+ const group = document.getElementById('schedPresetGroup');
if (!group || group.dataset.wired === '1') return;
group.dataset.wired = '1';
- group.querySelectorAll('.pill-btn').forEach(b => {
+ group.querySelectorAll('[data-sched-preset]').forEach(b => {
b.addEventListener('click', (e) => {
e.preventDefault();
- _setSkipStepEnabled(b.dataset.hqSpeed === 'fast');
+ setSchedPreset(b.dataset.schedPreset || '');
});
});
}
-// Show the HQ speed row only when the active quality is Q8 HQ.
-// Hiding the row deliberately does NOT touch the skip-step values —
-// the Q4 path ignores `video_skip_step` / `audio_skip_step` anyway,
-// and the HTML's default-active Fast pill is the right boot state.
-// Earlier draft reset skip-step to 0 on hide, which clobbered the
-// HTML-default Fast pill at page load (quality starts balanced →
-// row hidden → skip reset to 0 → entering Character mode then read
-// fastActive=false → first character render ran without the
-// optimization).
-function _applyHqSpeedRowVisibility() {
- const row = document.getElementById('hqSpeedRow');
- if (!row) return;
- const q = document.getElementById('quality')?.value || '';
- row.hidden = !_qualityUsesHq(q);
-}
-
// Show the STG "detail guidance" slider only when quality=high (Q8 HQ).
// STG is a no-op on the Q4 distilled paths, so there's nothing to expose
// for Quick/Standard/Balanced. Hiding the row does NOT reset stg_scale —
// the slider's own value persists; the make_job clamp + the helper's
// stg_scale>0 gate mean a stale non-zero value can't engage on a Q4 render
-// anyway (the Q4 dispatch never reads stg_scale). Mirror of
-// _applyHqSpeedRowVisibility so the two HQ-only rows reveal together.
+// anyway (the Q4 dispatch never reads stg_scale).
function _applyStgRowVisibility() {
const row = document.getElementById('stgRow');
if (!row) return;
@@ -49784,17 +50359,17 @@ function _applyStgRowVisibility() {
row.hidden = !_qualityUsesHq(q);
}
-// Wire the char-quality chip clicks once at boot. Idempotent — the
-// `data-wired` flag prevents double-binding on re-render.
+// Delegation survives renderCharacterStrip replacing all four buttons when a
+// pack finishes installing. Idempotent via the data-wired flag.
function _wireCharacterQualityChips() {
const group = document.getElementById('qualityGroupCharacter');
if (!group || group.dataset.wired === '1') return;
group.dataset.wired = '1';
- group.querySelectorAll('.char-quality').forEach(b => {
- b.addEventListener('click', (e) => {
- e.preventDefault();
- _setCharacterQuality(b);
- });
+ group.addEventListener('click', (e) => {
+ const b = e.target.closest('.char-quality');
+ if (!b || !group.contains(b)) return;
+ e.preventDefault();
+ _setCharacterQuality(b);
});
}
@@ -50315,26 +50890,19 @@ document.addEventListener('DOMContentLoaded', () => {
if (typeof _wireCharacterQualityChips === 'function') {
try { _wireCharacterQualityChips(); } catch (e) {}
}
- // Bind the Customize "HQ speed" pills (Pass 6).
- if (typeof _wireHqSpeedPills === 'function') {
- try { _wireHqSpeedPills(); } catch (e) {}
- }
- // Boot the skip-step inputs to match the HTML's default-active Fast
- // pill — without this, the inputs stay at "0" while the pill shows
- // active, and the first character render misses the optimization.
- if (typeof _setSkipStepEnabled === 'function') {
- const fastDefault = document.querySelector('#hqSpeedGroup [data-hq-speed="fast"].active');
- try { _setSkipStepEnabled(!!fastDefault); } catch (e) {}
+ // (HQ Speed pill wiring + skip-step boot init removed in v4.0.5 —
+ // the control was dead at the engine boundary.)
+ // Bind the Speed pills (LTX-2.5 distilled schedule preset). Visibility
+ // settles on every renderTierAxes('ltx') repaint, including boot's.
+ if (typeof _wireSchedPresetPills === 'function') {
+ try { _wireSchedPresetPills(); } catch (e) {}
}
// Apply correct quality-strip visibility based on whether a character
// is already selected (e.g. restored from sidecar / Load Params).
if (typeof _applyCharacterQualityStripVisibility === 'function') {
try { _applyCharacterQualityStripVisibility(); } catch (e) {}
}
- // Apply correct HQ-speed-row + STG-slider visibility based on initial quality.
- if (typeof _applyHqSpeedRowVisibility === 'function') {
- try { _applyHqSpeedRowVisibility(); } catch (e) {}
- }
+ // Apply correct STG-slider visibility based on initial quality.
if (typeof _applyStgRowVisibility === 'function') {
try { _applyStgRowVisibility(); } catch (e) {}
}
@@ -50575,6 +51143,20 @@ function renderVersionPill() {
: `Pulled ${v}. Click Stop → Start in Pinokio to apply.`;
return;
}
+ // Same restart affordance for a checkout that advanced UNDER this
+ // process (a promote landing while a long-lived panel serves) — the
+ // server compares HEAD-on-disk with HEAD-at-boot on every /version.
+ // Without this the 2026-08-14 incident repeats: newer code on disk,
+ // stale code in memory, and nothing anywhere saying so.
+ if (s.stale_process) {
+ pill.classList.add('pill-restart');
+ pill.innerHTML = '<svg class="ph" aria-hidden="true" style="margin-right:4px;vertical-align:-2px"><use href="#ph-arrow-clockwise-bold"/></svg>Restart to finish update';
+ const v = s.disk_version || s.disk_short || 'newer code';
+ pill.title = `Phosphene ${v} is on disk, but this panel process loaded `
+ + `${local} before the update landed. Click Stop → Start in Pinokio `
+ + `(or restart the panel) to load it.`;
+ return;
+ }
// Suppressed (dev branch / dirty tree / no git).
// 2026-05-21 — Mr Bizarro report: Reddit users on dev were confused
// because the pill showed an old VERSION string (e.g. "2.0.5") while
@@ -50633,6 +51215,16 @@ async function versionPillClick() {
alert(tip);
return;
}
+ if ((_versionState || {}).stale_process) {
+ const s = _versionState || {};
+ alert(`Phosphene ${s.disk_version || s.disk_short || '(newer)'} is on `
+ + `disk, but this running panel loaded `
+ + `${s.local_version || s.local_short || 'an older build'} before the `
+ + `update landed.\n\nClick Stop, then Start in Pinokio (or restart `
+ + `the panel process) to load it. Your queue and settings are `
+ + `preserved.`);
+ return;
+ }
const s = _versionState || {};
if (s.suppress_reason) {
// 2026-05-21 — dev-pill click now copies a paste-ready debug string
@@ -50874,7 +51466,7 @@ setMode('t2v');
setAspect('landscape'); // sets aspect first so the default preset orients correctly
setQuality('balanced'); // bundles quality + dims; respects current aspect
applyTierTimes(); // no-op for LTX since v4.0 — the tier table owns those subtitles
-renderCharacterStrip(); // the two character chips, priced per generation
+renderCharacterStrip(); // the generation-scoped character quality ladder
// Engine picker — re-apply the last-used engine after the boot sequence above
// has settled the mode. setEngine() re-runs every gate (capable / installed /
// mode), so a stale localStorage value from a machine that has since lost the
diff --git a/mlx_warm_helper.py b/mlx_warm_helper.py
index 75016ca..1466d67 100644
--- a/mlx_warm_helper.py
+++ b/mlx_warm_helper.py
@@ -2488,6 +2488,14 @@ for line in sys.__stdin__:
num_steps=int(p.get("steps", 8)),
frame_rate=float(p.get("frame_rate", 24.0)),
)
+ # Named schedule preset for the 2.5 distilled lane ("fast" = the
+ # graded 5+2 draft schedule — a DIFFERENT take, priced in the UI).
+ # The panel gates it to the lane that defines it; the engine's
+ # resolver validates it before stage 1 spends GPU. On an older
+ # installed library _filter_unsupported_kwargs drops it with a
+ # log line, so carrying the key is forward-safe by design.
+ if p.get("schedule_preset"):
+ kwargs["schedule_preset"] = str(p["schedule_preset"])
# Y1.037: short-clip VAE-streaming opt-out. Set the env var BEFORE
# generate() so it propagates through the whole chain (the patched
# decode_and_stream reads os.environ at decode call time).
@@ -2845,11 +2853,12 @@ for line in sys.__stdin__:
# the cap IS the iteration count (not just a safety bound).
# Each iter is pure latent algebra — no model forwards.
bongmath_max_iter=int(p.get("bongmath_max_iter", 100)),
- # Upstream HQ exposes skip_step for each modality. The MLX
- # res_2s path now honors it as an opt-in experimental speed
- # knob; 0 preserves the locked recipe.
- video_skip_step=int(p.get("video_skip_step", 0)),
- audio_skip_step=int(p.get("audio_skip_step", 0)),
+ # video_skip_step / audio_skip_step removed (v4.0.5): the
+ # pinned generate_and_save accepts neither kwarg, so
+ # _filter_unsupported_kwargs discarded them every render —
+ # the comment above this line claimed a knob that never
+ # reached the sampler. Wire MultiModalGuiderParams.skip_step
+ # explicitly if the knob is ever wanted for real.
# Stage-2 image-conditioning mode for I2V (HQ).
# "full" = re-encode reference at full res (upstream default)
# "off" = skip the full-res re-encode; saves the biggest
diff --git a/scripts/assert_registry.py b/scripts/assert_registry.py
index 67352df..d810bbc 100644
--- a/scripts/assert_registry.py
+++ b/scripts/assert_registry.py
@@ -235,6 +235,26 @@ eq("2.5 character install copy names its own pack",
eq("the served page contains no unresolved Q8-copy placeholder",
"__Q8_CHARACTER_INSTALL_COPY__" in p.page(), False)
+# One server table drives both character strips. High is an LTX-2.5 feature;
+# the graded q8+distilled Pro row remains the default on both generations.
+_char23 = p.character_strip_payload("ltx23")
+_char25 = p.character_strip_payload("ltx25")
+eq("2.3 character default stays Pro", _char23["default"], "pro")
+eq("2.5 character default stays Pro", _char25["default"], "pro")
+eq("2.3 offers only the graded character canvases",
+ [r["key"] for r in _char23["tokens"]], ["draft", "pro"])
+eq("2.5 offers the full character quality ladder",
+ [r["key"] for r in _char25["tokens"]],
+ ["draft", "pro", "high", "high720"])
+eq("2.5 character tokens resolve to the real quality keys",
+ [r["quality"] for r in _char25["tokens"]],
+ ["balanced", "balanced", "high", "high_720p"])
+eq("2.5 character canvases are exact",
+ [(r["width"], r["height"]) for r in _char25["tokens"]],
+ [(704, 384), (1024, 576), (1024, 576), (1280, 704)])
+eq("both character High rows use the HQ pipeline",
+ [r["pipeline"] for r in _char25["tokens"][2:]], ["hq", "hq"])
+
# =============================================================================
# 5. Completeness — this install, and a synthetic incomplete one
# =============================================================================
@@ -541,8 +561,15 @@ for _key in p.LTX_MEASURED_ETA:
eq(f"measured ETA row {_key} names a real length",
_key[2] in p.LTX_LENGTHS, True)
-# The 720p tier's measurement belongs to the geometry it was taken at, and to
-# NOTHING else: 1280×704 × 121 frames. Any other length must print modelled.
+# Each measured HQ row belongs only to the geometry it was taken at. Other
+# lengths remain modelled.
+eq("high at 5s is the measured row",
+ p.LTX_TIERS["high_5s"]["eta_measured"], True)
+eq("high uses the owner-approved label", p.LTX_TIERS["high_5s"]["eta"], "~4 min")
+eq("...and High is measured at its shipped canvas",
+ (p.LTX_TIERS["high_5s"]["width"],
+ p.LTX_TIERS["high_5s"]["height"],
+ p.LTX_TIERS["high_5s"]["frames"]), (1024, 576, 121))
eq("high_720p at 5s is the measured row",
p.LTX_TIERS["high_720p_5s"]["eta_measured"], True)
eq("...and it is measured at the canvas it was timed on",
@@ -551,12 +578,10 @@ eq("...and it is measured at the canvas it was timed on",
p.LTX_TIERS["high_720p_5s"]["frames"]), (1280, 704, 121))
for _ln in p.LTX_LENGTHS:
if _ln != "5s":
+ eq(f"high at {_ln} is modelled, not measured",
+ p.LTX_TIERS[f"high_{_ln}"]["eta_measured"], False)
eq(f"high_720p at {_ln} is modelled, not measured",
p.LTX_TIERS[f"high_720p_{_ln}"]["eta_measured"], False)
-# `high` lost its measured row when the 491 s number went to the tier whose
-# canvas actually produced it. It must NOT quietly inherit one again.
-eq("high claims no measurement it did not earn",
- any(p.LTX_TIERS[f"high_{_ln}"]["eta_measured"] for _ln in p.LTX_LENGTHS), False)
# =============================================================================
print()
diff --git a/scripts/assert_schedules.py b/scripts/assert_schedules.py
index 27ebb8b..396487d 100644
--- a/scripts/assert_schedules.py
+++ b/scripts/assert_schedules.py
@@ -51,6 +51,7 @@ import importlib.util
import os
import sys
import tempfile
+import types
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
@@ -61,6 +62,52 @@ FAILS: list[str] = []
CHECKS = 0
+def load_scheduler():
+ """Load the checked-in scheduler without initialising an MLX Metal device.
+
+ Every function this gate exercises is pure Python over sigma lists. Importing
+ it through ``ltx_pipelines_mlx`` nevertheless initialises ``mlx.core`` and
+ aborts (not raises) when a CI/sandbox process has no visible Metal device.
+ Load the exact source file with minimal import stubs so this gate remains
+ what its header promises: no GPU, no model load. The stubs provide no
+ schedule logic; all constants and functions under test still come from the
+ vendored file.
+ """
+ names = ("mlx", "mlx.core", "mlx_arsenal", "mlx_arsenal.diffusion")
+ saved = {name: sys.modules.get(name) for name in names}
+ mlx = types.ModuleType("mlx")
+ mx = types.ModuleType("mlx.core")
+ mx.array = lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("this CPU-only gate unexpectedly called mlx.core.array"))
+ mx.bfloat16 = object()
+ mlx.core = mx
+ arsenal = types.ModuleType("mlx_arsenal")
+ diffusion = types.ModuleType("mlx_arsenal.diffusion")
+ diffusion.dynamic_shift_schedule = lambda *args, **kwargs: (_ for _ in ()).throw(
+ AssertionError("this gate unexpectedly reached dynamic_shift_schedule"))
+ arsenal.diffusion = diffusion
+ sys.modules.update({
+ "mlx": mlx, "mlx.core": mx,
+ "mlx_arsenal": arsenal, "mlx_arsenal.diffusion": diffusion,
+ })
+ name = "scheduler_under_test"
+ path = (ROOT / "ltx-2-mlx" / "packages" / "ltx-pipelines-mlx" / "src"
+ / "ltx_pipelines_mlx" / "scheduler.py")
+ spec = importlib.util.spec_from_file_location(name, path)
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[name] = module
+ try:
+ spec.loader.exec_module(module)
+ finally:
+ sys.modules.pop(name, None)
+ for module_name, previous in saved.items():
+ if previous is None:
+ sys.modules.pop(module_name, None)
+ else:
+ sys.modules[module_name] = previous
+ return module
+
+
def check(label: str, fn) -> None:
global CHECKS
CHECKS += 1
@@ -93,6 +140,8 @@ MODE_FORMS = {
"t2v_high": {"mode": "t2v", "quality": "high"},
"i2v": {"mode": "i2v"},
"character": {"mode": "t2v", "character_id": "bizarrotrn"},
+ "character_high": {"mode": "t2v", "character_id": "bizarrotrn",
+ "quality_choice": "high"},
"keyframe": {"mode": "keyframe"},
"extend": {"mode": "extend", "video_path": "/tmp/x.mp4"},
"restore": {"mode": "restore", "restore_video_path": "/tmp/x.mp4"},
@@ -123,6 +172,8 @@ LANE = {
"ingredients": (8, 4, "thin"),
"hdr": (10, 3, "thin"), # <- the stamp made this 10 too
"t2v_high": (10, 3, "build"),
+ "character_high": (10, 3, "build"),
+ "character_high720": (10, 3, "build"),
# keyframe HARDCODES stage1_steps=20 in its job_spec — it never reads
# params — so the stamp never reached it and this fix cannot move it.
# Modelled as "fixed" so the gate does not pretend otherwise.
@@ -132,9 +183,11 @@ DEFAULT_LANE = (8, 2, "thin")
def run() -> None:
- from ltx_pipelines_mlx.scheduler import ( # noqa: PLC0415
- DISTILLED_SIGMAS, STAGE_2_SIGMAS, resolve_distilled_schedule, thin_sigmas,
- )
+ scheduler = load_scheduler()
+ DISTILLED_SIGMAS = scheduler.DISTILLED_SIGMAS
+ STAGE_2_SIGMAS = scheduler.STAGE_2_SIGMAS
+ resolve_distilled_schedule = scheduler.resolve_distilled_schedule
+ thin_sigmas = scheduler.thin_sigmas
# The ceiling every thinning lane lives under, read from the table itself.
CAP1 = len(DISTILLED_SIGMAS) - 1
@@ -147,7 +200,15 @@ def run() -> None:
if len(gen) == 2:
gen = gen + (0,)
- for label, form in MODE_FORMS.items():
+ mode_forms = dict(MODE_FORMS)
+ # High · 720p is intentionally exposed only on LTX-2.5. Exercise it
+ # there without pretending the 2.3 UI offers the token.
+ if version_id == "ltx25":
+ mode_forms["character_high720"] = {
+ "mode": "t2v", "character_id": "bizarrotrn",
+ "quality_choice": "high720",
+ }
+ for label, form in mode_forms.items():
def _one(label=label, form=form, gen=gen, p=p):
job = p.make_job({k: [v] for k, v in form.items()})
prm = job["params"]
diff --git a/scripts/fetch_h3_turbo.py b/scripts/fetch_h3_turbo.py
new file mode 100644
index 0000000..5726d0e
--- /dev/null
+++ b/scripts/fetch_h3_turbo.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python3
+"""Fetch the digest-pinned H3 Turbo runner-layout adapter release asset.
+
+Stdlib-only, because install_h3.js runs it before anything optional exists.
+Streams to `<name>.partial`, resumes with an HTTP Range request when a
+partial is already on disk, verifies the full file's SHA-256 and exact size,
+and renames into place only after both checks pass — a killed or corrupt
+download never leaves a file the panel's resolver would pick up.
+
+The pins below MUST match mlx_ltx_panel.py (H3_TURBO_ASSET_*);
+test_h3_turbo_adapter.py asserts they are identical so they cannot drift.
+"""
+from __future__ import annotations
+
+import argparse
+import hashlib
+import sys
+import urllib.request
+from pathlib import Path
+
+ASSET_NAME = "lightx2v_v1.0_768p_ourlayout.safetensors"
+ASSET_URL = (
+ "https://github.com/mrbizarro/Phosphene/releases/download/"
+ "weights-ltx25-v1/" + ASSET_NAME
+)
+ASSET_SHA256 = "d51d626fe0845da7e5845a47c323cf3f29086d44d24cb1a4b980882488746197"
+ASSET_BYTES = 1956165254
+
+
+def file_sha256(path: Path) -> str:
+ h = hashlib.sha256()
+ with open(path, "rb") as fh:
+ for chunk in iter(lambda: fh.read(1 << 20), b""):
+ h.update(chunk)
+ return h.hexdigest()
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser(description=__doc__)
+ ap.add_argument("--dir", required=True,
+ help="target directory (the H3 pack's turbo-lora/)")
+ args = ap.parse_args()
+
+ target_dir = Path(args.dir)
+ target_dir.mkdir(parents=True, exist_ok=True)
+ target = target_dir / ASSET_NAME
+ partial = target.with_suffix(target.suffix + ".partial")
+
+ if target.is_file():
+ if target.stat().st_size == ASSET_BYTES:
+ print(f"Turbo adapter already present: {target}")
+ return 0
+ # Wrong size can only be a prior bad rename (never ours) or a hand
+ # copy; refuse to guess and make the operator look.
+ print(f"REFUSING: {target} exists with unexpected size "
+ f"{target.stat().st_size} (want {ASSET_BYTES}). "
+ "Move it aside and re-run.", file=sys.stderr)
+ return 1
+
+ have = partial.stat().st_size if partial.is_file() else 0
+ if have >= ASSET_BYTES:
+ # A partial at-or-past full size cannot be trusted as a resume base.
+ partial.unlink()
+ have = 0
+
+ headers = {"User-Agent": "Phosphene"}
+ mode = "ab" if have else "wb"
+ if have:
+ headers["Range"] = f"bytes={have}-"
+ print(f"resuming at {have // (1 << 20)} MB")
+ req = urllib.request.Request(ASSET_URL, headers=headers)
+ written = have
+ try:
+ with urllib.request.urlopen(req, timeout=60) as resp, \
+ open(partial, mode) as fh:
+ if have and resp.status != 206:
+ # Server ignored the Range; start over inside the same call.
+ fh.seek(0)
+ fh.truncate()
+ written = 0
+ while True:
+ chunk = resp.read(1 << 20)
+ if not chunk:
+ break
+ fh.write(chunk)
+ written += len(chunk)
+ except Exception as exc: # noqa: BLE001
+ print(f"TURBO FETCH FAILED at {written // (1 << 20)} MB: {exc} "
+ "(partial kept for resume; panel offers a one-click retry)",
+ file=sys.stderr)
+ return 1
+
+ if written != ASSET_BYTES:
+ print(f"TURBO FETCH INCOMPLETE: {written} of {ASSET_BYTES} bytes "
+ "(partial kept for resume)", file=sys.stderr)
+ return 1
+ digest = file_sha256(partial)
+ if digest != ASSET_SHA256:
+ partial.unlink()
+ print("TURBO DIGEST MISMATCH — partial deleted; "
+ "panel offers a one-click retry", file=sys.stderr)
+ return 1
+ partial.replace(target)
+ print(f"Turbo adapter ready: {target}")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/test_character_roundtrip.py b/test_character_roundtrip.py
index f4bf406..7582c46 100644
--- a/test_character_roundtrip.py
+++ b/test_character_roundtrip.py
@@ -107,7 +107,15 @@ global.charactersOpenCompose = () => {};
global.charactersBackToGrid = () => {};
global.charactersInit = async () => {};
global.setAspect = () => {};
+global.setUpscale = () => {};
global.updateEstimate = () => {};
+global.updateCustomizeSummary = () => {};
+global._applyHqSpeedRowVisibility = () => {};
+global._applyStgRowVisibility = () => {};
+global._setSkipStepEnabled = () => {};
+global.ltxCellNeedsInstall = () => false;
+global.ltxCellInstallLabel = () => 'install needed';
+global.openModelsModal = () => {};
global.localStorage = { getItem: () => null, setItem: () => {}, removeItem: () => {} };
// The loader refuses a character it cannot find — correctly. Seed the list the
// panel would have loaded from /characters.
@@ -174,12 +182,40 @@ def _run_loader(sidecar):
%s
%s
%s
+%s
window.CHARACTERS = %s;
+BOOT.ltx.character = %s;
_mk('characterStrength', {value: ''});
_mk('characterVoiceStrength', {value: ''});
_mk('charactersStrength', {value: '0.8', min: '0.4', max: '1.2'});
_mk('charactersStrengthValue', {textContent: '0.80'});
_mk('width', {value: ''}); _mk('height', {value: ''});
+_mk('quality', {value: 'balanced'}); _mk('quality_choice', {value: ''});
+const _charRows = BOOT.ltx.character.tokens;
+const _charButtons = _charRows.map(row => {
+ const classes = new Set(['char-quality']);
+ if (row.key === BOOT.ltx.character.default) classes.add('active');
+ const b = _mk('_char_' + row.key, {dataset: {
+ charQuality: row.key, quality: row.quality,
+ width: String(row.width), height: String(row.height),
+ }});
+ b.classList = {
+ toggle(k, on) { if (on) classes.add(k); else classes.delete(k); },
+ add(k) { classes.add(k); }, remove(k) { classes.delete(k); },
+ contains(k) { return classes.has(k); },
+ };
+ return b;
+});
+const _charGroup = _mk('qualityGroupCharacter');
+_charGroup.querySelectorAll = (sel) => sel === '.char-quality' ? _charButtons : [];
+_charGroup.querySelector = (sel) => {
+ if (sel === '.char-quality.active') {
+ return _charButtons.find(b => b.classList.contains('active')) || null;
+ }
+ const m = String(sel).match(/data-char-quality="([^"]+)"/);
+ return m ? (_charButtons.find(b => b.dataset.charQuality === m[1]) || null) : null;
+};
+_charGroup.contains = (b) => _charButtons.includes(b);
(async () => {
await charactersLoadParams(%s);
console.log(JSON.stringify({
@@ -189,16 +225,21 @@ _mk('width', {value: ''}); _mk('height', {value: ''});
displayed: document.getElementById('charactersStrengthValue').textContent,
width: document.getElementById('width').value,
height: document.getElementById('height').value,
+ token: document.getElementById('quality_choice').value,
+ quality: document.getElementById('quality').value,
}));
})().catch(e => { console.error(e); process.exit(3); });
""" % (_JS.fn("charactersSyncStrengthControls"),
_JS.fn("_restoreCharacterStrengths"),
_JS.fn("charactersLoadParams"),
- _JS.state(), json.dumps(sidecar))
+ _JS.fn("_setCharacterQuality"),
+ _JS.state(), json.dumps(P.character_strip_payload("ltx25")),
+ json.dumps(sidecar))
return _run_node(script)
-def _run_submit(*, face=1.0, voice=1.0, prompt="bizarrotrn waves"):
+def _run_submit(*, face=1.0, voice=1.0, prompt="bizarrotrn waves",
+ quality="pro"):
"""Execute the REAL charactersGenerate() and capture its HTTP payload.
The old submit test duplicated two expressions from the function under
@@ -216,7 +257,8 @@ window.CHARACTERS.selected = {id: 'bizarrotrn', name: 'Bizarro', trigger: 'bizar
window.CHARACTERS.charStrength = %s;
window.CHARACTERS.voiceStrength = %s;
window.CHARACTERS.duration = '5s';
-window.CHARACTERS.quality = 'pro';
+window.CHARACTERS.quality = %s;
+const CHARACTERS_QUALITY = %s;
_mk('charactersPrompt', {value: %s});
_mk('charactersStrength', {value: '0.8', min: '0.4', max: '1.2'});
_mk('charactersStrengthValue', {textContent: '0.80'});
@@ -241,7 +283,51 @@ global.fetch = async (url, opts) => {
""" % (_JS.fn("charactersUpdateStrengthDisplay"),
_JS.fn("charactersSyncStrengthControls"),
_JS.fn("charactersGenerate"), _JS.state(),
- json.dumps(face), json.dumps(voice), json.dumps(prompt))
+ json.dumps(face), json.dumps(voice), json.dumps(quality),
+ json.dumps([
+ [row["key"], row["label"], row["tier"], row]
+ for row in P.character_strip_payload("ltx25")["tokens"]
+ ]), json.dumps(prompt))
+ return _run_node(script)
+
+
+def _run_character_dom(status: dict | None = None) -> dict:
+ """Render BOTH real character strips from the LTX-2.5 bootstrap rows."""
+ rows = P.character_strip_payload("ltx25")
+ quality_tuples = [
+ [row["key"], row["label"], row["tier"], row]
+ for row in rows["tokens"]
+ ]
+ script = DOM_SHIM + """
+%s
+%s
+%s
+%s
+BOOT.ltx.character = %s;
+BOOT.ltx.packs = %s;
+window.__phosLastStatus = %s;
+window.CHARACTERS = %s;
+const CHARACTERS_DURATION = [];
+const CHARACTERS_QUALITY = %s;
+_mk('qualityGroupCharacter');
+_mk('charactersDurationChips');
+_mk('charactersQualityChips');
+renderCharacterStrip();
+charactersRenderChips();
+console.log(JSON.stringify({
+ manual: document.getElementById('qualityGroupCharacter').innerHTML,
+ tab: document.getElementById('charactersQualityChips').innerHTML,
+}));
+""" % (
+ _JS.fn("ltxCellNeedsInstall"), _JS.fn("ltxCellInstallLabel"),
+ _JS.fn("renderCharacterStrip"), _JS.fn("charactersRenderChips"),
+ json.dumps(rows), json.dumps(P.pack_offers("ltx25")),
+ json.dumps(status or {
+ "q8_available": True, "q8_pack_available": True,
+ "hq_addon_missing": [],
+ }),
+ _JS.state(), json.dumps(quality_tuples),
+ )
return _run_node(script)
@@ -302,6 +388,35 @@ console.log(JSON.stringify({
"the real submit path did not send the voice strength")
+class TestCharacterQualityDOM(unittest.TestCase):
+ """The rendered page exposes the same four rows on both 2.5 surfaces."""
+
+ def test_both_strips_render_four_chips_with_pro_active(self):
+ out = _run_character_dom()
+ for surface, attr_name in (("manual", "data-char-quality"),
+ ("tab", "data-val")):
+ html = out[surface]
+ self.assertEqual(html.count("<button"), 4, surface)
+ for token in ("draft", "pro", "high", "high720"):
+ self.assertIn(f'{attr_name}="{token}"', html, (surface, token))
+ active = re.findall(
+ rf'class="[^"]*\bactive\b[^"]*"[^>]*{attr_name}="([^"]+)"',
+ html,
+ )
+ self.assertEqual(active, ["pro"], (surface, html))
+
+ def test_hq_rows_share_the_main_high_install_gate(self):
+ out = _run_character_dom({
+ "q8_available": False,
+ "q8_pack_available": True,
+ "hq_addon_missing": ["transformer-dev.safetensors"],
+ })
+ for surface in ("manual", "tab"):
+ html = out[surface]
+ self.assertEqual(html.count("needs-install"), 2, html)
+ self.assertRegex(html, r'needs-install[^>]+(?:high|high720)')
+
+
class TestRestoreRunsInBothLoadPaths(unittest.TestCase):
"""The remainder the review found: the live Characters branch returned before
the Manual path's restoration, so NEITHER strength came back."""
@@ -379,6 +494,25 @@ console.log(JSON.stringify({
self.assertEqual(float(out["voice"]), 1.0)
self.assertEqual(out["width"], "1024")
+ def test_bare_legacy_high_now_reopens_as_high_on_ltx25(self):
+ out = _run_loader({
+ "source": "characters", "character_id": "bizarrotrn",
+ "quality": "high", "width": 1024, "height": 576,
+ "frames": 121, "prompt": "x", "seed": 1,
+ })
+ self.assertEqual(out["token"], "high")
+ self.assertEqual(out["quality"], "high")
+
+ def test_explicit_legacy_pro_choice_stays_pro(self):
+ out = _run_loader({
+ "source": "characters", "character_id": "bizarrotrn",
+ "quality": "high", "quality_choice": "pro",
+ "width": 1024, "height": 576, "frames": 121,
+ "prompt": "x", "seed": 1,
+ })
+ self.assertEqual(out["token"], "pro")
+ self.assertEqual(out["quality"], "balanced")
+
class TestDraftCanvasRoundTrips(unittest.TestCase):
"""A Draft render must reopen as Draft — exercised through the real loader's
@@ -427,12 +561,18 @@ class TestServerContract(unittest.TestCase):
def test_full_payload_round_trip(self):
"""payload -> sidecar -> restore -> payload, over the real restorer."""
- for quality, face, voice in (("draft", 1.0, 1.0), ("high", 1.0, 1.0),
- ("draft", 1.15, 0.75), ("high", 0.9, 1.4)):
- w, h = P._CHARACTER_QUALITY_RESOLUTION[quality]
+ rows = {row["key"]: row
+ for row in P.character_strip_payload("ltx25")["tokens"]}
+ for quality, face, voice in (("draft", 1.15, 0.75),
+ ("pro", 1.0, 1.0),
+ ("high", 0.9, 1.4),
+ ("high720", 1.0, 1.25)):
+ row = rows[quality]
+ w, h = row["width"], row["height"]
first = {"character_id": "bizarrotrn", "width": w, "height": h,
"frames": 121, "character_strength": face,
- "character_voice_strength": voice}
+ "character_voice_strength": voice,
+ "quality": row["quality"], "quality_choice": quality}
sidecar = json.loads(json.dumps(first))
sidecar["source"] = "characters"
out = _run_loader(sidecar) # the LIVE loader, not the helper
@@ -440,6 +580,8 @@ class TestServerContract(unittest.TestCase):
self.assertEqual(float(out["voice"]), first["character_voice_strength"], first)
self.assertEqual(out["width"], str(first["width"]), first)
self.assertEqual(out["height"], str(first["height"]), first)
+ self.assertEqual(out["token"], quality, first)
+ self.assertEqual(out["quality"], row["quality"], first)
class TestQueueCharacterVoiceContract(unittest.TestCase):
@@ -534,6 +676,47 @@ class TestQueueCharacterVoiceContract(unittest.TestCase):
"bizarrotrn.audio.safetensors"])
self.assertEqual([x["strength"] for x in params["loras"][:2]],
[0.9, 1.25])
+ self.assertEqual(params["quality"], "balanced")
+ self.assertEqual(params["quality_choice"], "pro")
+
+ def test_all_four_tokens_survive_job_sidecar_and_reload(self):
+ """Real queue payload -> job params/sidecar shape -> real JS loader."""
+ for row in P.character_strip_payload("ltx25")["tokens"]:
+ with self.subTest(token=row["key"]):
+ reply, params = self._post({
+ "mode": "t2v", "character_id": "bizarrotrn",
+ "prompt": "bizarrotrn waves",
+ "quality": row["quality"],
+ "quality_choice": row["key"],
+ "character_strength": "0.9",
+ "character_voice_strength": "1.25",
+ })
+ self.assertEqual(reply["status"], 200, reply)
+ self.assertEqual(params["quality"], row["quality"])
+ self.assertEqual(params["quality_choice"], row["key"])
+ self.assertEqual((params["width"], params["height"]),
+ (row["width"], row["height"]))
+ restored = _run_loader({**params, "source": "characters"})
+ self.assertEqual(restored["token"], row["key"])
+ self.assertEqual(restored["quality"], row["quality"])
+ self.assertEqual((restored["width"], restored["height"]),
+ (str(row["width"]), str(row["height"])))
+
+ def test_high720_job_receipt_is_hq_with_both_character_strengths(self):
+ reply, params = self._post({
+ "mode": "t2v", "character_id": "bizarrotrn",
+ "prompt": "bizarrotrn speaks",
+ "quality_choice": "high720",
+ "character_strength": "0.9",
+ "character_voice_strength": "1.25",
+ })
+ self.assertEqual(reply["status"], 200, reply)
+ self.assertEqual(params["quality"], "high_720p")
+ self.assertEqual(params["quality_choice"], "high720")
+ self.assertEqual((params["width"], params["height"]), (1280, 704))
+ self.assertEqual(P.LTX_QUALITIES[params["quality"]]["pipeline"], "hq")
+ self.assertEqual([x["strength"] for x in params["loras"][:2]],
+ [0.9, 1.25])
def test_every_ltx_video_mode_uses_the_same_pair(self):
modes = ("i2v", "i2v_clean_audio", "extend", "keyframe", "a2v",
@@ -649,15 +832,15 @@ process.stdout.write(JSON.stringify(results));
class TestPipelineQualityPerVersion(unittest.TestCase):
- """The endpoint SUBMITS the pipeline the generation was graded on.
+ """The endpoint defaults to the graded lane and honors first-class HQ.
f65ea9b added character_render_quality() (ltx23 -> high, ltx25 ->
balanced) and fixed the endpoint's `quality` VARIABLE — but the job_form
three screens below still hardcoded "quality": ["high"], and THAT is the
field make_job reads. Every Characters-tab render on 2.5 took the
- two-stage HQ path (~246 s, 29.5 GB add-on) instead of the graded
- q8 + distilled path (~139 s). c366e71 fixed the literal; this class pins
- the property so the variable and the form can never drift apart again.
+ two-stage HQ path instead of the graded q8 + distilled default. c366e71
+ fixed the literal; High is now an explicit, first-class opt-in and the
+ default must remain Pro.
Per this file's own charter, it EXECUTES the real do_POST rather than
grepping for the fixed line: a stub transport carries the request, and
@@ -715,6 +898,16 @@ class TestPipelineQualityPerVersion(unittest.TestCase):
self.assertEqual(P.character_render_quality("ltx23"), "high")
self.assertEqual(P.character_render_quality("ltx25"), "balanced")
+ def test_bootstrap_tokens_are_generation_scoped(self):
+ p23 = P.character_strip_payload("ltx23")
+ p25 = P.character_strip_payload("ltx25")
+ self.assertEqual(p23["default"], "pro")
+ self.assertEqual(p25["default"], "pro")
+ self.assertEqual([row["key"] for row in p23["tokens"]],
+ ["draft", "pro"])
+ self.assertEqual([row["key"] for row in p25["tokens"]],
+ ["draft", "pro", "high", "high720"])
+
def test_every_registered_version_resolves_to_a_real_pipeline(self):
# The endpoint 400s a quality outside _CHARACTER_QUALITY_RESOLUTION —
# a registry entry naming a fantasy pipeline would brick its own tab.
@@ -738,6 +931,21 @@ class TestPipelineQualityPerVersion(unittest.TestCase):
{"prompt": "gatetrn waves", "quality": "balanced"}, "ltx23")
self.assertEqual(form["quality"], ["balanced"])
+ def test_ltx25_hq_tokens_resolve_to_the_real_hq_qualities(self):
+ expected = {
+ "high": ("high", 1024, 576),
+ "high720": ("high_720p", 1280, 704),
+ }
+ for token, (quality, width, height) in expected.items():
+ reply, form = self._generate(
+ {"prompt": "gatetrn waves", "quality": token}, "ltx25")
+ self.assertTrue(reply["payload"].get("ok"), reply)
+ self.assertEqual(form["quality"], [quality], token)
+ self.assertEqual(form["quality_choice"], [token], token)
+ self.assertEqual(form["width"], [str(width)], token)
+ self.assertEqual(form["height"], [str(height)], token)
+ self.assertTrue(P.ltx_quality_uses_hq(quality), token)
+
def test_size_tokens_pick_a_canvas_not_a_pipeline(self):
# The tab's two chips say draft/pro. That must choose WIDTH×HEIGHT and
# leave the pipeline to the generation's rule — conflating the two is
diff --git a/test_geometry_grid.py b/test_geometry_grid.py
new file mode 100644
index 0000000..a8848c8
--- /dev/null
+++ b/test_geometry_grid.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+"""Contract gate for LTX geometry normalization in make_job.
+
+Every registered LTX lane is two-stage: the engine floors the canvas to /64
+and delivers frames on the 8k+1 grid. make_job must record the numbers the
+render will actually produce — a job claiming 1000×500×100 for a render that
+ships 960×448×97 is the CUSTOMIZE audit's "Width × Height LIES" row.
+"""
+from __future__ import annotations
+
+import os
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent
+STATE = Path(tempfile.mkdtemp(prefix="phos-geom-grid-"))
+os.environ["LTX_STATE_DIR"] = str(STATE)
+os.environ["PHOSPHENE_ANALYTICS_DISABLED"] = "1"
+os.environ["PHOSPHENE_DISABLE_VERSION_CHECK"] = "1"
+os.environ.setdefault("LTX_PORT", "8299")
+sys.path.insert(0, str(ROOT))
+
+import mlx_ltx_panel as P # noqa: E402
+
+
+def job_for(form: dict) -> dict:
+ base = {"mode": "t2v", "engine": "ltx", "prompt": "a calm harbor at dawn",
+ "quality": "balanced"}
+ base.update(form)
+ return P.make_job({k: [v] for k, v in base.items()})
+
+
+class TestLtxGeometryGrid(unittest.TestCase):
+ def test_off_grid_canvas_is_floored_to_64(self):
+ p = job_for({"width": "1000", "height": "500"})["params"]
+ self.assertEqual((p["width"], p["height"]), (960, 448))
+
+ def test_on_grid_canvas_is_untouched(self):
+ p = job_for({"width": "1024", "height": "576"})["params"]
+ self.assertEqual((p["width"], p["height"]), (1024, 576))
+
+ def test_off_grid_frames_floor_to_8k_plus_1_never_up(self):
+ # Math.round-style snapping turned 100 into 105 — more frames than
+ # asked for. The rule is floor: 100 → 97.
+ p = job_for({"frames": "100"})["params"]
+ self.assertEqual(p["frames"], 97)
+
+ def test_on_grid_frames_untouched_and_one_frame_allowed(self):
+ self.assertEqual(job_for({"frames": "121"})["params"]["frames"], 121)
+ self.assertEqual(job_for({"frames": "1"})["params"]["frames"], 1)
+
+ def test_tiny_canvas_floors_to_64_not_zero(self):
+ p = job_for({"width": "60", "height": "40"})["params"]
+ self.assertEqual((p["width"], p["height"]), (64, 64))
+
+ def test_h3_geometry_still_comes_from_the_tier_cell(self):
+ # The H3 lane stamps the (quality × length) cell's own geometry over
+ # the form; the LTX grid must not touch it (H3 frames ride 17n+5).
+ p = job_for({"engine": "h3", "width": "1000", "height": "500",
+ "frames": "100"})["params"]
+ tier = P.H3_TIERS[p["h3_tier"]]
+ self.assertEqual((p["width"], p["height"], p["frames"]),
+ (tier["width"], tier["height"], tier["frames"]))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/test_h3_turbo_adapter.py b/test_h3_turbo_adapter.py
index 432ce98..15a7ec1 100644
--- a/test_h3_turbo_adapter.py
+++ b/test_h3_turbo_adapter.py
@@ -1,10 +1,12 @@
#!/usr/bin/env python3
-"""Contract gate for the ordered H3 Turbo adapter resolver."""
+"""Contract gate for the ordered H3 Turbo adapter resolver + pinned installer."""
from __future__ import annotations
+import importlib.util
import os
import sys
import tempfile
+import threading
import unittest
from pathlib import Path
@@ -19,6 +21,12 @@ sys.path.insert(0, str(ROOT))
import mlx_ltx_panel as P # noqa: E402
+def _reset_dl_state():
+ P._set_h3_turbo_dl(status="idle", mb=0,
+ total_mb=P.H3_TURBO_ASSET_BYTES // (1 << 20),
+ error=None)
+
+
class TestH3TurboResolver(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.TemporaryDirectory(prefix="phos-turbo-files-")
@@ -38,9 +46,10 @@ class TestH3TurboResolver(unittest.TestCase):
path.write_bytes(b"runner-layout fixture")
return path
- def test_v1_is_preferred_when_both_exist(self):
+ def test_v1_is_preferred_when_all_three_exist(self):
primary = self.put(P.H3_TURBO_LORA_FILE)
self.put(P.H3_TURBO_FALLBACK_LORA_FILE)
+ self.put(P.H3_TURBO_CKPT500_FILE)
resolved = P.h3_turbo_paths()
self.assertEqual(resolved["lora"], primary)
self.assertEqual(resolved["version"], "v1.0")
@@ -49,8 +58,9 @@ class TestH3TurboResolver(unittest.TestCase):
P.h3_turbo_argv(resolved), ["--lora", f"{primary}:1.0"],
)
- def test_alpha_folded_v01_is_the_only_fallback(self):
+ def test_alpha_folded_v01_beats_ckpt500(self):
fallback = self.put(P.H3_TURBO_FALLBACK_LORA_FILE)
+ self.put(P.H3_TURBO_CKPT500_FILE)
resolved = P.h3_turbo_paths()
self.assertEqual(resolved["lora"], fallback)
self.assertEqual(resolved["version"], "v0.1")
@@ -59,9 +69,21 @@ class TestH3TurboResolver(unittest.TestCase):
P.h3_turbo_argv(resolved), ["--lora", f"{fallback}:1.0"],
)
- def test_raw_v01_and_old_adapter_are_never_selected(self):
+ def test_ckpt500_is_the_last_resort_and_labels_itself(self):
+ # The retired adapter alone keeps Turbo alive (the v4.0.4 regression:
+ # installs that rendered fine on it were un-Turboed by its removal),
+ # but it must resolve LAST and carry the honest fallback flag.
+ retired = self.put(P.H3_TURBO_CKPT500_FILE)
+ resolved = P.h3_turbo_paths()
+ self.assertEqual(resolved["lora"], retired)
+ self.assertEqual(resolved["version"], "ckpt500-EMA")
+ self.assertTrue(resolved["fallback"])
+ self.assertEqual(
+ P.h3_turbo_argv(resolved), ["--lora", f"{retired}:1.0"],
+ )
+
+ def test_raw_v01_is_never_selected(self):
self.put(P.H3_TURBO_RAW_V01_FILE)
- self.put("minimax_h3_turbo_4step_ema_ckpt500.safetensors")
resolved = P.h3_turbo_paths()
self.assertFalse(resolved["files_ok"])
self.assertIsNone(resolved["lora"])
@@ -70,36 +92,112 @@ class TestH3TurboResolver(unittest.TestCase):
class TestH3TurboInstallContract(unittest.TestCase):
- def test_unpublished_repack_fails_closed(self):
- old_paths = P.h3_paths
- old_supported = P.h3_supports_lora
- old_dir = P._h3_turbo_dir
- with tempfile.TemporaryDirectory(prefix="phos-turbo-install-") as tmp:
- target = Path(tmp)
- try:
- P.h3_paths = lambda: {"missing": []}
- P.h3_supports_lora = lambda: True
- P._h3_turbo_dir = lambda: target
- logs = []
- result = P._h3_install_turbo(logs.append)
- finally:
- P.h3_paths = old_paths
- P.h3_supports_lora = old_supported
- P._h3_turbo_dir = old_dir
+ def setUp(self):
+ self.old_paths = P.h3_paths
+ self.old_supported = P.h3_supports_lora
+ self.old_dir = P._h3_turbo_dir
+ self.tmp = tempfile.TemporaryDirectory(prefix="phos-turbo-install-")
+ self.target = Path(self.tmp.name)
+ P.h3_paths = lambda: {"missing": []}
+ P.h3_supports_lora = lambda: True
+ P._h3_turbo_dir = lambda: self.target
+ _reset_dl_state()
+ def tearDown(self):
+ P.h3_paths = self.old_paths
+ P.h3_supports_lora = self.old_supported
+ P._h3_turbo_dir = self.old_dir
+ self.tmp.cleanup()
+ _reset_dl_state()
+
+ def test_install_starts_the_pinned_download(self):
+ started = threading.Event()
+ calls = []
+
+ def fake_download(target_dir, push_log):
+ calls.append(target_dir)
+ started.set()
+
+ logs = []
+ result = P._h3_install_turbo(logs.append, download_fn=fake_download)
+ self.assertTrue(result["ok"])
+ self.assertTrue(result["started"])
+ self.assertEqual(result["asset"], P.H3_TURBO_ASSET_URL)
+ self.assertEqual(result["sha256"], P.H3_TURBO_ASSET_SHA256)
+ self.assertEqual(result["bytes"], P.H3_TURBO_ASSET_BYTES)
+ self.assertTrue(started.wait(timeout=5))
+ self.assertEqual(calls, [self.target])
+
+ def test_second_install_while_active_is_refused(self):
+ gate = threading.Event()
+
+ def blocked_download(target_dir, push_log):
+ gate.wait(timeout=10)
+
+ first = P._h3_install_turbo(lambda _m: None,
+ download_fn=blocked_download)
+ self.assertTrue(first["ok"])
+ second = P._h3_install_turbo(lambda _m: None,
+ download_fn=blocked_download)
+ gate.set()
+ self.assertFalse(second["ok"])
+ self.assertIn("active", second["error"])
+
+ def test_present_adapter_short_circuits(self):
+ (self.target / P.H3_TURBO_LORA_FILE).write_bytes(b"fixture")
+ result = P._h3_install_turbo(lambda _m: None,
+ download_fn=lambda *a: None)
+ self.assertTrue(result["ok"])
+ self.assertFalse(result["started"])
+ self.assertTrue(result["already_installed"])
+
+ def test_missing_h3_and_old_runner_still_refuse(self):
+ P.h3_paths = lambda: {"missing": ["dit (weights absent)"]}
+ result = P._h3_install_turbo(lambda _m: None,
+ download_fn=lambda *a: None)
self.assertFalse(result["ok"])
- self.assertIn(P.H3_TURBO_LORA_FILE, result["error"])
- self.assertIn(P.H3_TURBO_SOURCE_SHA256, result["error"])
- self.assertIn(P.H3_TURBO_RAW_V01_FILE, result["error"])
- self.assertTrue(logs)
+ self.assertIn("isn't fully installed", result["error"])
- def test_installer_records_exact_publication_todo(self):
+ P.h3_paths = lambda: {"missing": []}
+ P.h3_supports_lora = lambda: False
+ result = P._h3_install_turbo(lambda _m: None,
+ download_fn=lambda *a: None)
+ self.assertFalse(result["ok"])
+ self.assertIn("predates Turbo", result["error"])
+
+ def test_status_offers_the_install(self):
+ status = P.h3_turbo_status()
+ self.assertTrue(status["install_available"])
+ self.assertFalse(status["installing"])
+ self.assertIn(P.H3_TURBO_LORA_FILE, status["install_note"])
+
+
+class TestH3TurboPins(unittest.TestCase):
+ def _load_fetch_script(self):
+ spec = importlib.util.spec_from_file_location(
+ "fetch_h3_turbo", ROOT / "scripts" / "fetch_h3_turbo.py")
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+ def test_fetch_script_pins_match_the_panel(self):
+ script = self._load_fetch_script()
+ self.assertEqual(script.ASSET_NAME, P.H3_TURBO_LORA_FILE)
+ self.assertEqual(script.ASSET_URL, P.H3_TURBO_ASSET_URL)
+ self.assertEqual(script.ASSET_SHA256, P.H3_TURBO_ASSET_SHA256)
+ self.assertEqual(script.ASSET_BYTES, P.H3_TURBO_ASSET_BYTES)
+
+ def test_installer_runs_the_digest_checked_fetch(self):
installer = (ROOT / "install_h3.js").read_text(encoding="utf-8")
- self.assertIn("lightx2v_v1.0_768p_ourlayout.safetensors", installer)
+ self.assertIn("scripts/fetch_h3_turbo.py", installer)
+ self.assertIn(P.H3_TURBO_LORA_FILE, installer)
+ self.assertIn(P.H3_TURBO_ASSET_SHA256, installer)
+ # Provenance of the repack stays recorded.
self.assertIn(P.H3_TURBO_SOURCE_FILE, installer)
self.assertIn(P.H3_TURBO_SOURCE_SHA256, installer)
- self.assertIn("release-asset SHA-256: REQUIRED BEFORE WIRING", installer)
self.assertIn(P.H3_TURBO_FALLBACK_LORA_FILE, installer)
+ # The publication TODO is history; a revert would resurrect it.
+ self.assertNotIn("REQUIRED BEFORE WIRING", installer)
if __name__ == "__main__":
diff --git a/test_schedule_preset.py b/test_schedule_preset.py
new file mode 100644
index 0000000..9dfe560
--- /dev/null
+++ b/test_schedule_preset.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python3
+"""Contract gate for the LTX-2.5 distilled `fast` schedule preset.
+
+The engine defines the preset (5+2 forwards, the graded F6S2 draft schedule —
+a DIFFERENT take) and REFUSES named presets on 2.3, so the panel's job is
+lane-gating: the value may ride only on a job that will actually run the
+2.5 distilled pipeline. This gate executes the real `make_job()` and the real
+tier builder rather than grepping for the lines.
+"""
+from __future__ import annotations
+
+import os
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent
+STATE = Path(tempfile.mkdtemp(prefix="phos-sched-preset-"))
+os.environ["LTX_STATE_DIR"] = str(STATE)
+os.environ["PHOSPHENE_ANALYTICS_DISABLED"] = "1"
+os.environ["PHOSPHENE_DISABLE_VERSION_CHECK"] = "1"
+os.environ.setdefault("LTX_PORT", "8298")
+sys.path.insert(0, str(ROOT))
+
+import mlx_ltx_panel as P # noqa: E402
+
+
+def job_for(form: dict) -> dict:
+ base = {"mode": "t2v", "engine": "ltx", "prompt": "a calm harbor at dawn",
+ "quality": "balanced"}
+ base.update(form)
+ return P.make_job({k: [v] for k, v in base.items()})
+
+
+class TestMakeJobLaneGate(unittest.TestCase):
+ def setUp(self):
+ self.old_version = P.ACTIVE_MODEL_VERSION
+
+ def tearDown(self):
+ P.ACTIVE_MODEL_VERSION = self.old_version
+
+ def test_fast_rides_on_the_25_distilled_lane(self):
+ P.ACTIVE_MODEL_VERSION = "ltx25"
+ job = job_for({"schedule_preset": "fast"})
+ self.assertEqual(job["params"]["schedule_preset"], "fast")
+
+ def test_fast_is_dropped_on_the_hq_lane(self):
+ P.ACTIVE_MODEL_VERSION = "ltx25"
+ job = job_for({"schedule_preset": "fast", "quality": "high"})
+ self.assertEqual(job["params"]["schedule_preset"], "")
+
+ def test_fast_is_dropped_on_23(self):
+ # The engine raises on named presets for 2.3 — the gate must drop the
+ # value with a sentence instead of queueing a render into a refusal.
+ P.ACTIVE_MODEL_VERSION = "ltx23"
+ job = job_for({"schedule_preset": "fast"})
+ self.assertEqual(job["params"]["schedule_preset"], "")
+
+ def test_fast_is_dropped_on_h3(self):
+ P.ACTIVE_MODEL_VERSION = "ltx25"
+ job = job_for({"schedule_preset": "fast", "engine": "h3"})
+ self.assertEqual(job["params"]["schedule_preset"], "")
+
+ def test_default_and_bogus_normalize_to_empty(self):
+ P.ACTIVE_MODEL_VERSION = "ltx25"
+ self.assertEqual(
+ job_for({"schedule_preset": "default"})["params"]["schedule_preset"], "")
+ self.assertEqual(
+ job_for({"schedule_preset": "warp9"})["params"]["schedule_preset"], "")
+ self.assertEqual(
+ job_for({})["params"]["schedule_preset"], "")
+
+ def test_worker_forwards_the_preset_to_the_helper_spec(self):
+ # The seam between make_job and the engine: the generate dispatch
+ # copies params["schedule_preset"] into the helper job_spec. Executed
+ # indirectly — the dispatch expression is `p.get("schedule_preset")
+ # or ""`, so the contract is: a truthy value survives, absence
+ # becomes "". Kept as an executable expression, not a grep.
+ p = {"schedule_preset": "fast"}
+ self.assertEqual(p.get("schedule_preset") or "", "fast")
+ self.assertEqual({}.get("schedule_preset") or "", "")
+
+
+class TestTierTableStampsFastOnlyWhereItRuns(unittest.TestCase):
+ def setUp(self):
+ self.old_version = P.ACTIVE_MODEL_VERSION
+
+ def tearDown(self):
+ P.ACTIVE_MODEL_VERSION = self.old_version
+
+ def test_25_distilled_cells_carry_fast_eta_and_hq_cells_do_not(self):
+ P.ACTIVE_MODEL_VERSION = "ltx25"
+ tiers = P._build_ltx_tiers()
+ distilled = [t for t in tiers.values() if t["pipeline"] != "hq"]
+ hq = [t for t in tiers.values() if t["pipeline"] == "hq"]
+ self.assertTrue(distilled and hq, "registry lost a lane")
+ for cell in distilled:
+ self.assertIn("fast_eta", cell, cell["key"])
+ self.assertIn("fast_min", cell, cell["key"])
+ # Fewer forwards can never cost more.
+ self.assertLessEqual(cell["fast_min"], cell["eta_min"], cell["key"])
+ for cell in hq:
+ self.assertNotIn("fast_eta", cell, cell["key"])
+
+ def test_23_cells_carry_no_fast_pricing_at_all(self):
+ P.ACTIVE_MODEL_VERSION = "ltx23"
+ tiers = P._build_ltx_tiers()
+ for cell in tiers.values():
+ self.assertNotIn("fast_eta", cell, cell["key"])
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)