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.

Wire High quality tier — Q8 two-stage HQ + TeaCache

mrbizarroc7a42bd02f5a
diff --git a/README.md b/README.md
index 3448ce3..52fb9ba 100644
--- a/README.md
+++ b/README.md
@@ -105,10 +105,17 @@ Same-seed re-roll is the workflow: pick a seed at Draft (cheap), confirm at Stan
Q8 is a separate download. Run this one-time inside the Pinokio install dir (or the manual install dir):
```bash
+# Pinokio install: huggingface-cli is on PATH via the "ai" bundle
huggingface-cli download dgrauet/ltx-2.3-mlx-q8 --local-dir mlx_models/ltx-2.3-mlx-q8
+
+# Manual install: use the Python API (works on any huggingface_hub version)
+ltx-2-mlx/.venv/bin/python3.11 -c \
+ "from huggingface_hub import snapshot_download; \
+ snapshot_download(repo_id='dgrauet/ltx-2.3-mlx-q8', \
+ local_dir='mlx_models/ltx-2.3-mlx-q8', max_workers=8)"
```
-The panel auto-detects Q8 on disk and enables the High option in the dropdown.
+The panel auto-detects Q8 on disk and enables the High option in the dropdown within ~2 seconds.
## Configuration via env vars
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 2910c7c..168df03 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -500,6 +500,7 @@ def make_job(form: dict[str, list[str]] | dict[str, str], *,
"stop_comfy": f("stop_comfy", "off") == "on",
"open_when_done": f("open_when_done", "off") == "on",
"label": f("preset_label", "") or None,
+ "quality": f("quality", "standard"), # draft / standard / high
},
"command": None,
"raw_path": None,
@@ -564,28 +565,61 @@ def run_job_inner(job: dict) -> None:
# T2V / I2V / I2V+clean_audio
width, height = p["width"], p["height"]
frames = p["frames"]
+ quality = p.get("quality", "standard")
pad_w, pad_h, pad_filter = compute_pad(width, height)
suffix = f"{pad_w}x{pad_h}" if mode == "i2v_clean_audio" and pad_filter else f"{width}x{height}"
- raw_out = OUTPUT / f"mlx_{mode}_{width}x{height}_{frames}f_{stamp}_raw.mp4"
- final_out = OUTPUT / f"mlx_{mode}_{suffix}_{frames}f_{stamp}.mp4"
+ tag = f"{mode}_hq" if quality == "high" else mode
+ raw_out = OUTPUT / f"mlx_{tag}_{width}x{height}_{frames}f_{stamp}_raw.mp4"
+ final_out = OUTPUT / f"mlx_{tag}_{suffix}_{frames}f_{stamp}.mp4"
job["raw_path"] = str(raw_out)
- job_spec = {
- "action": "generate",
- "id": job["id"],
- "params": {
- "mode": mode,
- "prompt": p["prompt"],
- "output_path": str(raw_out),
- "height": height,
- "width": width,
- "frames": frames,
- "steps": p["steps"],
- "seed": p["seed"],
- "image": p["image"] if mode != "t2v" else None,
- },
- }
- push(f"Run via helper: id={job['id']} mode={mode} {width}x{height} {frames}f")
+ if quality == "high":
+ # Route to TwoStageHQPipeline (Q8 dev model + res_2s sampler + CFG anchor + TeaCache).
+ # Defaults from ltx-2-mlx CLAUDE.md LTX_2_3_PARAMS.
+ if not Q8_LOCAL_PATH.exists() or not any(Q8_LOCAL_PATH.iterdir() if Q8_LOCAL_PATH.is_dir() else []):
+ raise RuntimeError(
+ f"High quality requires Q8 model at {Q8_LOCAL_PATH}. "
+ f"Run: huggingface-cli download {MODEL_ID_HQ} --local-dir {Q8_LOCAL_PATH}"
+ )
+ job_spec = {
+ "action": "generate_hq",
+ "id": job["id"],
+ "params": {
+ "model_dir": str(Q8_LOCAL_PATH),
+ "prompt": p["prompt"],
+ "output_path": str(raw_out),
+ "height": height,
+ "width": width,
+ "frames": frames,
+ "seed": p["seed"],
+ "image": p["image"] if mode != "t2v" else None,
+ "stage1_steps": 15,
+ "stage2_steps": 3,
+ "cfg_scale": 3.0,
+ "stg_scale": 1.0,
+ "enable_teacache": True,
+ "teacache_thresh": 1.0,
+ },
+ }
+ push(f"Run HIGH via helper: id={job['id']} mode={mode} {width}x{height} {frames}f · Q8 two-stage HQ + TeaCache")
+ else:
+ # Draft / Standard — Q4 one-stage with steps from form.
+ job_spec = {
+ "action": "generate",
+ "id": job["id"],
+ "params": {
+ "mode": mode,
+ "prompt": p["prompt"],
+ "output_path": str(raw_out),
+ "height": height,
+ "width": width,
+ "frames": frames,
+ "steps": p["steps"],
+ "seed": p["seed"],
+ "image": p["image"] if mode != "t2v" else None,
+ },
+ }
+ push(f"Run via helper: id={job['id']} mode={mode} quality={quality} {width}x{height} {frames}f")
result = HELPER.run(job_spec)
if "seed_used" in result:
diff --git a/mlx_warm_helper.py b/mlx_warm_helper.py
index 96986ad..f9ae1fa 100644
--- a/mlx_warm_helper.py
+++ b/mlx_warm_helper.py
@@ -97,6 +97,8 @@ threading.Thread(target=idle_reaper, daemon=True).start()
_t2v_pipe = None
_i2v_pipe = None
_extend_pipe = None
+_hq_pipe = None # TwoStageHQPipeline (Q8, res_2s + CFG, optional TeaCache)
+_hq_model_dir = None # remember which model the HQ pipe was built against
_pipe_lock = threading.Lock()
@@ -129,6 +131,26 @@ def get_pipe(kind: str):
return _t2v_pipe
+def get_hq_pipe(model_dir: str):
+ """Returns the TwoStageHQPipeline lazily — Q8 model, res_2s sampler, CFG anchor.
+
+ Same class handles both T2V (image=None) and I2V via the `image` kwarg of
+ `generate_and_save`. We rebuild the pipe if the requested model_dir changes
+ (e.g. user swapped Q8 for a different quant).
+ """
+ global _hq_pipe, _hq_model_dir
+ from ltx_pipelines_mlx.ti2vid_two_stages_hq import TwoStageHQPipeline
+
+ with _pipe_lock:
+ if _hq_pipe is None or _hq_model_dir != model_dir:
+ emit({"event": "log", "line": f"Loading HQ pipeline (Q8 dev model — {model_dir})..."})
+ _hq_pipe = TwoStageHQPipeline(
+ model_dir=model_dir, gemma_model_id=GEMMA_PATH, low_memory=LOW_MEMORY,
+ )
+ _hq_model_dir = model_dir
+ return _hq_pipe
+
+
# ---- image preprocessing -----------------------------------------------------
def cover_crop_to_size(src_path: str, w: int, h: int) -> str:
@@ -294,6 +316,54 @@ for line in sys.__stdin__:
_is_busy = False
continue
+ if action == "generate_hq":
+ # Q8 two-stage HQ + optional TeaCache. Same TwoStageHQPipeline handles
+ # T2V (image=None) and I2V via the `image` kwarg.
+ job_id = msg.get("id", "?")
+ p = msg.get("params", {}) or {}
+ model_dir = p.get("model_dir") or MODEL_ID # fallback if user forgot
+ seed = int(p.get("seed", -1))
+ if seed == -1:
+ seed = random.randint(0, 2**31 - 1)
+ _is_busy = True
+ try:
+ t0 = time.time()
+ pipe = get_hq_pipe(model_dir)
+ kwargs = dict(
+ prompt=p["prompt"],
+ output_path=p["output_path"],
+ height=int(p["height"]),
+ width=int(p["width"]),
+ num_frames=int(p["frames"]),
+ seed=seed,
+ stage1_steps=int(p.get("stage1_steps", 15)),
+ stage2_steps=int(p.get("stage2_steps", 3)),
+ cfg_scale=float(p.get("cfg_scale", 3.0)),
+ stg_scale=float(p.get("stg_scale", 1.0)),
+ enable_teacache=bool(p.get("enable_teacache", True)),
+ teacache_thresh=float(p.get("teacache_thresh", 1.0)),
+ )
+ img = p.get("image")
+ if img:
+ if not os.path.exists(img):
+ raise RuntimeError(f"image not found: {img}")
+ kwargs["image"] = img
+ emit({"event": "log", "line": f"HQ I2V — pipeline will cover-crop image to {kwargs['width']}x{kwargs['height']}"})
+ out_path = pipe.generate_and_save(**kwargs)
+ elapsed = round(time.time() - t0, 2)
+ _last_activity = time.time()
+ emit({
+ "event": "done", "id": job_id,
+ "output": str(out_path), "elapsed_sec": elapsed,
+ "seed_used": seed,
+ })
+ except Exception as exc:
+ _last_activity = time.time()
+ emit({"event": "error", "id": job_id, "error": str(exc), "trace": traceback.format_exc()})
+ finally:
+ _is_busy = False
+ continue
+
emit({"event": "error", "error": f"unknown action: {action}"})
emit({"event": "exit", "reason": "stdin_closed"})