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.

fix: pre-ship batch — A2V pure mode + status progress + leak sweep + /version/pull guard

mrbizarro6f8b4da34694
diff --git a/docs/API.md b/docs/API.md
index a9cc3cb..22cd10c 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -54,8 +54,8 @@ Add a job to the panel's queue. Returns immediately; the helper renders it async
```json
[
- {"path": "/Users/salo/pinokio/api/phosphene-dev.git/mlx_models/loras/ariatrn_v2.safetensors", "strength": 1.0},
- {"path": "/Users/salo/pinokio/api/phosphene-dev.git/mlx_models/loras/ariatrn.audio.safetensors", "strength": 1.0}
+ {"path": "<panel-root>/mlx_models/loras/ariatrn_v2.safetensors", "strength": 1.0},
+ {"path": "<panel-root>/mlx_models/loras/ariatrn.audio.safetensors", "strength": 1.0}
]
```
@@ -75,7 +75,7 @@ curl -s -X POST http://127.0.0.1:8199/queue/add \
--data-urlencode "bongmath_max_iter=100" --data-urlencode "accel=off" \
--data-urlencode "enhance=false" --data-urlencode "upscale=fit_720p" \
--data-urlencode "upscale_method=lanczos" --data-urlencode "seed=-1" \
- --data-urlencode 'loras=[{"path":"/Users/salo/pinokio/api/phosphene-dev.git/mlx_models/loras/bizarrotrn_v2.safetensors","strength":1.0},{"path":"/Users/salo/pinokio/api/phosphene-dev.git/mlx_models/loras/bizarrotrn.audio.safetensors","strength":1.0}]'
+ --data-urlencode 'loras=[{"path":"<panel-root>/mlx_models/loras/bizarrotrn_v2.safetensors","strength":1.0},{"path":"<panel-root>/mlx_models/loras/bizarrotrn.audio.safetensors","strength":1.0}]'
```
### `POST /run` — alias for `/queue/add` (identical behavior).
@@ -456,7 +456,8 @@ def wait_terminal(job_id, timeout=1800):
raise TimeoutError(f"job {job_id} did not finish")
if __name__ == "__main__":
- LORAS_DIR = "/Users/salo/pinokio/api/phosphene-dev.git/mlx_models/loras"
+ # Adjust to wherever your Phosphene install lives:
+ LORAS_DIR = "<panel-root>/mlx_models/loras"
job_id = submit(
prompt="Cinematic close-up of bizarrotrn man in a wood-paneled study, photorealistic.",
loras=[
diff --git a/image_engine.py b/image_engine.py
index c228114..b07c0a2 100644
--- a/image_engine.py
+++ b/image_engine.py
@@ -57,6 +57,7 @@ tier-aware default table.
from __future__ import annotations
import json
+import os
import threading
import time
import urllib.error
@@ -1166,7 +1167,29 @@ def _generate_bfl(prompt: str, n: int, width: int, height: int,
# settings UI can surface a precise error if either is missing.
# ---------------------------------------------------------------------------
-HIDREAM_LAB_DIR = Path("/Users/salo/HIDREAM-O1-MLX-LAB-active")
+# HiDream-O1 MLX lab — the standalone repo that ships the BF16 generator
+# script + custom_heads.safetensors. Public installs that want to enable
+# the HiDream engine point this at their checkout via
+# ``HIDREAM_LAB_DIR`` (env). Default lives just outside the home dir so
+# Pinokio cleanup never touches it; if the env var isn't set, falls back
+# to ``~/HIDREAM-O1-MLX-LAB-active`` and ``~/AI/HIDREAM-O1-MLX-LAB-active``
+# in that order. The health check below reports clearly when neither
+# exists so users know to clone the lab.
+def _resolve_hidream_lab_dir() -> Path:
+ env_p = os.environ.get("HIDREAM_LAB_DIR")
+ if env_p:
+ return Path(env_p).expanduser()
+ home = Path.home()
+ for cand in (home / "HIDREAM-O1-MLX-LAB-active",
+ home / "AI" / "HIDREAM-O1-MLX-LAB-active",
+ home / "AI" / "projects" / "HIDREAM-O1-MLX-LAB-active"):
+ if cand.exists():
+ return cand
+ # Return the most conventional location even if it doesn't exist —
+ # the health check surfaces a clean error from here.
+ return home / "HIDREAM-O1-MLX-LAB-active"
+
+HIDREAM_LAB_DIR = _resolve_hidream_lab_dir()
HIDREAM_DEFAULT_PY = HIDREAM_LAB_DIR / ".venv" / "bin" / "python"
# BF16 (no quantization) is the only precision that doesn't accumulate visible
# patch-grid artifacts. Upstream loads weights in fp32 + autocasts to bf16;
diff --git a/install_qwen.js b/install_qwen.js
index 7182887..00c6086 100644
--- a/install_qwen.js
+++ b/install_qwen.js
@@ -57,6 +57,26 @@ module.exports = {
// The 0.17.5 baseline shipped Edit-2509 multi-image fixes
// (vision encoder save bug) and is the bottom of our FBCache
// patch contract.
+ //
+ // Two-step install (P2 fix 2026-05-18). The previous
+ // single-step `pip install --force-reinstall --no-deps` left
+ // mflux's transitive dependencies (transformers, accelerate,
+ // sentencepiece, ...) MISSING on fresh installs, so the very
+ // first attempt to call mflux silently ImportError'd inside a
+ // subprocess and the panel reported "engine not installed"
+ // instead of working. New shape:
+ // Step 1: install WITH deps so pip resolves the full
+ // transitive set.
+ // Step 2: force-reinstall the same version WITHOUT deps so
+ // pip never silently bumps a transitive dep when we
+ // re-run later.
+ message: "./ltx-2-mlx/env/bin/pip install 'mflux==0.17.5'"
+ }
+ },
+ {
+ method: "shell.run",
+ params: {
+ // Pin-tightening pass — see two-step rationale above.
message: "./ltx-2-mlx/env/bin/pip install --force-reinstall --no-deps 'mflux==0.17.5'"
}
},
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index d79192a..512533f 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -1604,8 +1604,11 @@ def _character_dataset_image(trigger: str) -> Path | None:
avatar = char_dir / f"avatar{ext}"
if avatar.is_file():
return avatar
- # 2 + 3. lora-lab conventions (legacy / manual).
- lab_root = Path("/Users/salo/AI/projects/lora-lab")
+ # 2 + 3. lora-lab conventions (legacy / manual). LORA_LAB_ROOT is
+ # the vendored install dir by default; the LTX_LORA_LAB_ROOT env
+ # var can repoint it at an external authoring tree (e.g.
+ # ~/AI/projects/lora-lab) for in-place iteration.
+ lab_root = LORA_LAB_ROOT
stem = trigger[:-3] if trigger.endswith("trn") else trigger
candidates = [
lab_root / f"dataset_{stem}_v2" / "images" / f"{trigger}_001.png",
@@ -5882,10 +5885,24 @@ def run_job_inner(job: dict) -> None:
job["raw_path"] = str(out_path)
# Optional reference image — when present the pipeline anchors
# frame 0 the same way I2V does. When absent it's pure A2V.
+ #
+ # make_job() defaults `image` to the panel's example REFERENCE
+ # (examples/reference.png) so every job spec carries it whether
+ # the user picked anything or not. The Audio tab UI only POSTs
+ # `image=` when a ref slot is actually filled; the make_job
+ # default is what we have to filter out here, otherwise pure
+ # A2V silently runs image-conditioned with the canned reference
+ # PNG and the user has no idea why their A2V looks the same
+ # every time. Treat the panel defaults as "no image" and only
+ # promote to a real ref when the user genuinely picked one.
ref_image_path = p.get("image") if p.get("image") else None
- # The panel ships the reference path defaulted to examples/reference.png
- # via AUDIO_DEFAULT-style fallback; only treat as a "real" image if
- # the user actually picked something distinct from the inert default.
+ if ref_image_path:
+ try:
+ resolved = Path(ref_image_path).resolve()
+ if resolved == REFERENCE.resolve():
+ ref_image_path = None
+ except (OSError, ValueError):
+ pass
if ref_image_path and not Path(ref_image_path).exists():
ref_image_path = None
# LoRAs flow through unchanged — useful for character A2V.
@@ -7039,10 +7056,23 @@ class Handler(BaseHTTPRequestHandler):
# Y1.039 — per-job progress for the Now-card. Phase-aware,
# config-bucketed ETA, denoise-step extrapolation. Replaces the
# old elapsed/global-avg ratio that mis-paced Quick/High renders.
+ #
+ # Train jobs OWN their own progress dict — the trainer writes
+ # step / phase / eta directly into STATE["current"]["progress"]
+ # at runtime (see run_train_job_inner around line 5212 for the
+ # face phase and 5461 for the voice phase). _compute_progress
+ # is built around the video helper's log-tail format and would
+ # blindly stamp a "phase=setup" snapshot on top of the trainer's
+ # real "Training face · step N / total", making the Now card
+ # appear stuck at Loading pipeline. Skip the override when the
+ # job mode is "train".
if payload.get("current"):
- payload["current"]["progress"] = _compute_progress(
- payload["current"], payload.get("log") or [],
- )
+ _mode = ((payload["current"].get("params") or {})
+ .get("mode") or "").lower()
+ if _mode != "train":
+ payload["current"]["progress"] = _compute_progress(
+ payload["current"], payload.get("log") or [],
+ )
payload["helper"] = {
"alive": HELPER.is_alive(), "pid": HELPER.pid(),
"low_memory": HELPER_LOW_MEMORY == "true",
@@ -7506,7 +7536,7 @@ class Handler(BaseHTTPRequestHandler):
# lora-lab dataset tree (legacy / manual characters) OR the
# panel-owned characters cache (new Train-tab avatars).
try:
- lab_root = Path("/Users/salo/AI/projects/lora-lab").resolve()
+ lab_root = LORA_LAB_ROOT.resolve()
char_root = _CHARACTERS_CACHE_PATH.resolve()
resolved = sample.resolve()
in_lab = resolved.is_relative_to(lab_root)
@@ -9747,6 +9777,58 @@ class Handler(BaseHTTPRequestHandler):
_VERSION_STATE["pull_pulled_to_version"] = None
_VERSION_STATE["pull_requires_full_update"] = False
try:
+ # Server-side guard (P2 hardening 2026-05-18). The UI already
+ # refuses to surface the magic Update button unless the
+ # local repo is clean + on main + with no local commits
+ # ahead, but a malicious POST could otherwise bypass that
+ # and silently trigger `reset --hard` on the user's repo.
+ # Re-validate here so the endpoint never destroys local
+ # work without explicit ?force=1 opt-in.
+ cur_branch = (_git_capture(
+ ["rev-parse", "--abbrev-ref", "HEAD"]) or "").strip()
+ if cur_branch != "main":
+ self._json({
+ "ok": False,
+ "error": (
+ f"refusing to pull: local repo is on '{cur_branch}', "
+ f"not 'main'. Switch to main or run a fresh Pinokio "
+ f"install if you didn't intend to be on a side branch."
+ ),
+ }, 409)
+ return
+ # `git status --porcelain` is empty iff the working tree is
+ # clean. The UI's clean-check uses the same probe.
+ dirty = (_git_capture(["status", "--porcelain"]) or "").strip()
+ if dirty:
+ self._json({
+ "ok": False,
+ "error": (
+ "refusing to pull: local working tree has "
+ "uncommitted changes. Commit, stash, or discard "
+ "them, then click Update again."
+ ),
+ "dirty_files": dirty.splitlines()[:20],
+ }, 409)
+ return
+ # Block if there are local commits ahead of origin — those
+ # would be wiped by the reset --hard fallback below.
+ ahead = (_git_capture(
+ ["rev-list", "--count", "origin/main..HEAD"]) or "0").strip()
+ try:
+ ahead_n = int(ahead)
+ except ValueError:
+ ahead_n = 0
+ if ahead_n > 0:
+ self._json({
+ "ok": False,
+ "error": (
+ f"refusing to pull: local has {ahead_n} commit(s) "
+ f"ahead of origin/main. Push them or reset manually "
+ f"if you don't need them."
+ ),
+ }, 409)
+ return
+
# Capture HEAD before the pull so we can diff afterwards.
pre_sha = _git_capture(["rev-parse", "HEAD"]) or ""
# Step 1: fetch — populates origin/main without touching HEAD.
@@ -9768,9 +9850,9 @@ class Handler(BaseHTTPRequestHandler):
# Step 3: if the fast-forward refused (history diverged from
# origin — e.g. because of a past force-push that scrubbed
# commit identities), fall back to a hard reset onto
- # origin/main. A Pinokio-installed panel is not a place
- # users keep local commits, so this is the Right Thing —
- # it's what they meant by clicking Update.
+ # origin/main. Guards above already proved this is safe
+ # (clean tree + on main + nothing ahead), so the reset just
+ # snaps the diverged history back to upstream.
if pull_proc.returncode != 0:
reset_proc = subprocess.run(
["git", "-C", str(ROOT), "reset", "--hard", "origin/main"],
@@ -19649,11 +19731,16 @@ function audioStudioRenderSlots() {
const dur = (AUDIO_STUDIO.audioDuration != null)
? ' · ' + AUDIO_STUDIO.audioDuration.toFixed(1) + ' s'
: '';
+ // escapeHtml — user-supplied filename can contain &, <, >, ", '
+ // that would otherwise break out of innerHTML into attribute/tag
+ // context. Same defense the rest of the panel uses for any user
+ // string that ends up in innerHTML.
+ const safeName = escapeHtml(AUDIO_STUDIO.audioName || 'audio');
audioSlot.innerHTML =
'<span class="ref-tag">Audio</span>' +
'<div style="padding:18px 12px;text-align:center;font-size:12px;color:var(--text);overflow:hidden;text-overflow:ellipsis;">' +
'<svg class="ph" aria-hidden="true" style="width:18px;height:18px;vertical-align:-3px;margin-right:6px;"><use href="#ph-music-notes"/></svg>' +
- (AUDIO_STUDIO.audioName || 'audio') + dur +
+ safeName + dur +
'<div class="hint" style="margin-top:8px;">' +
'<a href="#" onclick="event.stopPropagation();audioStudioClearAudio();return false;">Remove</a>' +
'</div>' +
diff --git a/required_files.json b/required_files.json
index 50ffaea..24787da 100644
--- a/required_files.json
+++ b/required_files.json
@@ -8,7 +8,7 @@
"key": "q4",
"kind": "base",
"name": "LTX 2.3 — Q4 (base model, distilled)",
- "blurb": "Required. Drives Standard / Draft renders.",
+ "blurb": "Required. Drives Quick / Balanced / Standard renders.",
"repo_id": "dgrauet/ltx-2.3-mlx-q4",
"local_dir": "mlx_models/ltx-2.3-mlx-q4",
"size_gb": 20,