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(start): pass HF_HOME so Qwen-Image-Edit weights resolve

mrbizarro556cfc7fbc21
diff --git a/agent/image_engine.py b/agent/image_engine.py
index d838a06..dc7078f 100644
--- a/agent/image_engine.py
+++ b/agent/image_engine.py
@@ -1006,6 +1006,30 @@ HIDREAM_DEFAULT_MODEL = HIDREAM_LAB_DIR / "mlx_models" / "hidream-o1-dev-q6"
HIDREAM_GENERATE_SCRIPT = HIDREAM_LAB_DIR / "scripts" / "hidream_o1" / "generate_hidream_o1_mlx.py"
HIDREAM_PATCH_SIZE = 32 # HiDream operates on patch-aligned multiples; we round if asked for non-aligned
+# HiDream-O1 was trained on a fixed list of resolutions. Generating at off-spec
+# dimensions produces visible 32-pixel patch grid artifacts because the model
+# never saw mrope position codes outside this distribution. Snap to the closest
+# trained ratio before generation. List is from upstream pipeline.py utils.py.
+HIDREAM_TRAINED_RESOLUTIONS = [
+ (2048, 2048),
+ (2304, 1728), (1728, 2304),
+ (2560, 1440), (1440, 2560),
+ (2496, 1664), (1664, 2496),
+ (3104, 1312), (1312, 3104),
+ (2304, 1792), (1792, 2304),
+]
+
+
+def _snap_to_trained_resolution(width: int, height: int) -> tuple[int, int]:
+ """Snap (w, h) to the closest aspect ratio HiDream was trained on."""
+ img_ratio = width / height
+ best, min_diff = (2048, 2048), float("inf")
+ for w, h in HIDREAM_TRAINED_RESOLUTIONS:
+ diff = abs(w / h - img_ratio)
+ if diff < min_diff:
+ min_diff, best = diff, (w, h)
+ return best
+
def _resolve_hidream_python(config: ImageEngineConfig) -> str | None:
"""Return the absolute path of the HiDream venv python, or None."""
@@ -1062,11 +1086,14 @@ def _generate_hidream(prompt: str, n: int, width: int, height: int,
if not Path(script).is_file():
raise FileNotFoundError(f"HiDream generator script missing at {script}")
- # Patch-align dims (HiDream needs multiples of 32).
- aligned_w = _patch_align(width)
- aligned_h = _patch_align(height)
- if (aligned_w, aligned_h) != (width, height) and on_log:
- on_log(f"[hidream] patch-aligning {width}x{height} -> {aligned_w}x{aligned_h}")
+ # Snap to trained-aspect-ratio resolution first, then patch-align.
+ # Generating off-spec produces visible 32-pixel patch grid artifacts
+ # because the model never saw those mrope position codes during training.
+ snap_w, snap_h = _snap_to_trained_resolution(width, height)
+ if (snap_w, snap_h) != (width, height) and on_log:
+ on_log(f"[hidream] snapping {width}x{height} -> {snap_w}x{snap_h} (trained dim)")
+ aligned_w = _patch_align(snap_w)
+ aligned_h = _patch_align(snap_h)
results: list[dict] = []
for i in range(n):
diff --git a/start.js b/start.js
index 953f842..5cb54d1 100644
--- a/start.js
+++ b/start.js
@@ -16,7 +16,19 @@ module.exports = {
LTX_GEMMA: "{{cwd}}/mlx_models/gemma-3-12b-it-4bit",
LTX_MODELS_DIR: "{{cwd}}/mlx_models",
LTX_Q8_LOCAL: "{{cwd}}/mlx_models/ltx-2.3-mlx-q8",
- LTX_HELPER_PYTHON: "{{cwd}}/ltx-2-mlx/env/bin/python3.11"
+ LTX_HELPER_PYTHON: "{{cwd}}/ltx-2-mlx/env/bin/python3.11",
+ // HF_HOME tells the panel + helper + mflux subprocesses to use
+ // the Pinokio-managed cache at <install>/cache/HF_HOME instead
+ // of ~/.cache/huggingface. install_qwen.js + other Pinokio
+ // installers download weights into <install>/cache/HF_HOME/hub/,
+ // but without this env the panel reads ~/.cache/huggingface/hub/
+ // and reports the weights as missing — the "Qwen models
+ // downloaded but engine reports not cached / 'mflux-generate-
+ // qwen-edit not found'" symptom Salo hit. Pinokio's global
+ // ENVIRONMENT file already sets HF_HOME=./cache/HF_HOME, but
+ // shell.run replaces the env wholesale — we have to declare
+ // it here for the panel to inherit it.
+ HF_HOME: "{{cwd}}/cache/HF_HOME"
},
message: ["python mlx_ltx_panel.py"],
// SHIP-BLOCKER history: we used to have extra `/errno/i` and `/error:/i`