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(extend): construct each pipeline with the kwargs its class accepts
mrbizarroe12fc6a183a5
diff --git a/mlx_warm_helper.py b/mlx_warm_helper.pyindex ce2fc67..bde7e71 100644--- a/mlx_warm_helper.py+++ b/mlx_warm_helper.py@@ -695,6 +695,25 @@ def _resolve_lora_path(path: str) -> str:return chosen+def _construct_pipeline(cls, **kwargs):+ """Build a pipeline, passing only the constructor kwargs THIS vendored+ class accepts.++ 4.10.2 added `low_ram_streaming=` to every pipeline construction. The+ text/image pipelines take it through `BasePipeline`; `RetakePipeline`+ (the Extend lane) declares its own `__init__` without it, so every Extend+ render on 4.10.2–4.10.5 died at construction with "unexpected keyword+ argument 'low_ram_streaming'" — 35 failures from one install in the fleet+ on the day 4.10.4 shipped. A dropped kwarg is logged, never fatal."""+ accepted = _filter_unsupported_kwargs(cls.__init__, dict(kwargs))+ dropped = sorted(set(kwargs) - set(accepted))+ if dropped:+ emit({"event": "log",+ "line": f"{cls.__name__} does not take {', '.join(dropped)} on this engine; "+ f"constructing without."})+ return cls(**accepted)++def _filter_unsupported_kwargs(fn, kwargs: dict) -> dict:"""Return `kwargs` with any keys the target callable doesn't accept removed.@@ -1304,7 +1323,8 @@ def get_pipe(kind: str, loras: list[dict] | None = None,_ac()emit({"event": "log","line": "Loading I2V pipeline (first job is the slow one)..."})- pipe = ImageToVideoPipeline(+ pipe = _construct_pipeline(+ ImageToVideoPipeline,model_dir=i2v_dir, gemma_model_id=GEMMA_PATH, low_memory=LOW_MEMORY,low_ram_streaming=_stream_for(loras),)@@ -1331,7 +1351,8 @@ def get_pipe(kind: str, loras: list[dict] | None = None,_ac()emit({"event": "log","line": f"Loading Extend pipeline (heavier — uses dev transformer at {ext_dir})..."})- pipe = ExtendPipeline(+ pipe = _construct_pipeline(+ ExtendPipeline,model_dir=ext_dir, gemma_model_id=GEMMA_PATH, low_memory=LOW_MEMORY,low_ram_streaming=_stream_for(loras),dev_transformer=ext_dev,@@ -1355,7 +1376,8 @@ def get_pipe(kind: str, loras: list[dict] | None = None,_ac()emit({"event": "log","line": "Loading T2V pipeline (first job is the slow one)..."})- pipe = TextToVideoPipeline(+ pipe = _construct_pipeline(+ TextToVideoPipeline,model_dir=t2v_dir, gemma_model_id=GEMMA_PATH, low_memory=LOW_MEMORY,low_ram_streaming=_stream_for(loras),)diff --git a/test_low_ram_stream.py b/test_low_ram_stream.pyindex dd86067..244c55c 100644--- a/test_low_ram_stream.py+++ b/test_low_ram_stream.py@@ -47,9 +47,13 @@ class StreamingIsPerJob(unittest.TestCase):class EveryPipelineGetsTheFlag(unittest.TestCase):def test_t2v_i2v_extend_constructors_pass_low_ram_streaming(self):self.assertGreaterEqual(SRC.count("low_ram_streaming=_stream_for(loras)"), 3)- for ctor in ("ImageToVideoPipeline(", "ExtendPipeline(", "TextToVideoPipeline("):- i = SRC.index("pipe = " + ctor)- self.assertIn("low_ram_streaming=_stream_for(loras)", SRC[i:i + 400], ctor)+ # Constructed through _construct_pipeline since 4.10.6, so the class is+ # the first argument, not the callee (test_pipeline_construct_kwargs.py).+ import re+ for ctor in ("ImageToVideoPipeline", "ExtendPipeline", "TextToVideoPipeline"):+ m = re.search(r"_construct_pipeline\(\s*" + ctor + ",", SRC)+ self.assertIsNotNone(m, ctor)+ self.assertIn("low_ram_streaming=_stream_for(loras)", SRC[m.start():m.start() + 400], ctor)def test_cache_policy_keeps_the_cache_off_while_streaming(self):i = SRC.index("def apply_mlx_cache_policy")diff --git a/test_pipeline_construct_kwargs.py b/test_pipeline_construct_kwargs.pynew file mode 100644index 0000000..b42ae0e--- /dev/null+++ b/test_pipeline_construct_kwargs.py@@ -0,0 +1,71 @@+"""A pipeline is constructed with the kwargs ITS class accepts — no more.++4.10.2 passed `low_ram_streaming=` to every pipeline. The vendored+RetakePipeline (Extend) has its own __init__ without it, so every Extend+render on 4.10.2–4.10.5 failed at construction. The fleet showed it as+"RetakePipeline.__init__() got an unexpected keyword argument+'low_ram_streaming'". Constructors go through `_construct_pipeline`, which+introspects the class the same way generate kwargs are already filtered.++The helper module is not imported (it talks to MLX at import); the two+functions are lifted from its source, the same discipline as+test_low_ram_stream.py.+"""+import ast, unittest+from pathlib import Path++SRC = Path(__file__).with_name("mlx_warm_helper.py").read_text(encoding="utf-8")+++def _funcs(names):+ tree = ast.parse(SRC)+ picked = [n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name in names]+ assert {n.name for n in picked} == set(names), "helper renamed a function this test lifts"+ ns = {"emit": lambda e: ns.setdefault("_log", []).append(e)}+ exec(compile(ast.Module(body=picked, type_ignores=[]), "helper-extract", "exec"), ns)+ return ns+++class _Strict: # RetakePipeline's shape: no low_ram_streaming, no **kwargs+ def __init__(self, model_dir, gemma_model_id="g", low_memory=True, dev_transformer="d"):+ self.args = dict(model_dir=model_dir, gemma_model_id=gemma_model_id,+ low_memory=low_memory, dev_transformer=dev_transformer)+++class _Streaming: # BasePipeline's shape+ def __init__(self, model_dir, gemma_model_id="g", low_memory=True, low_ram_streaming=False):+ self.args = dict(model_dir=model_dir, low_ram_streaming=low_ram_streaming)+++class ConstructPipeline(unittest.TestCase):+ def setUp(self):+ self.ns = _funcs({"_construct_pipeline", "_filter_unsupported_kwargs"})+ self.build = self.ns["_construct_pipeline"]++ def test_extend_shape_drops_streaming_and_logs(self):+ p = self.build(_Strict, model_dir="m", gemma_model_id="g", low_memory=True,+ low_ram_streaming=True, dev_transformer="dev.safetensors")+ self.assertEqual(p.args["dev_transformer"], "dev.safetensors")+ self.assertNotIn("low_ram_streaming", p.args)+ self.assertTrue(any("low_ram_streaming" in e.get("line", "") for e in self.ns["_log"]))++ def test_streaming_shape_keeps_the_flag(self):+ p = self.build(_Streaming, model_dir="m", gemma_model_id="g", low_memory=True,+ low_ram_streaming=True)+ self.assertTrue(p.args["low_ram_streaming"])+ self.assertFalse(self.ns.get("_log"))++ def test_every_pipeline_construction_goes_through_the_filter(self):+ """No bare `SomethingPipeline(` construction left in get_pipe."""+ import re+ bare = [m.group(1) for m in re.finditer(r"^\s*pipe = (\w+Pipeline)\(", SRC, flags=re.M)+ if "low_ram_streaming" in SRC[m.start():m.start() + 400]]+ self.assertEqual(bare, [], f"passes low_ram_streaming without the kwargs filter: {bare}")+ for ctor in ("ImageToVideoPipeline", "ExtendPipeline", "TextToVideoPipeline"):+ m = re.search(r"_construct_pipeline\(\s*" + ctor + ",", SRC)+ self.assertIsNotNone(m, ctor)+ self.assertIn("low_ram_streaming=_stream_for(loras)", SRC[m.start():m.start() + 400], ctor)+++if __name__ == "__main__":+ unittest.main()