Files
alzeo/tests/test_one_fetch.py
T
Hasan BasbunarandClaude Opus 5.5 4c031634ad v1.51: the Liquid AI LFM3 lane (lfm3), on vLLM's own nightly image, in every lane list
Liquid AI's LFM3 1.7B in its official NVFP4 (LiquidAI/LFM3-1.7B-NVFP4 at cfe4b5ea), served by
vllm/vllm-openai's nightly of commit 60bd6dd by digest, pulled as published: LFM3 came to vLLM on
2026-11-06 and is in no release. A text lane of its own on the text lanes' port, behind the proxy and
its key: the key by --config (redacted in vLLM's own log line), the vLLM lanes' middleware for every
route but /health and /metrics, its served name lfm3-1.7b, the model's whole window (262,144), the
qwen3 reasoning parser and the qwen3_coder tool-call parser its template's form asks for, the prompt
tokens details, its own vLLM, FlashInfer and Triton caches. --gpu-memory-utilization is LFM3_GMU, 0.75:
this nightly extends its KV cache into every byte left free after its warmup, and the reference box
kept 1,087 MiB available at its lowest with none set. The prefix cache at vLLM's default for this
hybrid model, measured 99 to 100 % of an agent's next turn.

One engine at a time: Conflicts= and After= with every engine unit, both ways. install-lfm3.sh on
vllm-lane.sh like the other vLLM lanes (--units-only, --prepare, --stage, --uninstall, the proof with a
tool call), refused on a 64 GB box (fits_64 False: no 64 GB share was measured); install.sh puts its
unit in on demand (--no-lfm3, --with-lfm3, --all-weights, 41 GB), switch-model.sh lfm3 fetches its
checkpoint in its own image and points opencode at it, uninstall.sh takes it all, check-pins.sh
checks its revision and its image, the cockpit's sudoers its unit.

Its clients: the opencode provider lfm3 (oc-lfm3.py, its window by oc-limits.sh), pi and omp. Its
template reads enable_thinking, true by default, and no level: opencode offers the high and none
variants, pi off and high alone (HELD_LEVELS maps every other level to null), the two states it holds.

Found on the way: the vLLM lanes' cache-report test now lists it, and its family tests, the lists'
counts and the --all-weights total (1235 GB) follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:38:53 +01:00

149 lines
9.2 KiB
Python

#!/usr/bin/env python3
"""Every lane's checkpoint goes through ckpt-fetch.py, and no script keeps a fetch of its own.
Seven copies of the fetch had drifted (found in review, 2026-10-14): the image and video
switches gave up at the first network error, only Kolibri's checked the shards of a cached
snapshot, and the Xet exception lived in the text lanes' copies alone. tests/test_ckpt_fetch.py
holds what the script does; this holds who runs it, with which options, that each keeps the
Xet ban the script lifts for one repo only, and that each caller mounting it in a container
makes sure it is there first (docker -v of a missing file makes a root-owned directory in its
place).
One exception, the llama.cpp lanes' (v1.48): their GGUF files go through gguf-fetch.py, with Python's standard
library on the host, since llama.cpp's server image has no Python and a GGUF repository holds every quantization of
its model, of which a lane takes a few files, each pinned by its sha256. It is held to the same rule: one call, in
llamacpp-lane.sh, which the lane's installer runs (--fetch, which switch-model.sh runs in turn), and no other.
"""
import pathlib
import re
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
def text(name):
return (REPO / name).read_text()
# who runs it, as each script writes the call: the options are what each fetch is
CALLS = {
"install.sh, the text lanes":
("install.sh", '"$PULLED_IMAGE" /opt/qwen38/ckpt-fetch.py "$1" "$2" --refs-main fill'),
"switch-model.sh, the text lanes":
("switch-model.sh", '"$DL_IMAGE" /opt/qwen38/ckpt-fetch.py "$TARGET_REPO" "$TARGET_REV" --offline-first '
'--refs-main fill'),
"install-image.sh":
("install-image.sh", '"$VENV/bin/python" "$HERE/ckpt-fetch.py" "$MODEL" "$MODEL_REV" --refs-main pin'),
"switch-model.sh, the image lane":
("switch-model.sh", '"$IMG_PY" "$REPO_DIR/ckpt-fetch.py" "$IMG_MODEL" "$IMG_REV" --offline-first \\\n'
' --need-gb 34 --free-gb "$(dl_free_gb "${IMG_HF:-$HF_CACHE}")" --refs-main pin'),
"install-video.sh":
("install-video.sh", '"$VENV/bin/python" "$HERE/ckpt-fetch.py" "$MODEL" "$MODEL_REV" --allow "$ALLOW" --refs-main pin'),
"switch-model.sh, the video lane":
("switch-model.sh", '"$VID_PY" "$REPO_DIR/ckpt-fetch.py" "$VID_MODEL" "$VID_REV" --allow "$VID_ALLOW" '
'--offline-first --refs-main fill'),
"install-image-h3.sh, its checkpoint":
("install-image-h3.sh", '"$VENV/bin/python" "$HERE/ckpt-fetch.py" "$MODEL" "$MODEL_REV" --allow "$ALLOW" --refs-main pin'),
"install-image-h3.sh, its text encoder":
("install-image-h3.sh", '"$VENV/bin/python" "$HERE/ckpt-fetch.py" "$IMAGE_H3_ENCODER_PIN" "$IMAGE_H3_ENCODER_PIN_REV" '
'--allow "text_encoder/*" --offline-first'),
"switch-model.sh, the MiniMax-H3-Image lane's checkpoint":
("switch-model.sh", '"$H3_PY" "$REPO_DIR/ckpt-fetch.py" "$H3_MODEL" "$H3_REV" --allow "$ALLOW" --offline-first '
'--refs-main pin'),
"switch-model.sh, the MiniMax-H3-Image lane's text encoder":
("switch-model.sh", '"$H3_PY" "$REPO_DIR/ckpt-fetch.py" "$IMAGE_H3_ENCODER_PIN" "$IMAGE_H3_ENCODER_PIN_REV" '
'--allow "text_encoder/*" --offline-first'),
"vllm-lane.sh, the checkpoints of the five vLLM lanes' installers":
("vllm-lane.sh", '"$LOCAL_IMAGE" /opt/qwen38/ckpt-fetch.py "$1" "$2" --offline-first'),
"switch-model.sh, the Kolibri lane":
("switch-model.sh", '"$KOL_IMAGE" /opt/qwen38/ckpt-fetch.py "$KOL_MODEL" "$KOL_REV" --offline-first \\\n'
' --need-gb "$KOL_NEED_GB" --free-gb "$(dl_free_gb "$KOL_HF")"'),
"switch-model.sh, the Nemotron lane":
("switch-model.sh", '"$NEM_IMAGE" /opt/qwen38/ckpt-fetch.py "$NEM_R" "$NEM_V" --offline-first \\\n'
' --need-gb "$NEM_ASK" --free-gb "$(dl_free_gb "$NEM_HF")"'),
"switch-model.sh, the Qwen3.8 Flash-Next FP4-Local lane":
("switch-model.sh", '"$FLASH_LOCAL_IMAGE" /opt/qwen38/ckpt-fetch.py "$FLASH_LOCAL_REPO" "$FLASH_LOCAL_REV" --offline-first \\\n'
' --need-gb "$FLASH_LOCAL_GB" --free-gb "$(dl_free_gb "$FLL_HF")"'),
"switch-model.sh, the Ornith lane":
("switch-model.sh", '"$FLASH_LOCAL_IMAGE" /opt/qwen38/ckpt-fetch.py "$ORNITH_122B_REPO" "$ORNITH_122B_REV" --offline-first \\\n'
' --need-gb "$ORNITH_122B_GB" --free-gb "$(dl_free_gb "$ORN_HF")"'),
}
SCRIPTS = ("install.sh", "switch-model.sh", "install-image.sh", "install-video.sh", "install-kolibri.sh",
"install-nemotron.sh", "install-nemotron-super.sh", "install-flash-local.sh", "install-ornith-122b.sh",
"vllm-lane.sh", "install-flash-unsloth.sh", "llamacpp-lane.sh", "install-image-h3.sh")
# the llama.cpp lanes' one fetch of their GGUF files (the docstring says why it is not ckpt-fetch.py)
GGUF_CALL = ("llamacpp-lane.sh", 'python3 -I "$HERE/gguf-fetch.py" "$HF_CACHE" "$@"')
VLLM_INSTALLERS = ("install-kolibri.sh", "install-nemotron.sh", "install-nemotron-super.sh", "install-flash-local.sh",
"install-ornith-122b.sh")
class EveryLaneFetchesThroughIt(unittest.TestCase):
def test_each_caller_runs_it_with_its_options(self):
for what, (script, call) in CALLS.items():
with self.subTest(what):
self.assertEqual(text(script).count(call), 1, f"{script} no longer runs it this way")
self.assertEqual(text("switch-model.sh").count("ckpt-fetch.py\" \"$") + text("switch-model.sh").count(
"/opt/qwen38/ckpt-fetch.py \"$"), 11,
"switch-model.sh fetches for ten lanes, each through it (the MiniMax-H3-Image lane twice: its checkpoint "
"and its text encoder; the Liquid AI LFM2.5 24B-A2B lane's checkpoint and draft in one loop)")
def test_no_script_keeps_a_fetch_of_its_own(self):
for script in SCRIPTS:
t = text(script)
with self.subTest(script):
self.assertNotIn("snapshot_download(", t)
self.assertNotIn("<<'PYEOF' || die \"Checkpoint", t)
# one single-file fetch is left, the video lane's Turbo adapter, which the lane serves
# without (a failure there is a note)
self.assertEqual(t.count("hf_hub_download("), 1 if script == "install-video.sh" else 0)
self.assertFalse((REPO / "kolibri-fetch.py").exists(), "the Kolibri lane's own copy is back")
def test_every_call_keeps_the_xet_ban(self):
# the script lifts it for the one repo the CDN refuses, and only where it is on
for what, (script, call) in CALLS.items():
t = text(script)
at = t.index(call)
with self.subTest(what):
self.assertIn("HF_HUB_DISABLE_XET=1", t[max(0, at - 700):at])
def test_a_container_gets_the_script_only_once_it_is_known_to_be_there(self):
for script, check, mount in (
("install.sh", '[ -f "$REPO_DIR/ckpt-fetch.py" ] || die',
'-v "$REPO_DIR/ckpt-fetch.py:/opt/qwen38/ckpt-fetch.py:ro"'),
("switch-model.sh", '[ -f "$REPO_DIR/ckpt-fetch.py" ] || die',
'-v "$REPO_DIR/ckpt-fetch.py:/opt/qwen38/ckpt-fetch.py:ro"'),
("vllm-lane.sh", '[ -f "$HERE/$f" ] || die',
'-v "$HERE/ckpt-fetch.py:/opt/qwen38/ckpt-fetch.py:ro"')):
t = text(script)
with self.subTest(script):
self.assertIn(check, t)
self.assertIn(mount, t)
self.assertLess(t.index(check), t.index(mount), "checked before it is mounted")
def test_the_gguf_files_have_their_one_fetch_too(self):
script, call = GGUF_CALL
self.assertEqual(text(script).count(call), 1, f"{script} no longer runs it this way")
others = [s for s in (*SCRIPTS, *(p.name for p in REPO.glob("*.sh")))
if s != script and "gguf-fetch.py\" \"$" in text(s)]
self.assertEqual(others, [], "a second caller of gguf-fetch.py")
# its installer fetches through it alone, and switch-model.sh through its installer
self.assertIn('\n llane_fetch "$MODEL" "$MODEL_REV"', text("install-flash-unsloth.sh"))
self.assertIn('bash "$REPO_DIR/install-flash-unsloth.sh" --fetch', text("switch-model.sh"))
# and its token is never on a command line: read from the environment by the script
self.assertNotIn("HF_TOKEN", call)
self.assertIn('os.environ.get("HF_TOKEN"', text("gguf-fetch.py"))
def test_each_vllm_installer_names_the_script_in_its_preflight_before_it_fetches(self):
# the three vLLM installers check ckpt-fetch.py in their preflight (vllm-lane.sh's
# vlane_preflight checks each file it is given), before their first vlane_fetch
for script in VLLM_INSTALLERS:
t = text(script)
with self.subTest(script):
pre = re.search(r"\nvlane_preflight [^\n]*\bckpt-fetch\.py\b", t)
self.assertIsNotNone(pre, "its preflight checks ckpt-fetch.py")
self.assertLess(pre.start(), t.index('\nvlane_fetch "'))
if __name__ == "__main__":
unittest.main()