From fa56c2b3878ef405e17c31cbf0bd04ae3664778e Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 20 Oct 2026 14:40:43 +0200 Subject: [PATCH] Start: a picture reader path from an older engine folder follows the installed package (engine update or other image no longer ends in server_exited) --- docs/DOCKER.md | 11 +++++++++++ serve/server.py | 21 +++++++++++++++++++++ tests/terminal/test_component_start.py | 17 +++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/docs/DOCKER.md b/docs/DOCKER.md index dc8ce616..fc89ef33 100644 --- a/docs/DOCKER.md +++ b/docs/DOCKER.md @@ -142,6 +142,17 @@ container's user). Nothing large is written anywhere else in the container. Mount the folder with the model's GGUF files read-only and name it: `-v /srv/gguf/IQ3_XXS:/models:ro -e MODEL_PATH=/models -e MODEL=IQ3_XXS`. Nothing is downloaded for the model itself; the prepared pack is made in the volume. +- The folder holds the shards of one model directly (`...-00001-of-00002.gguf`, `...-00002-of-00002.gguf`), not a folder of folders. + If you mount a parent folder, the container says which sub-folder to name in `MODEL_PATH`. +- The folder has to be mounted: a `MODEL_PATH` that is not in the container, or a folder with no `.gguf` files, stops the start at + once with a message, and nothing is downloaded. +- Read-only (`:ro`) is fine. The pack (about 40 GB for IQ3_XXS) and the draft layer (about 6 GB, fetched once) are written to the + volume, so it needs that room. +- Links to the files work when the links' targets are mounted too, and `MODEL` is set (without `MODEL`, Strata identifies the files itself + and does not follow links). +- Without `MODEL_PATH`, files you put into the volume by hand (`/data/Strata-data/models//`) are found as well, if they have the + published names. + ## The API key The server listens on every address **inside** the container (that is what lets the published port work), and Strata does not diff --git a/serve/server.py b/serve/server.py index aca6c5a7..126c171a 100644 --- a/serve/server.py +++ b/serve/server.py @@ -7648,6 +7648,26 @@ def default_model_name(cfg: dict) -> str: return cfg.get("model_name") or FAMILY_MODEL_NAMES.get(cfg.get("arch") or "qwen4exp", "qwen3.8-flash-next") +def with_current_reader(cfg: dict, package: Path) -> dict: + """The picture reader (vision "exe", "cpu_exe") is written into the run config as an absolute path inside the engine package's folder, + and that folder is named after the engine version: after an engine update, or in a container made for another card, the path is gone + and the server would stop with "server_exited". Use the same file of the package that is installed now (the reader ships in the package).""" + vision = cfg.get("vision") + if not isinstance(vision, dict): + return cfg + fixed = dict(vision) + for key in ("exe", "cpu_exe"): + old = fixed.get(key) + if isinstance(old, str) and old and not engine_component.is_reference(old) and os.path.isabs(old) and not os.path.exists(old): + new = package / old.replace("\\", "/").rsplit("/", 1)[-1] + if new.is_file(): + print(f"[strata] the picture reader {old} is not there any more; using {new} from the engine package in use", flush=True) + fixed[key] = str(new) + if fixed == vision: + return cfg + return {**cfg, "vision": fixed} + + def with_component_engine(cfg: dict) -> dict: """A run config that names "component:strata-engine" gets the engine package for this PC: the path in `exe`, and the package's own folder first on the library path (the GPU runtime libraries ship beside the binary).""" @@ -7656,6 +7676,7 @@ def with_component_engine(cfg: dict) -> dict: cfg = dict(cfg) cfg["exe"] = _component_exe(cfg["exe"], cfg) cfg["lib_dirs"] = [*engine_component.package_lib_dirs(Path(cfg["exe"]).parent), *(cfg.get("lib_dirs") or [])] + cfg = with_current_reader(cfg, Path(cfg["exe"]).parent) if cfg.get("backend") == "hip": # AMD: the package's own hipBLASLt tuning table for this card, when its hipBLASLt version matches cfg = hipblaslt_tuning.apply(cfg, Path(cfg["exe"]).parent, say=lambda line: print(line, flush=True)) return cfg diff --git a/tests/terminal/test_component_start.py b/tests/terminal/test_component_start.py index dbab849f..e9d95f99 100644 --- a/tests/terminal/test_component_start.py +++ b/tests/terminal/test_component_start.py @@ -202,6 +202,23 @@ class ComponentStart(unittest.TestCase): server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda"}) self.assertEqual(caught.exception.code, 5) + def test_a_picture_reader_path_from_an_older_engine_folder_follows_the_installed_package(self): + """After an engine update the folder name changes; the run config's absolute vision exe must not stop the server.""" + from serve import server + folder = install_fake_engine(self.components) + reader = folder / "strata-vision" + reader.write_text("x", encoding="utf-8") + gone = str(self.components / "engine" / "0.0.1-old" / "strata-vision") + cfg = server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda", + "vision": {"exe": gone, "cpu_exe": gone, "mmproj": "/m.gguf"}}) + self.assertEqual(cfg["vision"]["exe"], str(reader)) + self.assertEqual(cfg["vision"]["cpu_exe"], str(reader)) + self.assertEqual(cfg["vision"]["mmproj"], "/m.gguf") + ok = {"exe": "component:strata-engine", "backend": "cuda", "vision": {"exe": str(reader)}} + self.assertEqual(server.with_component_engine(ok)["vision"], {"exe": str(reader)}) + none = server.with_component_engine({"exe": "component:strata-engine", "backend": "cuda", "vision": {"exe": gone.replace("strata-vision", "other")}}) + self.assertTrue(none["vision"]["exe"].endswith("other")) # no such file in the package: left as it is + def test_the_build_json_lib_dirs_follow_the_package_folder(self): """The Windows HIP package keeps the ROCm DLLs in rocm/bin (BUILD.json lib_dirs): strata.exe does not load without them on PATH.""" from serve import server