Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

tighten the MiniMax H3 keyframe adapters after review

[._.]/ Adam Eivy7fde4529fe65
diff --git a/scripts/generate_minimax_h3.py b/scripts/generate_minimax_h3.py
index 9c56cb4194..2ce8e0e67e 100644
--- a/scripts/generate_minimax_h3.py
+++ b/scripts/generate_minimax_h3.py
@@ -14,7 +14,9 @@ Each `--image` needs its own `--anchor`, in the same order.
from __future__ import annotations
import argparse
+import hashlib
import importlib.util
+import inspect
import json
import re
import shutil
@@ -149,14 +151,31 @@ def install_key_prefix_map(rules: list[tuple[str, str]]) -> None:
MiniMaxH3TextEncoder._wanted = _wanted
+def pinned_encoder_hook(name: str, consequence: str, kind: type | None = None):
+ """Return one attribute of the pinned text encoder, or say the pin moved.
+
+ Each keyframe correction below wraps a different method of
+ `MiniMaxH3TextEncoder`, and each is only correct against the implementation
+ it was written for — so every one of them checks its hook is still there and
+ still the shape it patches, and reports the same two ways out.
+ """
+ from minimax_h3_mlx.text_encoder import MiniMaxH3TextEncoder
+
+ hook = getattr(MiniMaxH3TextEncoder, name, None)
+ if hook is None or (kind is not None and not isinstance(hook, kind)):
+ raise RuntimeError(
+ f"The pinned MiniMax H3 runtime no longer exposes MiniMaxH3TextEncoder.{name}, so "
+ f"{consequence}. Render text-only, or update PortOS for the new pin."
+ )
+ return MiniMaxH3TextEncoder, hook
+
+
def torch_image_stack_available() -> bool:
"""Whether the pinned runtime's own `AutoProcessor` path can load at all.
- transformers 5 dropped the numpy image processors: every class the auto path
- resolves is torchvision-backed, and importing one without torch raises rather
- than degrading. The MLX runtime lock deliberately ships neither
- (`requirements-minimax-h3-mlx.lock.txt`), so this is False for a stock PortOS
- install and True only if the user added torch to that venv themselves.
+ False for every stock install: `requirements-minimax-h3-mlx.lock.txt` ships
+ neither package, and `uv pip sync` removes anything added on top of it. See
+ `install_pil_image_processor` for what that costs and how it is covered.
"""
return all(importlib.util.find_spec(module) is not None for module in ("torch", "torchvision"))
@@ -184,8 +203,8 @@ def load_pil_image_processor(processor_dir: Path):
if processor_class is None:
raise RuntimeError(
f"transformers {transformers.__version__} exposes no {name}, the PIL-backed twin of the "
- f"checkpoint's {declared}. Install torch and torchvision into the MiniMax H3 runtime venv "
- "to condition on a keyframe with this transformers version."
+ f"checkpoint's {declared}, so a keyframe cannot be encoded without PyTorch. Render "
+ "text-only, or update PortOS for a transformers version that still ships one."
)
return processor_class.from_pretrained(str(processor_dir))
@@ -207,14 +226,9 @@ def install_pil_image_processor() -> None:
it doesn't use and — deliberately, like the key-prefix map above — leaves the
pinned checkout untouched, because it is verified clean before this runs.
"""
- from minimax_h3_mlx.text_encoder import MiniMaxH3TextEncoder
-
- if not isinstance(getattr(MiniMaxH3TextEncoder, "processor", None), property):
- raise RuntimeError(
- "The pinned MiniMax H3 runtime no longer exposes MiniMaxH3TextEncoder.processor, so a "
- "keyframe cannot be encoded without PyTorch. Render text-only, install torch and "
- "torchvision into the runtime venv, or update PortOS for the new pin."
- )
+ encoder, _ = pinned_encoder_hook(
+ "processor", "a keyframe cannot be encoded without PyTorch", kind=property
+ )
def processor(self):
if self._processor is None:
@@ -226,7 +240,7 @@ def install_pil_image_processor() -> None:
)
return self._processor
- MiniMaxH3TextEncoder.processor = property(processor)
+ encoder.processor = property(processor)
def install_vision_weight_sanitizer() -> None:
@@ -245,31 +259,31 @@ def install_vision_weight_sanitizer() -> None:
correctly-laid-out tensor as a no-op, so this stays right if a later pin (or a
later mlx-vlm) starts handing the tower a sanitized weight.
"""
- from minimax_h3_mlx.text_encoder import MiniMaxH3TextEncoder
-
- original = getattr(MiniMaxH3TextEncoder, "_load_weights", None)
- if original is None:
- raise RuntimeError(
- "The pinned MiniMax H3 runtime no longer exposes MiniMaxH3TextEncoder._load_weights, "
- "so its vision tower cannot be laid out for MLX. Render text-only, or update PortOS "
- "for the new pin."
- )
+ encoder, original = pinned_encoder_hook(
+ "_load_weights", "its vision tower cannot be laid out for MLX"
+ )
def _load_weights(self, model_dir, dtype, verbose):
original(self, model_dir, dtype, verbose)
sanitize_vision_weights(self.vision)
- MiniMaxH3TextEncoder._load_weights = _load_weights
+ encoder._load_weights = _load_weights
def sanitize_vision_weights(vision) -> None:
- """Run mlx-vlm's `sanitize` over an already-loaded vision module, in place."""
+ """Run mlx-vlm's `sanitize` over an already-loaded vision module, in place.
+
+ Routed through mlx-vlm's `sanitize_weights`, which is what its own loader
+ calls: a tower that stops publishing `sanitize` is then a no-op here rather
+ than an AttributeError mid-load. `vision` is None on a text-only encoder.
+ """
if vision is None:
return
import mlx.core as mx
from mlx.utils import tree_flatten, tree_unflatten
+ from mlx_vlm.utils import sanitize_weights
- sanitized = vision.sanitize(dict(tree_flatten(vision.parameters())))
+ sanitized = sanitize_weights(vision, dict(tree_flatten(vision.parameters())))
vision.update(tree_unflatten(list(sanitized.items())))
mx.eval(vision.parameters())
@@ -279,6 +293,14 @@ def sanitize_vision_weights(vision) -> None:
# so loudly rather than shadowing a working implementation forever.
PINNED_BROADCAST_MERGE = "mx.where(image_mask[..., None], hidden.astype(inputs_embeds.dtype)[None], inputs_embeds)"
+# sha256 of the whole pinned `encode`, because the replacement below re-runs its
+# body with one line changed rather than wrapping it. Matching only the merge
+# line would let every OTHER edit a pin bump makes — a new `_hidden_states`
+# argument, a different dtype, an added step — pass silently into a stale copy.
+# Re-record this when bumping MINIMAX_H3_EXPECTED_REVISION, after re-reading
+# `encode` and folding whatever changed into the replacement.
+PINNED_ENCODE_DIGEST = "8047e407e797cd46cd7538024ca09d97402d369d97b1d825757a1590416bda7d"
+
def install_vision_embed_merge() -> None:
"""Scatter a keyframe's vision rows into the tokens that stand for them.
@@ -296,22 +318,21 @@ def install_vision_embed_merge() -> None:
the broadcast could never check). A text-only request never reaches the merge,
so it is handed straight back to the pinned implementation untouched.
"""
- import inspect
-
- from minimax_h3_mlx.text_encoder import MiniMaxH3TextEncoder
-
- original = getattr(MiniMaxH3TextEncoder, "encode", None)
- if original is None:
- raise RuntimeError(
- "The pinned MiniMax H3 runtime no longer exposes MiniMaxH3TextEncoder.encode, so a "
- "keyframe cannot be merged into the prompt. Render text-only, or update PortOS for "
- "the new pin."
- )
- if PINNED_BROADCAST_MERGE not in inspect.getsource(original):
+ encoder, original = pinned_encoder_hook(
+ "encode", "a keyframe cannot be merged into the prompt"
+ )
+ source = inspect.getsource(original)
+ if PINNED_BROADCAST_MERGE not in source:
raise RuntimeError(
"The pinned MiniMax H3 runtime no longer merges keyframe embeddings the way PortOS "
"corrects for; re-check the pin before rendering with a keyframe."
)
+ if hashlib.sha256(source.encode("utf-8")).hexdigest() != PINNED_ENCODE_DIGEST:
+ raise RuntimeError(
+ "The pinned MiniMax H3 runtime changed MiniMaxH3TextEncoder.encode outside the merge "
+ "PortOS corrects; fold the change into the replacement and re-record "
+ "PINNED_ENCODE_DIGEST before rendering with a keyframe."
+ )
def encode(self, prompt: str, images: list | None = None):
# A text-only request never reaches the merge, so it goes back to the
@@ -357,7 +378,7 @@ def install_vision_embed_merge() -> None:
mx.eval(hidden_states)
return hidden_states, token_tags
- MiniMaxH3TextEncoder.encode = encode
+ encoder.encode = encode
def write_final_norm_shard(path: Path, key: str, hidden_size: int) -> None:
diff --git a/scripts/generate_minimax_h3.test.js b/scripts/generate_minimax_h3.test.js
index a2515eef70..b3d77654ba 100644
--- a/scripts/generate_minimax_h3.test.js
+++ b/scripts/generate_minimax_h3.test.js
@@ -67,6 +67,46 @@ const argsExpr = (overrides = {}) => {
return `args = SimpleNamespace(${fields.join(', ')})`;
};
+// Stand-in for the pinned runtime: the installers below reach for
+// `minimax_h3_mlx.text_encoder.MiniMaxH3TextEncoder`, so every case that
+// exercises one has to put a class there first. `preamble` runs before the
+// class body, for recorders the stub's methods close over.
+const stubPin = (classBody, preamble = []) => [
+ 'import sys, types',
+ ...preamble,
+ 'class MiniMaxH3TextEncoder:',
+ ...classBody,
+ 'module = types.ModuleType("minimax_h3_mlx.text_encoder")',
+ 'module.MiniMaxH3TextEncoder = MiniMaxH3TextEncoder',
+ 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
+ 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
+].join('\n');
+
+// The merge correction guards itself with `inspect.getsource`, which needs a
+// real file — so that stand-in is written out and imported rather than declared
+// inline. The merge itself is carried as a COMMENT: the stub only has to look
+// like the pin to `getsource`, not run its body.
+const filePin = (encodeBody) => [
+ 'import importlib.util, sys, tempfile, types',
+ 'temp = tempfile.mkdtemp()',
+ 'pin = Path(temp) / "pinned_text_encoder.py"',
+ 'pin.write_text("\\n".join([',
+ ' "class MiniMaxH3TextEncoder:",',
+ ' " def encode(self, prompt, images=None):",',
+ ...encodeBody.map((line) => ` ${JSON.stringify(` # ${line}`)},`),
+ ' " return (\'pinned\', prompt, images)",',
+ ']))',
+ 'spec = importlib.util.spec_from_file_location("minimax_h3_mlx.text_encoder", pin)',
+ 'module = importlib.util.module_from_spec(spec)',
+ 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
+ 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
+ 'spec.loader.exec_module(module)',
+ 'MiniMaxH3TextEncoder = module.MiniMaxH3TextEncoder',
+].join('\n');
+
+// The line the correction replaces, mirrored from the runner's own constant.
+const PINNED_MERGE = 'inputs_embeds = mx.where(image_mask[..., None], hidden.astype(inputs_embeds.dtype)[None], inputs_embeds)';
+
describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {
it('defaults the MLX runner to nine sigma points for eight forwards', () => {
const output = runPython(`${importRunner}\n${[
@@ -498,7 +538,6 @@ describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {
].join('\n')}`);
expect(output.trim()).toBe('10');
});
-
// Keyframe conditioning is the one path with no torch under it: the MLX lock
// ships neither torch nor torchvision, and transformers 5 routes every auto
// image-processor load through them. Text-only renders never touch it, which
@@ -507,9 +546,7 @@ describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {
const output = runPython(`${importRunner}\n${[
'import json',
'present = {"torch": object(), "torchvision": object(), "numpy": object()}',
- 'def fake_find_spec(name):',
- ' return present.get(name)',
- 'runner.importlib.util.find_spec = fake_find_spec',
+ 'runner.importlib.util.find_spec = present.get',
'both = runner.torch_image_stack_available()',
'present.pop("torchvision")',
'vision_only = runner.torch_image_stack_available()',
@@ -574,23 +611,19 @@ describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {
// to that one attribute: building the rest is what pulls in the video
// processor nothing here uses.
it('binds the PIL twin to the only sub-processor the pinned encoder reads', () => {
- const output = runPython(`${importRunner}\n${[
- 'import json, sys, types',
- 'class FakeEncoder:',
+ const output = runPython(`${importRunner}\n${stubPin([
' def __init__(self, model_dir):',
' self._model_dir = Path(model_dir)',
' self._processor = None',
' @property',
' def processor(self):',
' raise AssertionError("the pinned auto-processor property must not run")',
- 'module = types.ModuleType("minimax_h3_mlx.text_encoder")',
- 'module.MiniMaxH3TextEncoder = FakeEncoder',
- 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
- 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
+ ])}\n${[
+ 'import json',
'seen = []',
'runner.load_pil_image_processor = lambda directory: seen.append(directory) or "pil-image-processor"',
'runner.install_pil_image_processor()',
- 'encoder = FakeEncoder("/checkpoint/text_encoder")',
+ 'encoder = MiniMaxH3TextEncoder("/checkpoint/text_encoder")',
'first = encoder.processor',
'print(json.dumps({',
' "image_processor": first.image_processor,',
@@ -608,42 +641,19 @@ describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {
expect(result.loads).toEqual([join('/checkpoint', 'processor')]);
});
- it('refuses to bind a twin onto a pin with no processor property', () => {
- const output = runPython(`${importRunner}\n${[
- 'import sys, types',
- 'class Bare: pass',
- 'module = types.ModuleType("minimax_h3_mlx.text_encoder")',
- 'module.MiniMaxH3TextEncoder = Bare',
- 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
- 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
- 'try:',
- ' runner.install_pil_image_processor()',
- 'except RuntimeError as exc:',
- ' print(str(exc))',
- 'else:',
- ' raise SystemExit("a pin with no processor property was accepted")',
- ].join('\n')}`);
- expect(output).toMatch(/no longer exposes MiniMaxH3TextEncoder\.processor/);
- });
-
// mlx-vlm's loader sanitizes `patch_embed.proj.weight` into MLX's conv layout;
// the pinned port loads the safetensors itself and skips it, so the tower gets
// torch's `(C_out, C_in, kD, kH, kW)` and conv3d rejects the first keyframe.
it('sanitizes the vision tower after the pinned load, not instead of it', () => {
- const output = runPython(`${importRunner}\n${[
- 'import json, sys, types',
- 'order = []',
- 'class FakeEncoder:',
+ const output = runPython(`${importRunner}\n${stubPin([
' def _load_weights(self, model_dir, dtype, verbose):',
' order.append(("pinned load", str(model_dir), str(dtype), verbose))',
' self.vision = "vision-tower"',
- 'module = types.ModuleType("minimax_h3_mlx.text_encoder")',
- 'module.MiniMaxH3TextEncoder = FakeEncoder',
- 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
- 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
+ ], ['order = []'])}\n${[
+ 'import json',
'runner.sanitize_vision_weights = lambda vision: order.append(("sanitize", vision))',
'runner.install_vision_weight_sanitizer()',
- 'FakeEncoder()._load_weights(Path("/checkpoint/text_encoder"), "bfloat16", False)',
+ 'MiniMaxH3TextEncoder()._load_weights(Path("/checkpoint/text_encoder"), "bfloat16", False)',
'print(json.dumps(order))',
].join('\n')}`);
// The pinned load runs first and unchanged — the correction is applied to
@@ -655,89 +665,88 @@ describe.skipIf(!pyBin)('generate_minimax_h3.py', () => {
]);
});
- it('refuses to sanitize a pin with no _load_weights hook', () => {
+ it('leaves the vision tower alone when the encoder built none', () => {
const output = runPython(`${importRunner}\n${[
- 'import sys, types',
- 'class Bare: pass',
- 'module = types.ModuleType("minimax_h3_mlx.text_encoder")',
- 'module.MiniMaxH3TextEncoder = Bare',
- 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
- 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
+ 'runner.sanitize_vision_weights(None)',
+ 'print("ok")',
+ ].join('\n')}`);
+ // Reached on a text-only encoder (`load_vision=False`); importing mlx to
+ // sanitize nothing would cost a load the run does not need.
+ expect(output.trim()).toBe('ok');
+ });
+
+ // Each adapter patches a different method, and each is only correct against
+ // the implementation it was written for — so a pin that moved has to be told
+ // apart from one that still fits, before a render spends minutes loading.
+ it.each([
+ ['install_pil_image_processor', 'processor'],
+ ['install_vision_weight_sanitizer', '_load_weights'],
+ ['install_vision_embed_merge', 'encode'],
+ ])('refuses to install %s onto a pin with no %s hook', (installer, hook) => {
+ const output = runPython(`${importRunner}\n${stubPin([' pass'])}\n${[
'try:',
- ' runner.install_vision_weight_sanitizer()',
+ ` runner.${installer}()`,
'except RuntimeError as exc:',
' print(str(exc))',
'else:',
- ' raise SystemExit("a pin with no _load_weights hook was accepted")',
+ ` raise SystemExit("a pin with no ${hook} hook was accepted")`,
].join('\n')}`);
- expect(output).toMatch(/no longer exposes MiniMaxH3TextEncoder\._load_weights/);
+ expect(output).toMatch(new RegExp(`no longer exposes MiniMaxH3TextEncoder\\.${hook}`));
});
- it('leaves the vision tower alone when the encoder built none', () => {
- const output = runPython(`${importRunner}\n${[
- 'runner.sanitize_vision_weights(None)',
- 'print("ok")',
+ // A `processor` that is no longer a property is as much a pin change as an
+ // absent one: the pinned caller would start calling it, and the replacement
+ // is a property.
+ it('refuses to bind the twin onto a processor that is no longer a property', () => {
+ const output = runPython(`${importRunner}\n${stubPin([' processor = "not-a-property"'])}\n${[
+ 'try:',
+ ' runner.install_pil_image_processor()',
+ 'except RuntimeError as exc:',
+ ' print(str(exc))',
+ 'else:',
+ ' raise SystemExit("a non-property processor was accepted")',
].join('\n')}`);
- // Reached on a text-only encoder (`load_vision=False`); importing mlx to
- // sanitize nothing would cost a load the run does not need.
- expect(output.trim()).toBe('ok');
+ expect(output).toMatch(/no longer exposes MiniMaxH3TextEncoder\.processor/);
});
// The pinned encode merges the keyframe's vision rows with a BROADCAST, which
// only lines up when the request is nothing but image tokens — every real
- // prompt + keyframe pair dies in `[broadcast_shapes]`. The correction is
- // asserted against the pin so it retires itself if upstream ever fixes it.
- it.each([
- ['inputs_embeds = mx.where(image_mask[..., None], hidden.astype(inputs_embeds.dtype)[None], inputs_embeds)', null],
- ['inputs_embeds = merge(image_mask, hidden, inputs_embeds)', /no longer merges keyframe embeddings/],
- ])('installs the scatter only over a pin that still merges by broadcast (%s)', (merge, expected) => {
- const output = runPython(`${importRunner}\n${[
- 'import importlib.util, sys, tempfile, types',
- 'with tempfile.TemporaryDirectory() as temp:',
- // inspect.getsource needs a real file, so the stand-in pin is written out
- // and imported rather than declared inline.
- ' pin = Path(temp) / "pinned_text_encoder.py"',
- ' pin.write_text("\\n".join([',
- ' "class MiniMaxH3TextEncoder:",',
- ' " def encode(self, prompt, images=None):",',
- // Carried as a comment: the stand-in only has to look like the pin to
- // `inspect.getsource`, not run its body.
- ` " # ${merge}",`,
- ' " return (\'pinned\', prompt, images)",',
- ' ]))',
- ' spec = importlib.util.spec_from_file_location("minimax_h3_mlx.text_encoder", pin)',
- ' module = importlib.util.module_from_spec(spec)',
- ' sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
- ' sys.modules["minimax_h3_mlx.text_encoder"] = module',
- ' spec.loader.exec_module(module)',
- ' try:',
- ' runner.install_vision_embed_merge()',
- ' except RuntimeError as exc:',
- ' print("REFUSED", str(exc))',
- ' else:',
- // A text-only request has no merge to correct, so it must come back from
- // the pinned implementation untouched.
- ' print("INSTALLED", module.MiniMaxH3TextEncoder().encode("a prompt"))',
+ // prompt + keyframe pair dies in `[broadcast_shapes]`. The correction re-runs
+ // the pinned body with that one line swapped, so it is guarded twice: by the
+ // line it replaces, and by a digest over the whole body it copied.
+ it('corrects a pin that still merges by broadcast, and hands its text-only path back', () => {
+ const output = runPython(`${importRunner}\n${filePin([PINNED_MERGE])}\n${[
+ 'import hashlib, inspect',
+ 'runner.PINNED_ENCODE_DIGEST = hashlib.sha256(',
+ ' inspect.getsource(MiniMaxH3TextEncoder.encode).encode("utf-8")',
+ ').hexdigest()',
+ 'runner.install_vision_embed_merge()',
+ 'print(MiniMaxH3TextEncoder().encode("a prompt"))',
].join('\n')}`);
- if (expected) expect(output).toMatch(expected);
- else expect(output.trim()).toBe("INSTALLED ('pinned', 'a prompt', None)");
+ // A text-only request has no merge to correct, so it must come back from the
+ // pinned implementation untouched.
+ expect(output.trim()).toBe("('pinned', 'a prompt', None)");
});
- it('refuses to correct a pin with no encode hook', () => {
- const output = runPython(`${importRunner}\n${[
- 'import sys, types',
- 'class Bare: pass',
- 'module = types.ModuleType("minimax_h3_mlx.text_encoder")',
- 'module.MiniMaxH3TextEncoder = Bare',
- 'sys.modules["minimax_h3_mlx"] = types.ModuleType("minimax_h3_mlx")',
- 'sys.modules["minimax_h3_mlx.text_encoder"] = module',
+ it.each([
+ // Upstream fixed the merge: the correction has to retire, not shadow it.
+ [[PINNED_MERGE.replace('mx.where', 'masked_scatter')], 'digest-of-this-pin', /no longer merges keyframe embeddings/],
+ // The merge is untouched but something else in the body moved — the copy is
+ // stale in a way matching one line could never see.
+ [[PINNED_MERGE], `"${'0'.repeat(64)}"`, /changed MiniMaxH3TextEncoder\.encode outside the merge/],
+ ])('refuses a pin the copied encode no longer matches (%j)', (body, digest, expected) => {
+ const output = runPython(`${importRunner}\n${filePin(body)}\n${[
+ 'import hashlib, inspect',
+ `runner.PINNED_ENCODE_DIGEST = ${digest === 'digest-of-this-pin'
+ ? 'hashlib.sha256(inspect.getsource(MiniMaxH3TextEncoder.encode).encode("utf-8")).hexdigest()'
+ : digest}`,
'try:',
' runner.install_vision_embed_merge()',
'except RuntimeError as exc:',
' print(str(exc))',
'else:',
- ' raise SystemExit("a pin with no encode hook was accepted")',
+ ' raise SystemExit("a drifted pin was accepted")',
].join('\n')}`);
- expect(output).toMatch(/no longer exposes MiniMaxH3TextEncoder\.encode/);
+ expect(output).toMatch(expected);
});
});
diff --git a/scripts/requirements-minimax-h3-mlx.lock.txt b/scripts/requirements-minimax-h3-mlx.lock.txt
index 3d6ae77a26..c3cca810d9 100644
--- a/scripts/requirements-minimax-h3-mlx.lock.txt
+++ b/scripts/requirements-minimax-h3-mlx.lock.txt
@@ -1,3 +1,13 @@
+# MiniMax H3 MLX runtime — fully-resolved lock for ~/.portos/minimax-h3-mlx/.venv.
+#
+# `torch` and `torchvision` are deliberately absent: the port is MLX-native and
+# needs neither, and they are ~2 GB. That is load-bearing, not incidental —
+# transformers 5 routes every AutoProcessor/AutoImageProcessor load through
+# torchvision, so scripts/generate_minimax_h3.py binds the PIL-backed image
+# processor itself for keyframe conditioning (see `install_pil_image_processor`).
+# Note also that setup-image-video.sh installs this with `uv pip sync`, which
+# REMOVES anything added on top — a hand-installed torch does not survive a
+# Repair, so nothing may be built on the assumption that one is present.
annotated-doc==0.0.5
annotated-types==0.8.0
anyio==4.14.2