Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Download and prepare steps say what they are: one set of plain sentences (draft layer download, packing experts, checking files, picture reader) for the app and the Terminal; the SHA-256 check shows its own figure instead of a download stuck at 99%; a step's heading is kept in view; the .part file no longer jumps the bar
Niko12211972af6da13e
diff --git a/setup.py b/setup.pyindex 5dd45684b..8d9f89c5a 100644--- a/setup.py+++ b/setup.py@@ -2540,12 +2540,19 @@ def verify_sha256(s: Path, size: int, sha: str, own: bool = False) -> None:fail(f"{s.name} is {have:,} bytes, not {size:,}", "delete it and run setup again (the download restarts)")say(f" checking {s.name} (SHA-256, {size / 1e9:.1f} GB) ...")h = hashlib.sha256()+ seen, last = 0, 0.0with open(s, "rb") as f:while True:b = f.read(16 << 20)if not b:breakh.update(b)+ seen += len(b)+ if time.time() - last > 2 and size >= (1 << 30): # a figure for the app and the Terminal: hashing 60 GB takes minutes+ last = time.time()+ print(f"\r checking {s.name}: {seen / 1e9:6.2f} / {size / 1e9:.2f} GB ({100 * seen // size}%) ", end="", flush=True)+ if seen >= (1 << 30):+ print()if h.hexdigest() != sha:if own:fail(f"{s.name} does not match the published file (SHA-256 {h.hexdigest()}, expected {sha})",diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.pyindex 9ce63b3a3..bec861f72 100644--- a/strata_cli/launch/runner.py+++ b/strata_cli/launch/runner.py@@ -302,11 +302,12 @@ def launch_dir() -> Path:# ----------------------------------------------------------------------------------------------- the runner-def download_text(dl: dict, already: bool) -> str:- """The step line for the model download. A model whose files were all on disk before this run says so instead of "Downloading 58.5 of 58.5 GB"."""+def download_text(dl: dict, already: bool, label: str | None = None) -> str:+ """The step line for a download or a check. `label` is what is being fetched, in words (strata_control/progress_words.py). A model whose+ files were all on disk before this run says so instead of "Downloading 58.5 of 58.5 GB"."""if already:- return f"Model already downloaded ({dl['total_gb']:.1f} GB), checking the files"- return f"Downloading {dl['done_gb']:.1f} of {dl['total_gb']:.1f} GB"+ return f"The model files are already on this computer ({dl['total_gb']:.1f} GB); checking them"+ return f"{label}: {dl['done_gb']:.1f} of {dl['total_gb']:.1f} GB" if label else f"Downloading {dl['done_gb']:.1f} of {dl['total_gb']:.1f} GB"class Runner:@@ -662,15 +663,17 @@ class Runner:if not line:continuelines.append(line)- lines[:] = lines[-400:]+ lines[:] = lines[-1500:]prog = cat.mcp.install_progress(lines)prog = cat.mcp.combined_progress(prog, {"folder": folder, "total_gb": total})- dl = prog.get("download")- if dl and not s.model_path and dl.get("total_gb", 0) >= 0.05:- if already is None:+ dl, phase, label = prog.get("download"), prog.get("phase"), prog.get("label")+ if dl and dl.get("total_gb", 0) >= 0.05 and not (s.model_path and phase == "download"):+ if phase == "download" and already is None:already = float(dl["percent"]) >= 99.5- text = download_text(dl, already)+ text = download_text(dl, bool(already) and phase == "download", label)self.emit("model", text, float(dl["percent"]), step=prog.get("step"))+ elif label:+ self.emit("model", label, None, step=prog.get("step"))elif prog.get("step"):self.emit("model", f"Setup step {prog['step']}", None, step=prog.get("step"))code = p.wait()diff --git a/strata_control/progress_words.py b/strata_control/progress_words.pynew file mode 100644index 000000000..bd8344a89--- /dev/null+++ b/strata_control/progress_words.py@@ -0,0 +1,116 @@+"""What the person is told while a model downloads and is prepared: ONE place for the words, read by the app (through+tools/strata_mcp.py `install_progress`) and by the Terminal (`strata launch`, strata_cli/launch/runner.py).++Setup prints its work in seven steps and the tools it runs print their command lines (`> python tools/strata_pack.py build ...`)+and progress lines (`name: 1.20 / 5.04 GB (24%)`). Those titles are for people who read the setup log ("writing the start script",+"preparing the model for Strata"), and the name in a progress line is a file name or an internal label ("MTP draft layer",+"llama.cpp source"). This turns what setup last printed into one plain sentence that says what is really happening now.+The sentences are English; the app translates them like its other texts.++Nothing here reads a file or starts a process: it works on the last lines of setup's output.+"""++from __future__ import annotations++import re+from dataclasses import dataclass++STEP_RE = re.compile(r"=== Step (\d+): (.+?) ===")+CHECKING_RE = re.compile(r"^\s*checking\b.*\bSHA-256\b", re.I)+PROGRESS_RE = re.compile(r"\s*(\S.*?): +([\d.]+) / ([\d.]+) GB \((\d+)%\)")+++@dataclass(frozen=True)+class Words:+ phase: str # a short key for tests and for the app to pick an icon: check, helpers, engine, download, verify, pictures,+ # pack, tokenizer, draft_download, draft, settings, ...+ label: str # the sentence++ def as_dict(self) -> dict:+ return {"phase": self.phase, "label": self.label}+++def _after_last_step(lines: list[str]) -> list[str]:+ for i in range(len(lines) - 1, -1, -1):+ if STEP_RE.search(lines[i]):+ return lines[i + 1:]+ return lines+++def _last_matching(lines: list[str], *needles: str) -> str | None:+ """The newest line that holds one of the needles (lower case compare)."""+ for line in reversed(lines):+ low = line.lower()+ if any(n in low for n in needles):+ return line+ return None+++def describe(step: int | None, lines: list[str], download: dict | None = None) -> Words:+ """The sentence for setup's step `step` (1 to 7; None when unknown) given the lines it printed since the step began and the+ download figure in them (`{"file": ..., "percent": ...}` or None)."""+ recent = _after_last_step(lines)+ dl_file = str((download or {}).get("file", "")).lower()+ if step is None:+ return Words("working", "Getting your model ready")+ if step <= 2:+ return Words("check", "Checking your computer")+ if step == 3:+ return Words("helpers", "Getting the helper packages ready")+ if step == 4:+ if "engine" in dl_file:+ return Words("engine", "Downloading the engine for this PC")+ if "source" in dl_file or "llama.cpp" in dl_file:+ return Words("helpers", "Downloading the small tools used to prepare models")+ return Words("engine", "Checking the engine for this PC")+ if step == 5:+ last = recent[-1] if recent else ""+ if dl_file.startswith("checking") or CHECKING_RE.search(last):+ return Words("verify", "Checking that the model files are complete (a few minutes for a big model; nothing is downloaded)")+ if "vision" in dl_file or "picture" in dl_file or "mmproj" in dl_file:+ return Words("pictures", "Downloading the picture reader")+ if download and not dl_file.startswith("checking"):+ return Words("download", "Downloading the model files")+ if _last_matching(recent, "already downloaded", "model files present"):+ return Words("verify", "The model files are on this computer; checking them")+ return Words("download", "Getting the model files")+ if step == 6:+ marker = _last_matching(recent, "mtp_rt.py", "mtp_pack.py", "mtp_fetch.py", "mtp draft layer:", "strata_pack.py", "pack_index.py",+ "strata_tokenizer.py", "iq_pack.py", "nvfp4_local_pack.py", "converting the q2_0 experts",+ "writing the experts into one file", "of mtp tensors", "[ok] model prepared")+ low = (marker or "").lower()+ if not marker and dl_file.startswith("mtp draft"):+ low = "mtp draft layer:"+ if "[ok] mtp draft layer" in low:+ return Words("draft", "Preparing the draft layer")+ if "mtp_fetch.py" in low or "mtp draft layer:" in low or "of mtp tensors" in low:+ return Words("draft_download", "Downloading the draft layer (about 5 GB; it makes answers about twice as fast)")+ if "mtp_rt.py" in low or "mtp_pack.py" in low or "[ok] model prepared" in low:+ return Words("draft", "Preparing the draft layer")+ if "strata_pack.py" in low or "converting the q2_0 experts" in low:+ return Words("pack", "Packing the model's experts for your processor (one time, a few minutes)")+ if "pack_index.py" in low:+ return Words("pack", "Indexing the packed experts")+ if "strata_tokenizer.py" in low:+ return Words("tokenizer", "Preparing the tokenizer")+ if "writing the experts into one file" in low or ("iq_pack.py" in low and "--experts-bin" in low):+ return Words("pack", "Packing the experts into one file for low-memory mode (one time)")+ if "iq_pack.py" in low:+ return Words("pack", "Preparing the model data for the engine (one time)")+ if "nvfp4_local_pack.py" in low:+ return Words("pack", "Converting NVIDIA's FP4 checkpoint on this PC (20 to 40 minutes, one time)")+ return Words("pack", "Preparing your model for Strata (one time)")+ return Words("settings", "Saving the model's settings")+++def with_numbers(words: Words, download: dict | None) -> str:+ """The sentence with the figure after it when there is one: `Downloading the model files: 12.3 of 66.4 GB`."""+ if not download:+ return words.label+ try:+ done, total = float(download["done_gb"]), float(download["total_gb"])+ except (KeyError, TypeError, ValueError):+ return words.label+ if total <= 0.05:+ return words.label+ return f"{words.label}: {done:.1f} of {total:.1f} GB"diff --git a/tests/terminal/test_progress_words.py b/tests/terminal/test_progress_words.pynew file mode 100644index 000000000..ea8efd705--- /dev/null+++ b/tests/terminal/test_progress_words.py@@ -0,0 +1,148 @@+"""0.2.2: the words for a model download and its preparation are plain and true (strata_control/progress_words.py), and the app's+and the Terminal's progress read the same lines the same way (tools/strata_mcp.py install_progress / combined_progress).++The excerpts are from real setup logs (Gyro-S on the RTX 5070 PC, 2026-10-19) and from the steps a Q2_0 install adds."""++from __future__ import annotations++import sys+import unittest+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+sys.path.insert(0, str(ROOT))+sys.path.insert(0, str(ROOT / "tools"))++import strata_mcp # noqa: E402+from strata_control import progress_words as W # noqa: E402++HEAD = ["Strata - Qwen3.8-Flash-Next on a normal PC", "=== Step 1: checking your PC ===", " [ok] GPU: NVIDIA GeForce RTX 5070",+ "=== Step 2: your choices ===", " [ok] size: Gyro-S", "=== Step 3: Python packages ===", " [ok] numpy ...",+ "=== Step 4: the Strata engine ==="]+STEP5 = ["=== Step 5: downloading Qwen3.8-Flash-Next (Gyro) Gyro-S ===",+ " The model files go in C:\\Users\\x\\Documents\\Strata\\models\\gyro-Gyro-S"]+MODEL_PROGRESS = " Qwen3.8-Flash-Next-Gyro-S-TQ1_0.gguf: 30.53 / 58.49 GB (52%) "+CHECK = " checking Qwen3.8-Flash-Next-Gyro-S-TQ1_0.gguf (SHA-256, 58.5 GB) ..."+STEP6 = ["=== Step 6: preparing the model for Strata ==="]+++def prog(lines):+ p = strata_mcp.install_progress(lines)+ return p, p.get("label"), p.get("phase")+++class StepWords(unittest.TestCase):+ def test_checking_the_pc(self):+ self.assertEqual(prog(HEAD[:3])[1:], ("Checking your computer", "check"))++ def test_the_engine_and_the_helper_download_have_their_own_words(self):+ self.assertEqual(prog(HEAD + [" llama.cpp source: 0.01 / 0.04 GB (21%) "])[2], "helpers")+ self.assertIn("small tools", prog(HEAD + [" llama.cpp source: 0.01 / 0.04 GB (21%) "])[1])+ self.assertEqual(prog(HEAD + [" Strata engine: 0.20 / 0.90 GB (22%) "])[1], "Downloading the engine for this PC")+ self.assertEqual(prog(HEAD)[2], "engine")++ def test_the_model_download(self):+ _p, label, phase = prog(HEAD + STEP5 + [MODEL_PROGRESS])+ self.assertEqual((label, phase), ("Downloading the model files", "download"))++ def test_a_figure_from_an_earlier_step_does_not_leak_into_the_next(self):+ """Step 4's 'llama.cpp source' line must not make step 5 'Downloading ...' before any model line is printed."""+ p, label, phase = prog(HEAD + [" llama.cpp source: 0.04 / 0.04 GB (100%) "] + STEP5)+ self.assertNotIn("download", p)+ self.assertEqual(phase, "download")+ self.assertEqual(label, "Getting the model files")++ def test_the_hash_check_is_checking_not_downloading(self):+ lines = HEAD + STEP5 + [MODEL_PROGRESS, " [ok] downloaded", CHECK]+ p, label, phase = prog(lines)+ self.assertEqual(phase, "verify")+ self.assertIn("Checking that the model files are complete", label)+ self.assertNotIn("Downloading", label)+ # with its own figure+ p, label, phase = prog(lines + [" checking Qwen3.8-Flash-Next-Gyro-S-TQ1_0.gguf: 12.00 / 58.49 GB (20%) "])+ self.assertEqual(phase, "verify")+ self.assertEqual(p["download"]["percent"], 20)++ def test_the_picture_reader(self):+ lines = HEAD + STEP5 + [" [ok] model files present", " vision encoder: 0.30 / 0.91 GB (33%) "]+ self.assertEqual(prog(lines)[1:], ("Downloading the picture reader", "pictures"))++ def test_files_already_there(self):+ lines = HEAD + STEP5 + [" [ok] Qwen3.8-Flash-Next-Q2_0-00001-of-00002.gguf already downloaded"]+ self.assertEqual(prog(lines)[2], "verify")++ def test_step_six_packing_the_experts(self):+ lines = HEAD + STEP5 + STEP6 + [" Converting the Q2_0 experts for the AVX-512 kernel (one time, ~40 GB written, 2-5 min) ...",+ " > python tools/strata_pack.py build --gguf x --out y --skip-hash --force"]+ self.assertEqual(prog(lines)[1:], ("Packing the model's experts for your processor (one time, a few minutes)", "pack"))+ self.assertEqual(prog(lines + [" > python tools/pack_index.py --pack y"])[1], "Indexing the packed experts")+ self.assertEqual(prog(lines + [" > python tools/strata_tokenizer.py --gguf x --out y"])[1], "Preparing the tokenizer")++ def test_step_six_the_draft_layer_download_then_its_preparation(self):+ fetch = [" [ok] model prepared: y", " The MTP draft layer (speculative decoding, ~2x faster output) comes from the original Qwen checkpoint:",+ " only its ~5 GB of MTP tensors are downloaded.", " > python tools/mtp_fetch.py fetch --out z",+ " MTP draft layer: 1.65 / 5.21 GB (31%)"]+ p, label, phase = prog(HEAD + STEP5 + STEP6 + fetch)+ self.assertEqual(phase, "draft_download")+ self.assertIn("Downloading the draft layer", label)+ # the download is over: the numbers it printed are stale, the next tool is running+ p, label, phase = prog(HEAD + STEP5 + STEP6 + fetch + [" MTP draft layer: 5.21 / 5.21 GB (100%)", " > python tools/mtp_pack.py --src z"])+ self.assertEqual((label, phase), ("Preparing the draft layer", "draft"))+ p, label, phase = prog(HEAD + STEP5 + STEP6 + fetch + [" > python tools/mtp_rt.py --gguf g --out rt"])+ self.assertEqual(phase, "draft")++ def test_step_six_with_everything_already_there(self):+ lines = HEAD + STEP5 + STEP6 + [" [ok] model prepared: y", " [ok] MTP draft layer: z"]+ self.assertEqual(prog(lines)[2], "draft")++ def test_low_memory_mode_packing(self):+ lines = HEAD + STEP5 + STEP6 + [" Writing the experts into one file for the low-memory mode (one time, 80 GB) ...",+ " > python tools/iq_pack.py --gguf x --out y --experts-bin"]+ self.assertEqual(prog(lines)[1], "Packing the experts into one file for low-memory mode (one time)")++ def test_the_last_step(self):+ lines = HEAD + STEP5 + STEP6 + ["=== Step 7: writing the start script ===", " [ok] KV streaming on"]+ self.assertEqual(prog(lines)[1:], ("Saving the model's settings", "settings"))++ def test_the_heading_is_found_even_after_hundreds_of_tool_lines(self):+ lines = HEAD + STEP5 + STEP6 + [" > python tools/iq_pack.py --gguf x --out y"] + [f" layer {i}/40" for i in range(900)]+ self.assertEqual(prog(lines)[2], "pack")++ def test_no_step_yet(self):+ self.assertEqual(prog(["Strata - Qwen3.8-Flash-Next"])[1:], ("Getting your model ready", "working"))++ def test_with_numbers(self):+ w = W.describe(5, STEP5, {"file": "x.gguf", "done_gb": 12.34, "total_gb": 58.49, "percent": 21})+ self.assertEqual(W.with_numbers(w, {"done_gb": 12.34, "total_gb": 58.49}), "Downloading the model files: 12.3 of 58.5 GB")+ self.assertEqual(W.with_numbers(w, None), "Downloading the model files")+++class CombinedFigure(unittest.TestCase):+ def test_a_part_file_the_pieces_filled_ahead_is_not_a_finished_download(self):+ """The parallel download writes the last pieces early, so the .part is full length while the pieces done are 50%: the log's+ figure is the truth (the bar used to jump to 99%)."""+ import tempfile+ with tempfile.TemporaryDirectory() as tmp:+ folder = Path(tmp)+ part = folder / "m-00001-of-00002.gguf.part"+ part.write_bytes(b"\0" * 1000)+ files = [{"path": str(folder / "m-00001-of-00002.gguf"), "bytes": 1_000_000_000, "role": "model"}]+ prog_ = {"step": "5/7: downloading X", "download": {"file": "m-00001-of-00002.gguf", "done_gb": 0.5, "total_gb": 1.0, "percent": 50}}+ # the .part says 1000 bytes here; make it say 1 GB without writing it+ import os+ with open(part, "r+b") as f:+ f.truncate(1_000_000_000)+ out = strata_mcp.files_progress(prog_, {"total_gb": 1.0}, files)+ self.assertAlmostEqual(out["download"]["done_gb"], 0.5, places=2)+ self.assertEqual(out["download"]["percent"], 50)++ def test_the_hash_check_has_its_own_figure(self):+ lines = HEAD + STEP5 + [CHECK, " checking Qwen3.8-Flash-Next-Gyro-S-TQ1_0.gguf: 12.00 / 58.49 GB (20%) "]+ p = strata_mcp.install_progress(lines)+ out = strata_mcp.combined_progress(p, {"folder": None, "total_gb": 58.5})+ self.assertEqual(out["download"]["file"], "checking files")+ self.assertEqual(out["download"]["percent"], 20)+++if __name__ == "__main__":+ unittest.main()diff --git a/tests/terminal/test_terminal_polish.py b/tests/terminal/test_terminal_polish.pyindex 6ff558a92..fe99d9539 100644--- a/tests/terminal/test_terminal_polish.py+++ b/tests/terminal/test_terminal_polish.py@@ -14,11 +14,12 @@ from strata_cli.launch.runner import download_textclass AlreadyDownloaded(unittest.TestCase):def test_a_model_on_disk_is_not_called_a_download(self):dl = {"done_gb": 58.5, "total_gb": 58.5, "percent": 100.0}- self.assertEqual(download_text(dl, True), "Model already downloaded (58.5 GB), checking the files")+ self.assertEqual(download_text(dl, True), "The model files are already on this computer (58.5 GB); checking them")def test_a_real_download_keeps_its_numbers(self):dl = {"done_gb": 12.0, "total_gb": 58.5, "percent": 20.5}self.assertEqual(download_text(dl, False), "Downloading 12.0 of 58.5 GB")+ self.assertEqual(download_text(dl, False, "Downloading the draft layer"), "Downloading the draft layer: 12.0 of 58.5 GB")class MonitorFindsLaunch(unittest.TestCase):diff --git a/tools/strata_mcp.py b/tools/strata_mcp.pyindex 3ccfe1e2f..c863e3b41 100644--- a/tools/strata_mcp.py+++ b/tools/strata_mcp.py@@ -1319,7 +1319,7 @@ class Strata:res = self.state("install-result")running = proc_alive(j.get("pid"), j.get("ident"))log_path = Path(j.get("log", ""))- tail = read_tail(log_path, 400) if log_path.name else []+ tail = read_tail(log_path, 1500) if log_path.name else [] # a step's heading must stay inside it: the pack tools print hundreds of linesprog = install_progress(tail)prog = combined_progress(prog, j)out = {"running": running, "started": j.get("started"), "model": j.get("model"), "family": j.get("family"),@@ -1406,8 +1406,12 @@ def files_progress(prog: dict, job: dict, files: list) -> dict:except OSError:state, have = "waiting", 0total = f.get("bytes") or (have if state == "done" else 0)- if state == "downloading" and not total and cur_gb and p.name in str(log.get("file", "")): # the log line names this file- total = int(cur_gb * 1e9)+ if state == "downloading" and cur_gb and p.name in str(log.get("file", "")): # the log line names this file+ # The .part file is as long as the furthest byte written, which the parallel pieces push to the full size well before the+ # download is done: the pieces setup counts are the truth.+ have = min(have, int(float(log.get("done_gb") or 0) * 1e9)) if have else have+ if not total:+ total = int(cur_gb * 1e9)rows.append({"role": f.get("role", "model"), "state": state, "have": have, "total": max(total, have)})plan_total = float(job.get("total_gb") or 0) * 1e9parts = []@@ -1443,12 +1447,12 @@ def draft_progress(prog: dict, job: dict, dl: dict) -> dict:if job.get("files"):base = files_progress({}, job, job["files"])parts = [dict(p, state="done", done_gb=p["total_gb"]) for p in base.get("parts", []) if p.get("state") == "done"]- parts.append({"kind": "draft", "name": "Speed-up layer", "state": "done" if int(dl.get("percent") or 0) >= 100 else "downloading",+ parts.append({"kind": "draft", "name": "Draft layer", "state": "done" if int(dl.get("percent") or 0) >= 100 else "downloading","done_gb": round(done_gb, 3), "total_gb": round(total_gb, 3)})total = sum(p["total_gb"] for p in parts)done = min(sum(p["done_gb"] for p in parts), total)prog["parts"] = parts- prog["download"] = {"file": "Speed-up layer", "done_gb": round(done, 3), "total_gb": round(total, 3),+ prog["download"] = {"file": "Draft layer", "done_gb": round(done, 3), "total_gb": round(total, 3),"remaining_gb": round(max(0.0, total - done), 3),"percent": min(99, int(100 * done / total)) if total else 0}return prog@@ -1463,6 +1467,13 @@ def combined_progress(prog: dict, job: dict) -> dict:dl = prog.get("download") or {}if step.startswith("6/") and str(dl.get("file", "")).startswith("MTP draft layer"):return draft_progress(prog, job, dl)+ if step.startswith("5/") and str(dl.get("file", "")).startswith("checking "):+ # setup is hashing files that are all on disk: the figure is the check's own (not a download at "99%")+ if job.get("files"):+ prog = files_progress(prog, job, job["files"])+ prog["download"] = {"file": "checking files", "done_gb": dl["done_gb"], "total_gb": dl["total_gb"],+ "remaining_gb": round(max(0.0, dl["total_gb"] - dl["done_gb"]), 3), "percent": int(dl["percent"])}+ return progif job.get("files") and step.startswith("5/"): # the install knows its files: count each of themreturn files_progress(prog, job, job["files"])if not folder or not total or not step.startswith("5/"):@@ -1494,7 +1505,7 @@ def install_progress(lines: list[str]) -> dict:for i, line in enumerate(lines):m = re.search(r"=== Step (\d+): (.+?) ===", line)if m:- step, title, err = int(m.group(1)), m.group(2), None+ step, title, err, dl = int(m.group(1)), m.group(2), None, None # a download figure belongs to its own stepm = re.match(r"\s*(\S.*?): +([\d.]+) / ([\d.]+) GB \((\d+)%\)", line)if m:dl = {"file": m.group(1), "done_gb": float(m.group(2)), "total_gb": float(m.group(3)),@@ -1508,6 +1519,9 @@ def install_progress(lines: list[str]) -> dict:out["download"] = dlif err:out["error"] = err+ words = progress_words_for(step, lines, dl)+ if words:+ out["label"], out["phase"] = wordsreturn out@@ -1524,6 +1538,17 @@ def physical_cores() -> int | None:return os.cpu_count()+def progress_words_for(step, lines, download):+ """(the plain sentence, its phase) for what setup is doing now (strata_control/progress_words.py, the words the Terminal uses too);+ None when this Strata folder does not carry the module."""+ try:+ from strata_control import progress_words+ except ImportError:+ return None+ w = progress_words.describe(step, lines, download)+ return w.label, w.phase++def own_ram_gb() -> float:if WIN:class MS(ctypes.Structure):diff --git a/tools/test_setup_ownfiles.py b/tools/test_setup_ownfiles.pyindex 363bf822d..9d799d506 100644--- a/tools/test_setup_ownfiles.py+++ b/tools/test_setup_ownfiles.py@@ -64,5 +64,30 @@ class OwnFileChecks(unittest.TestCase):self.assertEqual(code, 0)+class CheckingShowsItsProgress(unittest.TestCase):+ def test_a_big_file_is_hashed_with_a_progress_line_of_its_own(self):+ """Hashing a 60 GB shard takes minutes: the app and the Terminal show it as 'checking', with a figure (not a download stuck at 99%)."""+ with tempfile.TemporaryDirectory() as tmp:+ f = Path(tmp) / "big-00001-of-00002.gguf"+ size = (1 << 30) + 4096+ with open(f, "wb") as g:+ g.truncate(size)+ sha = hashlib.sha256()+ with open(f, "rb") as g:+ for block in iter(lambda: g.read(16 << 20), b""):+ sha.update(block)+ import time+ original = time.time+ ticks = iter(range(0, 10_000, 3))+ setup.time.time = lambda: float(next(ticks)) # every read looks 3 s later: the progress line prints+ try:+ code, text = run(setup.verify_sha256, f, size, sha.hexdigest())+ finally:+ setup.time.time = original+ self.assertEqual(code, 0)+ self.assertIn("checking big-00001-of-00002.gguf (SHA-256", text)+ self.assertRegex(text, r"checking big-00001-of-00002\.gguf: +\d+\.\d\d / 1\.07 GB \(\d+%\)")++if __name__ == "__main__":unittest.main()diff --git a/tools/test_strata_mcp.py b/tools/test_strata_mcp.pyindex 8f0c15408..8bc0acd7f 100644--- a/tools/test_strata_mcp.py+++ b/tools/test_strata_mcp.py@@ -944,7 +944,7 @@ class DraftLayerAndCancel(unittest.TestCase):shard.write_bytes(b"x" * 20_000_000)job = {"files": [{"path": str(shard), "bytes": None, "role": "model"}], "total_gb": 60}prog = M.combined_progress(M.install_progress(lines), job)- self.assertEqual(prog["download"]["file"], "Speed-up layer")+ self.assertEqual(prog["download"]["file"], "Draft layer")self.assertEqual([p["kind"] for p in prog["parts"]], ["model", "draft"])self.assertEqual(prog["parts"][0]["state"], "done")self.assertAlmostEqual(prog["parts"][1]["done_gb"], 2.0)