embeddings lanes: what the review of v1.61 found, blank chunks taken, the embeddings lane's code removed by uninstall.sh as Clipstral's is, comments and a test's hygiene

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Opus 5.5 committed 2026-12-03 10:51:51 +01:00
1 parent 21da1c049e
commit 795c49e93d
8 files changed
+32 -12

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ function makerMark(unit, cls = 'mark'){
// How long each lane takes to answer after a start, before the box has seen one of its
// boots (measured on the reference box). Once a lane booted in front of the cockpit, the
// median of its own boots replaces these.
const READY_DEFAULT = {[U27]: 540, [UFLASH]: 780, [FLASH_LOCAL_UNIT]: 1020, [KOLIBRI_UNIT]: 600, [NEMOTRON_UNIT]: 450, [NEMOTRON_SUPER_UNIT]: 660, [ORNITH_UNIT]: 420, [FLASH_UNSLOTH_UNIT]: 420, [IMAGE_UNIT]: 70, [IMAGE_H3_UNIT]: 451, [VIDEO_UNIT]: 720, [TRANSCRIBE_UNIT]: 15, [LFM25_UNIT]: 290, [LFM3_UNIT]: 160, [INKLING_UNIT]: 180, [EMBED_UNIT]: 30, [CLIPSTRAL_UNIT]: 10};
const READY_DEFAULT = {[U27]: 540, [UFLASH]: 780, [FLASH_LOCAL_UNIT]: 1020, [KOLIBRI_UNIT]: 600, [NEMOTRON_UNIT]: 450, [NEMOTRON_SUPER_UNIT]: 660, [ORNITH_UNIT]: 420, [FLASH_UNSLOTH_UNIT]: 420, [IMAGE_UNIT]: 70, [IMAGE_H3_UNIT]: 451, [VIDEO_UNIT]: 720, [TRANSCRIBE_UNIT]: 15, [LFM25_UNIT]: 290, [LFM3_UNIT]: 160, [INKLING_UNIT]: 180, [EMBED_UNIT]: 10, [CLIPSTRAL_UNIT]: 10};
const TARGET_UNIT = t => t === 'image' || t === 'image-turbo' ? IMAGE_UNIT : t === 'image-h3' ? IMAGE_H3_UNIT : t === 'video' ? VIDEO_UNIT
: t === 'transcribe' ? TRANSCRIBE_UNIT : t === 'lfm25' ? LFM25_UNIT : t === 'lfm3' ? LFM3_UNIT : t === 'inkling' ? INKLING_UNIT
: String(t).startsWith('kolibri') ? KOLIBRI_UNIT : t === 'nemotron-super' ? NEMOTRON_SUPER_UNIT : String(t).startsWith('nemotron') ? NEMOTRON_UNIT
+3 -3
View File
@@ -125,7 +125,7 @@ TEXT_UNITS="${TEXT_UNITS:-$LANES_UNIT_DIR/qwen38-sglang.service $CONFIG_DIR/laun
HF_CACHE="${HF_CACHE:-$(unit_hf_cache "$INSTALLED" $TEXT_UNITS 2>/dev/null || true)}"; HF_CACHE="${HF_CACHE:-$HOME/.cache/huggingface}"
model_files(){ printf '%s\n' "$CLIPSTRAL_FILE" "$CLIPSTRAL_TOKENIZER"; }
# The lane's code, a copy of this repo's two files in a folder of its own named by their content: the unit names that
# The lane's code, a copy of this repo's four files in a folder of its own named by their content: the unit names that
# folder, so an update that waits for the lane's Load leaves the code the unit in place runs as it was.
CODE_FILES=(clipstral-server.py clipstral_model.py vectors_server.py cpu_layers.py)
CODE_DIR="$CONFIG_DIR/clipstral/$(cd "$HERE" && cat "${CODE_FILES[@]}" | sha256sum | cut -c1-12)"
@@ -297,8 +297,8 @@ WAS_ACTIVE=0; systemctl is-active --quiet "$UNIT" 2>/dev/null && WAS_ACTIVE=1
KEEP=$WAS_ACTIVE
cleanup(){ rm -f "${RENDER:-}"; [ "$KEEP" -eq 1 ] || sudo systemctl stop "$UNIT" 2>/dev/null || true; }
trap cleanup EXIT
# A lane that serves older files than the ones this run put in place restarts for the proof (install-embeddings.sh says
# why). Its files: the unit, its code, and the model's as its snapshot names them.
# A lane that serves older files than the ones this run put in place restarts for the proof, so that the proof is of what
# this run installed (lanes.sh's lane_serves_older says how it is told). Its files: the unit, its code, and the model's as its snapshot names them.
SNAP="$HF_CACHE/hub/models--${CLIPSTRAL_MODEL//\//--}/snapshots/$CLIPSTRAL_REV"
PROVE_FILES=("$INSTALLED" "${CODE_FILES[@]/#/$CODE_DIR/}")
while read -r f; do PROVE_FILES+=("$SNAP/${f%%=*}"); done < <(model_files)
+4 -4
View File
@@ -110,7 +110,7 @@ IMAGE_GB=48
# The lane's port, read back as install-transcribe.sh reads its (the unit is this lane's only
# record; the cockpit's Load re-renders, it does not invent). The proxy reads it there too,
# the --port of the installed unit, so a EMBED_PORT taken here is followed without telling it.
# the --port of the installed unit, so an EMBED_PORT taken here is followed without telling it.
# No bind variable: without a key, this lane never listens beyond 127.0.0.1 (see WHY NO KEY).
installed_flag(){ # $1 the flag (--port): the value the installed unit gives it, its last word
# shellcheck disable=SC2086
@@ -125,7 +125,7 @@ TEXT_UNITS="${TEXT_UNITS:-$LANES_UNIT_DIR/qwen38-sglang.service $CONFIG_DIR/laun
HF_CACHE="${HF_CACHE:-$(unit_hf_cache "$INSTALLED" $TEXT_UNITS 2>/dev/null || true)}"; HF_CACHE="${HF_CACHE:-$HOME/.cache/huggingface}"
model_files(){ printf '%s\n' "$EMBED_FILE" "$EMBED_TOKENIZER"; }
# The lane's code, a copy of this repo's two files in a folder of its own named by their content: the unit names that
# The lane's code, a copy of this repo's four files in a folder of its own named by their content: the unit names that
# folder, so an update that waits for the lane's Load leaves the code the unit in place runs as it was.
CODE_FILES=(pplx-server.py pplx_model.py vectors_server.py cpu_layers.py)
CODE_DIR="$CONFIG_DIR/embed/$(cd "$HERE" && cat "${CODE_FILES[@]}" | sha256sum | cut -c1-12)"
@@ -297,8 +297,8 @@ WAS_ACTIVE=0; systemctl is-active --quiet "$UNIT" 2>/dev/null && WAS_ACTIVE=1
KEEP=$WAS_ACTIVE
cleanup(){ rm -f "${RENDER:-}"; [ "$KEEP" -eq 1 ] || sudo systemctl stop "$UNIT" 2>/dev/null || true; }
trap cleanup EXIT
# A lane that serves older files than the ones this run put in place restarts for the proof (install-embeddings.sh says
# why). Its files: the unit, its code, and the model's as its snapshot names them.
# A lane that serves older files than the ones this run put in place restarts for the proof, so that the proof is of what
# this run installed (lanes.sh's lane_serves_older says how it is told). Its files: the unit, its code, and the model's as its snapshot names them.
SNAP="$HF_CACHE/hub/models--${EMBED_MODEL//\//--}/snapshots/$EMBED_REV"
PROVE_FILES=("$INSTALLED" "${CODE_FILES[@]/#/$CODE_DIR/}")
while read -r f; do PROVE_FILES+=("$SNAP/${f%%=*}"); done < <(model_files)
+3 -1
View File
@@ -37,7 +37,9 @@ def inputs_of(req):
if not isinstance(x, str):
raise Bad(f"input[{i}] must be a string: this model reads texts alone (the Mistral Multimodal Embed 1B lane reads "
"images too)")
if not x.strip():
# an empty string has no token, so no mean to take; one of spaces has its own, as TEI took it in v1.60.0 (a splitter's
# blank chunk refused the whole batch of an indexing job, found in the review of v1.61.0)
if not x:
raise Bad(f"input[{i}] is an empty text")
return [("text", x) for x in given]
+1 -1
View File
@@ -603,7 +603,7 @@ class StoppedByItsUnit(unittest.TestCase):
class OverHttp(unittest.TestCase):
def setUp(self):
self.lines, self.was, V.log = [], V.log, lambda line: self.lines.append(line)
self.addCleanup(setattr, S, "log", self.was)
self.addCleanup(setattr, V, "log", self.was)
self.engine = Fake()
self.state = {"engine": self.engine}
self.srv = ThreadingHTTPServer(("127.0.0.1", 0), V.make_handler(self.state, S.LANE))
+5 -1
View File
@@ -53,13 +53,17 @@ class WhatItComputes(unittest.TestCase):
class WhatARequestAsks(unittest.TestCase):
def test_a_text_of_spaces_is_a_text(self):
"""TEI took it in v1.60.0, and an indexing job's splitter may give a blank chunk: refused, it took its whole batch with it."""
self.assertEqual(S.inputs_of({"input": ["a", " \n", "\t"]}), [("text", "a"), ("text", " \n"), ("text", "\t")])
def test_a_text_or_a_list_of_them(self):
for given, want in (("a", ["a"]), (["a", "b"], ["a", "b"]), ([{"type": "text", "text": "a"}, " b "], ["a", " b "])):
self.assertEqual(S.inputs_of({"input": given}), [("text", x) for x in want])
def test_what_it_refuses_names_the_entry_and_why(self):
for given, words in ((None, "'input' must be"), ([], "not empty"), (3, "'input' must be"), ("", "input[0] is an empty text"),
(["a", " \n"], "input[1] is an empty text"), ([1, 2], "token ids"), (["a", [1]], "input[1]: token ids"),
(["a", ""], "input[1] is an empty text"), ([1, 2], "token ids"), (["a", [1]], "input[1]: token ids"),
([[1]], "check_embedding_ctx_length"), ([None], "input[0] must be a string"),
([{"type": "image_url", "image_url": "data:image/png;base64,AAAA"}], "reads texts alone"),
(["a"] * (V.MAX_INPUTS + 1), f"over {V.MAX_INPUTS}")):
+13
View File
@@ -114,6 +114,19 @@ class TheSpeechLane(unittest.TestCase):
self.assertEqual(sorted(p.name for p in lane.iterdir()), ["models"])
self.assertIn(f"rm -rf '{lane}/models'", out)
def test_the_embeddings_lanes_code_goes_where_the_config_stays(self):
"""Their code is this repo's, copied into a folder named by its content (install-embeddings.sh, install-clipstral.sh):
the Clipstral lane's went with the units, the embeddings lane's stayed (found in the review of v1.61.0, 2026-12-02)."""
box = Box(units=("qwen38-embed.service", "qwen38-clipstral.service"))
for lane in ("embed", "clipstral"):
(box.home / f".config/qwen38/{lane}/0123456789ab").mkdir(parents=True)
(box.home / f".config/qwen38/{lane}/0123456789ab/vectors_server.py").write_text("#")
rc, out, _ = box.run() # no --yes, and no answer: the config stays
self.assertEqual(rc, 0, out)
self.assertTrue((box.home / ".config/qwen38/api-key").exists(), out)
for lane in ("embed", "clipstral"):
self.assertFalse((box.home / f".config/qwen38/{lane}").exists(), f"{lane}: {out[-600:]}")
def test_refused_sudo_leaves_the_speech_lane_whole(self):
box, lane = self.box(sudo_ok=False)
rc, out, _ = box.run("--yes")
+2 -1
View File
@@ -340,8 +340,9 @@ if [ -d "$IMAGE_H3_LANE_DIR" ] && { [ "$PRIV" -eq 0 ] || [ "$PRIV_DONE" -eq 1 ];
"$IMAGE_H3_LANE_DIR/sglang-source" "$IMAGE_H3_LANE_DIR/runtime-changed"
rmdir "$IMAGE_H3_LANE_DIR" 2>/dev/null || echo "kept $IMAGE_H3_LANE_DIR: it holds files the MiniMax-H3-Image lane did not put there"
fi
# The Clipstral lane's code, this repo's two files in a folder of their own, where the config is kept.
# The two embeddings lanes' code, this repo's files in folders of their own, where the config is kept.
if [ -d "$CONFIG_DIR/clipstral" ] && { [ "$PRIV" -eq 0 ] || [ "$PRIV_DONE" -eq 1 ]; }; then rm -rf "${CONFIG_DIR:?}/clipstral"; fi
if [ -d "$CONFIG_DIR/embed" ] && { [ "$PRIV" -eq 0 ] || [ "$PRIV_DONE" -eq 1 ]; }; then rm -rf "${CONFIG_DIR:?}/embed"; fi
# The speech lane's runtime, under the same rule: venv/, llama.cpp/ and the routes' script.
# Its models/ stay, with a reclaim command below, as every other checkpoint does.
if [ -d "$SPEECH_LANE_DIR" ] && { [ "$PRIV" -eq 0 ] || [ "$PRIV_DONE" -eq 1 ]; }; then