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.

perf(image-studio/hidream): 6-step + FBCache 0.15 — quality + ~80s

mrbizarro10c3eda3233d
diff --git a/agent/image_engine.py b/agent/image_engine.py
index 9b13022..de0082b 100644
--- a/agent/image_engine.py
+++ b/agent/image_engine.py
@@ -192,7 +192,7 @@ class ImageEngineConfig:
# location; override when the lab moves.
hidream_python_path: str = "" # default = HIDREAM_LAB_DIR/.venv/bin/python
hidream_model_path: str = "" # default = HIDREAM_LAB_DIR/mlx_models/hidream-o1-dev-bf16
- hidream_steps: int = 3 # Aggressive 3-step uniform-subsample of upstream's 28-step DEFAULT_TIMESTEPS. Empirically the quality floor for Dev+flow_match edits — at 2 steps the face blurs, at 3 steps character + skin still hold. ~54 s denoise (vs 292 s @ 20). Full overrides to 50.
+ hidream_steps: int = 6 # 6 + FBCache (threshold 0.15) at HD is ~80s denoise with quality matching the 20-step baseline. Lower step counts (3-4) drop detail; 6+FBCache is the empirical sweet spot before quality goes "creamy". Full overrides to 50.
hidream_noise_scale: float = 7.5 # FlashFlowMatch tuned default; lowering collapses the image
hidream_noise_clip_std: float = 2.5
# New for the Full / undistilled variant: pick the lab script's recipe
@@ -206,6 +206,13 @@ class ImageEngineConfig:
# via torch CPU bridge) cures the milky/over-textured Dev-edit output we
# saw in the morning gallery. Ignored for Full or T2I.
hidream_editing_scheduler: str = "flow_match" # "flow_match" | "flash"
+ # First-Block Cache. At 6 steps the conservative 0.15 threshold gives
+ # ~1 cache hit per edit, knocking ~30s off the wall-time without the
+ # "creamy" detail loss that happens at higher thresholds. keep_last=8
+ # always runs the final 8 of 36 layers so fine texture work survives.
+ hidream_fb_cache: bool = True
+ hidream_fb_threshold: float = 0.15
+ hidream_fb_keep_last: int = 8
def to_public_dict(self) -> dict:
d = asdict(self)
@@ -1259,6 +1266,14 @@ def _generate_hidream(prompt: str, n: int, width: int, height: int,
# default and the recipe we ship. Only meaningful when model_type=dev
# AND refs are present; ignored otherwise by the generator.
cmd.extend(["--editing-scheduler", config.hidream_editing_scheduler])
+ # First-Block Cache for the Dev-edit path. Only worth enabling when
+ # there are refs (the edit path is where the per-step cost matters).
+ if config.hidream_fb_cache and config.hidream_recipe == "dev":
+ cmd.extend([
+ "--fb-cache",
+ "--fb-threshold", str(config.hidream_fb_threshold),
+ "--fb-keep-last", str(config.hidream_fb_keep_last),
+ ])
if on_log:
on_log(f"[hidream] launching {n} candidate(s) in one process, seeds={seeds}"
+ (f" with {len(refs)} ref(s)" if refs else ""))
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 73afd1d..3c530fe 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -5399,17 +5399,25 @@ def _build_image_engine_config(engine_override: str) -> agent_image_engine.Image
)
if engine_override == "hidream_inline":
# HiDream-O1-Image-Dev BF16 + flow_match Dev-edit scheduler
- # (upstream's 2026-05-12 default) + 3-step aggressive subsample.
- # The ONE recipe we ship — clean character-preserving edit with
- # smooth cinematic skin (no pores/freckles overlay), HD 16:9.
- # Distilled DEFAULT_TIMESTEPS subsampled uniformly to 3 values
- # = ~54s denoise on M4 Max (vs 292s @ 20 steps). No CFG.
- # ~18 GB RAM. First request includes ~45s model load.
+ # (upstream's 2026-05-12 default) + 6-step subsample of the
+ # 28-step DEFAULT_TIMESTEPS + First-Block Cache. The ONE recipe
+ # we ship — character-preserving HD 16:9 edit with smooth
+ # cinematic skin.
+ #
+ # The acceleration stack:
+ # - flow_match scheduler (cures milky output from old flash)
+ # - 6 steps, uniform-subsampled from 28 (preserves curve shape)
+ # - FBCache threshold 0.15, keep_last 8 (~1 cached step out of
+ # 6; skips 27 middle layers but keeps first + last 8 always
+ # running so fine texture is preserved)
+ # - Snap to trained dim 2560x1440 (off-spec breaks ref-conditioning)
+ #
+ # ~80 s denoise on M4 Max (vs 292s @ 20 steps no cache). No CFG.
+ # ~18 GB RAM. First request includes ~45s subprocess model load.
#
# The Full (50-step CFG=5) variants were removed: they produce
- # over-textured "deep-fried" skin on edits per the Civitai
- # workflow / community findings, and Apple Silicon doesn't
- # speed up from quantization on this model.
+ # over-textured "deep-fried" skin on edits. Q8/Q4 don't help on
+ # Apple Silicon (no int8 matmul speedup + dequant cost).
return agent_image_engine.ImageEngineConfig(kind="hidream")
if engine_override == "mock_inline":
return agent_image_engine.ImageEngineConfig(kind="mock")
@@ -6386,7 +6394,7 @@ class Handler(BaseHTTPRequestHandler):
("flux2_edit_high_inline", None, 0.0, 240.0),
("flux2_inline", "Runpod/FLUX.2-klein-4B-mflux-4bit", 4.0, 12.0),
("z_image_turbo_inline", "filipstrand/Z-Image-Turbo-mflux-4bit", 3.0, 6.0),
- ("hidream_inline", None, 0.0, 100.0),
+ ("hidream_inline", None, 0.0, 130.0),
("mock_inline", None, 0.0, 0.5),
]
out = []
@@ -18418,7 +18426,7 @@ HTML = r"""<!doctype html>
<option value="flux2_edit_high_inline">FLUX.2 Klein-Base-Edit photoreal (multi-ref &middot; 25-step Q8, ~3-5 min/image)</option>
<option value="flux2_inline">FLUX.2 [klein] 4B (fast T2I, no refs)</option>
<option value="z_image_turbo_inline">Z-Image-Turbo (compact T2I, no refs)</option>
- <option value="hidream_inline">HiDream-O1-Image-Dev BF16 + flow_match HD (3-step character-preserving edit &middot; ~1 min, 18 GB)</option>
+ <option value="hidream_inline">HiDream-O1-Image-Dev BF16 + flow_match HD + FBCache (6-step character-preserving edit &middot; ~80 s, 18 GB)</option>
<option value="mock_inline" id="imgStudioMockOption" hidden>Mock (testing — debug only)</option>
</select>
<span class="engine-status-pill" id="imgStudioEnginePill"