v1.50: the lane names its checkpoint by its snapshot's path, which an offline start reads as it is

The lane's second proof on the reference box (2026-11-16): the unit restarted 84 times in 45 minutes, each
start refused with IncompleteSnapshotError. By the repository's name, huggingface_hub 1.33 checks an
offline snapshot against the whole file list it cached at the fetch, and this lane fetches only the files
it loads (ALLOW).

- install-image-h3.sh renders --model-path as the snapshot's path (MODEL_SNAP), refuses a revision that is
  not a commit, and its runtime check proves that path resolves to MiniMax-H3-Image's own registered model
  (SGLang matches the models--MiniMaxAI--MiniMax-H3-Image folder as a whole path component, not
  MiniMax-H3's).
- switch-model.sh reads the repository and the revision off that path, and still reads a unit of before.
- The cockpit says the repository for such a path (hf_repo_of), on the page and the lane's card.
- dashboard/tests/test_image_routes.py: its cockpit read the box's own MiniMax-H3-Image unit, once the
  lane's proof had installed it; it points at a unit of its own.

The new tests fail on the old code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Opus 5.5 committed 2026-11-16 15:43:56 +01:00
1 parent daf096619f
commit 411dbeb530
6 files changed
+74 -10

No files matched your search

+10 -2
View File
@@ -2588,7 +2588,7 @@ def unit_target(unit: str) -> dict:
return {"model": model, "target": target}
if unit == IMAGE_H3_UNIT:
# one checkpoint, one target, read from the unit as the image lane's
model = _image_unit_flag("--model-path", "MiniMaxAI/MiniMax-H3-Image", IMAGE_H3_UNIT_PATH) \
model = hf_repo_of(_image_unit_flag("--model-path", "MiniMaxAI/MiniMax-H3-Image", IMAGE_H3_UNIT_PATH)) \
if IMAGE_H3_UNIT_PATH.exists() else None
return {"model": model, "target": "image-h3" if model else None}
if unit == KOLIBRI_UNIT:
@@ -4373,6 +4373,14 @@ def _image_unit_text(path: Path | None = None) -> str:
return text
def hf_repo_of(model: str) -> str:
"""A repository's name for what a unit's --model-path says: the name itself, or the repository of a Hugging Face
cache snapshot's path (.../models--ORG--NAME/snapshots/<rev>), as the MiniMax-H3-Image lane names its checkpoint
since v1.50.0 (install-image-h3.sh says why)."""
m = re.search(r"/models--([^/]+?)--([^/]+)/snapshots/[0-9a-f]{40}/?$", model or "")
return f"{m.group(1)}/{m.group(2)}" if m else model
def _image_unit_flag(flag: str, fallback: str, path: Path | None = None) -> str:
"""What the installed unit passes, not what this file assumes. The installer accepts
IMAGE_BIND, so a lane bound elsewhere must not be probed on a loopback port that
@@ -4568,7 +4576,7 @@ def image_status() -> dict:
out = {"unit": unit, "units": [u for u in IMAGE_UNITS if image_unit_path(u).exists()],
"installed": path.exists(), "port": image_h3_port() if h3 else image_port(),
"host": _image_unit_flag("--host", "127.0.0.1", path),
"model": _image_unit_flag("--model-path", "MiniMaxAI/MiniMax-H3-Image" if h3 else "Qwen/Qwen-Image-2.1", path),
"model": hf_repo_of(_image_unit_flag("--model-path", "MiniMaxAI/MiniMax-H3-Image" if h3 else "Qwen/Qwen-Image-2.1", path)),
"state": "not installed", "available": False, "llm_lane": "", "progress": {}}
if not out["installed"]:
return out
+10
View File
@@ -49,6 +49,16 @@ class TheLaneTheViewAddresses(Base):
self.box([QWEN, H3], {QWEN: "stopped", H3: "stopped"})
self.assertEqual(self.ck.image_unit(), QWEN, "nothing failed: the one installed first")
def test_a_unit_that_names_its_snapshots_path_says_its_repository(self):
# since v1.50.0 the unit names the checkpoint by its snapshot's path (install-image-h3.sh says why): the page and
# the lane's card still say the repository
snap = "/h/.cache/huggingface/hub/models--MiniMaxAI--MiniMax-H3-Image/snapshots/" + "5" * 40
(self.t / H3).write_text(f"[Service]\nExecStart=/x/sglang serve --model-path {snap} --host 127.0.0.1 --port 30026\n")
self.ck.LIFE["states"] = {H3: "ready", QWEN: "stopped"}
self.assertEqual(self.ck.image_status()["model"], "MiniMaxAI/MiniMax-H3-Image")
self.assertEqual(self.ck.unit_target(H3)["model"], "MiniMaxAI/MiniMax-H3-Image")
self.assertEqual(self.ck.hf_repo_of("Qwen/Qwen-Image-2.1"), "Qwen/Qwen-Image-2.1", "a name stays as it is")
def test_in_a_switch_the_lane_coming_up_before_the_one_stopping(self):
self.box([QWEN, H3], {QWEN: "stopping", H3: "starting"})
self.assertEqual(self.ck.image_unit(), H3)
+4
View File
@@ -101,6 +101,10 @@ class Base(unittest.TestCase):
# systemd about its image unit 36 times (found in review, 2026-09-24). A test that
# needs an answer puts its own run() in place.
cls.ck.run = lambda argv, timeout=5.0, merge_err=False: ""
# The MiniMax-H3-Image lane's unit too (v1.50): image_unit() reads both image lanes' units, and left real it read
# the reference box's, installed by the lane's proof, and addressed its port (found 2026-11-16). Absent here; a
# test that needs it writes its own.
cls.ck.IMAGE_H3_UNIT_PATH = cls.tmp / "qwen38-image-h3.service"
# Kept in a dict, not as a class attribute: a plain function assigned to a class
# becomes a bound method and would be handed self. Two tests below call the real
# one to check it reads the installed unit.
+14 -3
View File
@@ -92,6 +92,7 @@ PORT="${IMAGE_H3_PORT:-$(unit_flag --port)}"; PORT="${PORT:-30026}"
IMAGE_H3_MODEL_PIN="MiniMaxAI/MiniMax-H3-Image"
IMAGE_H3_MODEL_PIN_REV="5f90473023975e6271b0ed1dd84c4e88e4bbc6d3"
MODEL="$IMAGE_H3_MODEL_PIN"; MODEL_REV="${IMAGE_H3_MODEL_REV:-$IMAGE_H3_MODEL_PIN_REV}"
[[ "$MODEL_REV" =~ ^[0-9a-f]{40}$ ]] || die "IMAGE_H3_MODEL_REV must be a commit (40 hexadecimal characters), got: $MODEL_REV"
# Its text encoder, which its model_index.json loads from MiniMax-H3's text_encoder/ folder: the
# video lane's model, at the revision that lane pins (install-video.sh VIDEO_MODEL_PIN_REV), whose
# text_encoder/ holds the same 23 files as its FL2VA/ and Ref2VA/ ones (their blobs compared on the
@@ -115,6 +116,12 @@ HF_CACHE="${HF_CACHE:-$(installed_env HF_HOME | tr -s /)}"; HF_CACHE="${HF_CACHE
HF_CACHE="${HF_CACHE:-$HOME/.cache/huggingface}"
# The text encoder's folder in that cache, which the unit names: the files of the pinned revision.
ENCODER_DIR="$HF_CACHE/hub/models--${IMAGE_H3_ENCODER_PIN//\//--}/snapshots/$IMAGE_H3_ENCODER_PIN_REV/text_encoder"
# The checkpoint by its snapshot's path, not by its repository's name: the runtime then reads the folder as it is.
# By name, huggingface_hub (1.33) checks an offline snapshot against the repository's whole file list it cached at the
# fetch, and this lane fetches only the files it loads (ALLOW): every start failed with IncompleteSnapshotError (the
# lane's first proof on the reference box, 2026-11-16). SGLang's registry maps such a path to MiniMax-H3-Image's own
# config by its models--MiniMaxAI--MiniMax-H3-Image folder (step 3 checks it).
MODEL_SNAP="$HF_CACHE/hub/models--${MODEL//\//--}/snapshots/$MODEL_REV"
# The SGLang source this lane runs: main at the commit SGLang's DGX Spark recipe was measured on
# by this project (study G8, 2026-11-11: 2048 x 2048 in 15.6 s, 4736 x 3552 in 81.1 s). It holds the
# recipe's own commit (539fea720b86, merged by PR 49552 as 170804b40a40) and the runtime's
@@ -215,7 +222,7 @@ install_service(){
RENDER="$(mktemp)"; trap 'rm -f "$RENDER"' EXIT
sed -e "s|__USER__|$(id -un)|g" -e "s|__GROUP__|$(id -gn "$(id -un)")|g" \
-e "s|__IMAGE_H3_LANE_DIR__|$LANE_DIR|g" -e "s|__IMAGE_H3_VENV__|$VENV|g" \
-e "s|__IMAGE_H3_MODEL__|$MODEL|g" -e "s|__IMAGE_H3_ENCODER__|$ENCODER_DIR|g" \
-e "s|__IMAGE_H3_MODEL__|$MODEL_SNAP|g" -e "s|__IMAGE_H3_ENCODER__|$ENCODER_DIR|g" \
-e "s|__IMAGE_H3_PORT__|$PORT|g" -e "s|__IMAGE_H3_BIND__|$IMAGE_H3_BIND|g" -e "s|__HF_CACHE__|$HF_CACHE|g" \
-e "s|__HOME__|$HOME|g" \
"$HERE/$UNIT.template" > "$RENDER"
@@ -412,7 +419,7 @@ fi
# MiniMax-H3-Image's own config (registered under it at this commit, ahead of MiniMax-H3's), and
# the pipeline its model_index.json names resolves to MiniMax-H3's image pipeline.
# Its error, if any, is said as it is, on the line above the die: a missing package, or a pin that does not register it.
"$VENV/bin/python" - <<'PY' || die "the runtime does not load MiniMax-H3-Image (its error is just above: a missing package, or a pin that does not register the model)."
"$VENV/bin/python" - "$MODEL_SNAP" <<'PY' || die "the runtime does not load MiniMax-H3-Image (its error is just above: a missing package, or a pin that does not register the model)."
import pathlib, sglang
from sglang.multimodal_gen import registry
from sglang.multimodal_gen.configs.pipeline_configs.minimax_h3_image import MiniMaxH3ImagePipelineConfig
@@ -423,6 +430,10 @@ if info is None or info.pipeline_config_cls is not MiniMaxH3ImagePipelineConfig:
raise SystemExit("MiniMaxAI/MiniMax-H3-Image does not map to MiniMax-H3-Image's own config in the model registry")
if registry.get_pipeline_class("MiniMaxH3ImagePipeline") is not MiniMaxH3ImagePipeline:
raise SystemExit("MiniMaxH3ImagePipeline does not resolve to MiniMax-H3's image pipeline in the model registry")
# the path the unit passes resolves to the same registered model (not MiniMax-H3's, the video lane's)
import sys
if registry._match_registered_hf_path(sys.argv[1]) != "MiniMaxAI/MiniMax-H3-Image":
raise SystemExit(f"the snapshot path {sys.argv[1]} does not resolve to MiniMaxAI/MiniMax-H3-Image in the model registry")
print(f" runtime: {pathlib.Path(sglang.__file__).parent}")
PY
# The runtime is whole: its note says so, and it is what the cockpit and install.sh read as this
@@ -444,7 +455,7 @@ echo "MiniMax-H3-Image: ${LICENCE/Its licence/its licence}"
echo "fetching with allow: $ALLOW"
HF_HOME="$HF_CACHE" HF_HUB_DOWNLOAD_TIMEOUT=30 HF_HUB_DISABLE_XET=1 \
"$VENV/bin/python" "$HERE/ckpt-fetch.py" "$MODEL" "$MODEL_REV" --allow "$ALLOW" --refs-main pin \
|| die "checkpoint download failed. Causes: no internet, HuggingFace throttling an unauthenticated download (set HF_TOKEN=<your token>), a pinned revision removed upstream (IMAGE_H3_MODEL_REV=main serves the current one), or a permission error in the cache. Re-running resumes."
|| die "checkpoint download failed. Causes: no internet, HuggingFace throttling an unauthenticated download (set HF_TOKEN=<your token>), a pinned revision removed upstream (IMAGE_H3_MODEL_REV=<a commit of the repository> serves another), or a permission error in the cache. Re-running resumes."
HF_HOME="$HF_CACHE" HF_HUB_DOWNLOAD_TIMEOUT=30 HF_HUB_DISABLE_XET=1 \
"$VENV/bin/python" "$HERE/ckpt-fetch.py" "$IMAGE_H3_ENCODER_PIN" "$IMAGE_H3_ENCODER_PIN_REV" --allow "text_encoder/*" --offline-first \
|| die "the text encoder's download failed (the same causes as the checkpoint's). Re-running resumes."
+9 -5
View File
@@ -1200,13 +1200,17 @@ if [ "$CHOICE" = "image-h3" ]; then
done
unset _v
H3_MODEL="$(grep -oE -- '--model-path [^ ]+' "$IMAGE_H3_UNIT" | head -1 | cut -d' ' -f2 || true)"
H3_MODEL="${H3_MODEL:-$IMAGE_H3_MODEL_PIN}"
H3_HF="$(grep -m1 -E '^Environment=HF_HOME=' "$IMAGE_H3_UNIT" | cut -d= -f3- || true)"
# The revision this box serves, as for the image lane: refs/main, which the offline unit
# resolves; the installer's pin when it is missing or holds no commit.
H3_MODEL_DIR="${H3_HF:-$HF_CACHE}/hub/models--${H3_MODEL//\//--}"
H3_REV=""
if [ -f "$H3_MODEL_DIR/refs/main" ]; then H3_REV="$(cat "$H3_MODEL_DIR/refs/main")"; fi
# The unit names the checkpoint by its snapshot's path (v1.50.0: by name, an offline start refused the snapshot this
# lane fetches only in part): the repository and the revision are that path's. A unit of before names the repository,
# and its revision is then refs/main's, which the offline unit resolved, else the installer's pin.
if [[ "$H3_MODEL" =~ /models--([^/]+)--([^/]+)/snapshots/([0-9a-f]{40})$ ]]; then
H3_MODEL="${BASH_REMATCH[1]}/${BASH_REMATCH[2]}"; H3_REV="${BASH_REMATCH[3]}"
fi
H3_MODEL="${H3_MODEL:-$IMAGE_H3_MODEL_PIN}"
H3_MODEL_DIR="${H3_HF:-$HF_CACHE}/hub/models--${H3_MODEL//\//--}"
if [ -z "$H3_REV" ] && [ -f "$H3_MODEL_DIR/refs/main" ]; then H3_REV="$(cat "$H3_MODEL_DIR/refs/main")"; fi
[[ "$H3_REV" =~ ^[0-9a-f]{40}$ ]] || H3_REV=""
if [ -z "$H3_REV" ]; then
if [ "$H3_MODEL" = "$IMAGE_H3_MODEL_PIN" ]; then H3_REV="$IMAGE_H3_MODEL_PIN_REV"; else H3_REV=main; fi
+27
View File
@@ -41,6 +41,33 @@ class TheUnit(unittest.TestCase):
for ph in sorted(set(re.findall(r"__[A-Z][A-Z0-9_]*__", UNIT))):
self.assertIn(f"s|{ph}|", INST, ph)
def test_the_checkpoint_is_named_by_its_snapshots_path(self):
# by name, an offline start checked the snapshot against the repository's whole cached file list, and this lane
# fetches only what it loads: every start failed (IncompleteSnapshotError, its first proof, 2026-11-16)
self.assertIn('MODEL_SNAP="$HF_CACHE/hub/models--${MODEL//\\//--}/snapshots/$MODEL_REV"', INST)
self.assertIn('-e "s|__IMAGE_H3_MODEL__|$MODEL_SNAP|g"', INST)
self.assertIn('[[ "$MODEL_REV" =~ ^[0-9a-f]{40}$ ]] || die', INST, "a branch name would make no snapshot path")
self.assertIn('_match_registered_hf_path(sys.argv[1]) != "MiniMaxAI/MiniMax-H3-Image"', INST)
def test_the_switch_reads_the_repository_and_revision_off_the_units_path(self):
import tempfile
sw = (REPO / "switch-model.sh").read_text()
start = sw.index(' H3_MODEL="$(grep -oE -- \'--model-path [^ ]+\' "$IMAGE_H3_UNIT"')
end = sw.index("\n", sw.index(' if [ "$H3_MODEL" = "$IMAGE_H3_MODEL_PIN" ]; then H3_REV='))
block = sw[start:end] + "\n fi\n"
d = pathlib.Path(tempfile.mkdtemp(prefix="h3-switch-"))
rev, pin = "a" * 40, "b" * 40
cases = {"path": (f"--model-path /c/hub/models--MiniMaxAI--MiniMax-H3-Image/snapshots/{rev} \\", rev),
"name": ("--model-path MiniMaxAI/MiniMax-H3-Image \\", pin)}
for how, (line, want) in cases.items():
with self.subTest(how):
unit = d / f"{how}.service"
unit.write_text(f"[Service]\nExecStart=/x/sglang serve {line}\n")
script = (f'IMAGE_H3_UNIT="{unit}"; HF_CACHE="{d}"; IMAGE_H3_MODEL_PIN=MiniMaxAI/MiniMax-H3-Image; '
f'IMAGE_H3_MODEL_PIN_REV={pin}\n' + block + '\necho "$H3_MODEL $H3_REV"')
r = subprocess.run(["bash", "-c", script], capture_output=True, text=True)
self.assertEqual(r.stdout.split(), ["MiniMaxAI/MiniMax-H3-Image", want], r.stderr)
def test_the_encoder_path_is_the_pinned_revision_of_minimax_h3(self):
self.assertIn('ENCODER_DIR="$HF_CACHE/hub/models--${IMAGE_H3_ENCODER_PIN//\\//--}/snapshots/$IMAGE_H3_ENCODER_PIN_REV/text_encoder"', INST)
video = (REPO / "install-video.sh").read_text()