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.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
fix(agent): klein-4B prompt structure + Q6 default
mrbizarro96c740eba615
diff --git a/agent/image_engine.py b/agent/image_engine.pyindex d2faa81..269fb63 100644--- a/agent/image_engine.py+++ b/agent/image_engine.py@@ -97,7 +97,7 @@ class ImageEngineConfig:mflux_family: str = "auto" # "auto" or one of the family ids abovemflux_base_model: str = "" # only needed when mflux_model is a path/HF id and family inference can't tell the architecturemflux_steps: int = 0 # 0 = use family default (4/9/25 per family)- mflux_quantize: int = 4 # 4 | 8 | 16 — 4-bit fits comfortably on 64 GB+ mflux_quantize: int = 6 # 3 | 4 | 5 | 6 | 8 — Q6 is the Apple-Silicon community sweet spot (~4-6% quality loss vs full precision; Q4 is 8-12%). Draw Things uses Q6/Q5 by default. Q4 only matters on ≤16 GB Macs; on 64 GB M4 Max the speed gap is negligible and the quality jump is visible.mflux_guidance: float | None = None # None = use family default (1.0 / 0.0 / 4.5 / 5.0 per family)mflux_python_path: str = "" # optional override for the mflux CLI location# Optional Lightning / acceleration LoRAs. With qwen_edit + a 4-stepdiff --git a/agent/prompts.py b/agent/prompts.pyindex 7a0ced1..a85c760 100644--- a/agent/prompts.py+++ b/agent/prompts.py@@ -697,6 +697,76 @@ all at the same denoise step. But the user's expectation tends to be"character first, style second" — surface that ordering in the agent'splan summary so the user can sanity-check what's being layered.+# How FLUX.2 Klein parses prompts — the hierarchy matters++When you write a prompt for `generate_shot_images` (Phase B) and the+engine is FLUX.2-klein-4B / klein-base-4B (the photoreal default+when refs are present), the model parses your prompt with a strict+priority order. Mixing the order produces mushy or off-target+output — the symptom we hit in session fd13625972ee where the+character looked illustrative even though "photorealistic" was in+the prompt.++**Order, every prompt:**++1. **Subject** — concrete nouns first. The character or main thing,+ with its identifying features. "Bizarro the steampunk character —+ brass-gear top hat, large blue glowing goggles, waxed mustache,+ trimmed beard, dark Victorian suit." Content words (nouns and+ proper nouns) anchor the embedding more than modifiers.+2. **Environment** — where the subject is, plus lighting and+ atmosphere. "sitting on warm sand at a tropical beach during+ golden hour, palm fronds and soft ocean in the background."+3. **Style** — the aesthetic register. "documentary photography,+ photorealistic, with particular attention to natural skin texture+ and brass gear details." Klein responds to natural-language+ emphasis: phrases like *"prominently featuring"*, *"with+ particular attention to"*, *"especially detailed"* upweight the+ following clause without any special syntax.+4. **Technical specs** — composition, focal length, DOF, color.+ "medium close-up, shallow depth of field, 35mm DSLR, soft warm+ volumetric light, no text, no logos."++**What NOT to do (the broken pattern):**++> "Cinematic medium close-up of Bizarro the steampunk character at a+> tropical beach at golden hour. Top hat with brass gear ornaments..."++That leads with **style** ("Cinematic"), then jumps to **technical**+("medium close-up"), then buries the **subject** ("Bizarro the+steampunk character") mid-sentence. The model has nothing to anchor+the subject embedding on early — output drifts toward generic+"steampunk" trope rather than the specific character.++**What TO do:**++> "Bizarro the steampunk character — brass-gear top hat, large blue+> glowing goggles, waxed mustache, trimmed beard, dark Victorian+> suit — sitting on warm sand at a tropical beach during golden hour,+> palm fronds and soft ocean in the background. Documentary+> photography, photorealistic, with particular attention to natural+> skin texture and brass gear details. Medium close-up, shallow+> depth of field, 35mm DSLR, soft warm volumetric light, no text, no+> logos."++Same words, same beats — but the model parses subject first, locks+identity from the ref, then layers environment, style, and technical+constraints.++**Resolution sweet spot:** klein-4B was trained at 1024×1024.+Generation at 1024×1024, 1024×768, 768×1024 — the trained-aspect+neighborhood — produces the cleanest output. 1280×720 and other+non-trained resolutions degrade visibly (edge sharpness, identity+drift). Use `aspect="1:1"` (1024×1024) when the still doesn't need+to feed an i2v render directly. For i2v anchors at 16:9, prefer+`aspect="16:9"` which maps to 1280×720, accept the slight quality+hit, and lean on Q6+ quantization to compensate.++**Quantization:** Q6 is the default. Q4 was the historical default+but it's the wrong call on 64 GB M4 Max — Q4 costs 8-12% quality+for ~1-2 seconds of speed savings vs Q6. Q8 (used by+`flux2_edit_high`) is best when you have the wall time.+# Writing prompts FOR ANCHOR STILLS (Phase B)When the user asks for **more variations of an already-generated shot**diff --git a/agent/tools.py b/agent/tools.pyindex 71ec14d..53e91a2 100644--- a/agent/tools.py+++ b/agent/tools.py@@ -1125,16 +1125,23 @@ def _generate_shot_images(args: dict, ops: PanelOps, session: dict) -> dict:engine_override = (args.get("engine_override") or "").strip()if engine_override:if engine_override == "flux2_edit":- # Distilled klein-4b — fast but illustrative. mflux's+ # Distilled klein-4b — fast but illustrative at Q4. mflux's# flux2_edit_generate.py FORCES guidance == 1.0 on distilled# bases; passing anything else would parser.error. Pass the# mflux SHORTHAND name (not the HF repo) so mflux resolves# the correct base config.+ #+ # Q6 instead of Q4: Apple-Silicon community consensus for+ # FLUX.2 — Q6 is ~4-6% quality loss vs full precision, Q4+ # is 8-12%. On a 64 GB M4 Max the per-image speed gap is+ # negligible (~1-2 s) but the visible quality jump is real+ # (skin texture, gear detail, photographic feel). Draw+ # Things ships Q5/Q6 as default for the same reason.cfg = _image_engine.ImageEngineConfig(kind="mflux",mflux_model="flux2-klein-4b",mflux_family="flux2_edit",- mflux_quantize=4,+ mflux_quantize=6,mflux_steps=4,mflux_guidance=1.0,)