Skip to content

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++

Docker: MODEL_PATH that is not mounted, or holds no GGUF files, ends the start in plain words before any setup work

Niko122148c34f735ad8
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index edcfeff96..79fca4a13 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -161,6 +161,18 @@ preset_exists=""
if "$STRATA" launch --list-presets --output json 2>/dev/null | grep -q "\"name\": *\"$PRESET\""; then preset_exists=1; fi
model_path="${MODEL_PATH:-${GGUF_DIR:-}}"
+if [ -n "$model_path" ]; then
+ # a folder that is not mounted (or a typo) must not end as "missing /xxx.gguf" after a minute of setup, and must never turn into a download
+ if [ ! -e "$model_path" ]; then
+ die "MODEL_PATH=$model_path is not in the container, so no model file can be found there. Mount your folder at that place, for example: -v /srv/gguf/IQ3_XXS:$model_path:ro (docs/DOCKER.md, \"Files you already have\"). Nothing was downloaded." 2
+ elif [ -d "$model_path" ] && ! ls "$model_path"/*.gguf >/dev/null 2>&1; then
+ sub=$(find "$model_path" -maxdepth 2 -name '*.gguf' 2>/dev/null | head -1)
+ if [ -n "$sub" ]; then
+ die "MODEL_PATH=$model_path has no .gguf files directly in it, but there are some in ${sub%/*}. Set MODEL_PATH=${sub%/*} (the folder that holds the shards of one model). Nothing was downloaded." 2
+ fi
+ die "MODEL_PATH=$model_path holds no .gguf files. Mount the folder with the model's shards (the -0000N-of-0000M.gguf files). Nothing was downloaded." 2
+ fi
+fi
[ -n "${MODEL:-}" ] && { set -- "$@" --model "$MODEL"; have=1; }
[ -n "${FAMILY:-}" ] && { set -- "$@" --family "$FAMILY"; have=1; }
[ -n "$model_path" ] && { set -- "$@" --model-path "$model_path"; have=1; }
diff --git a/tools/test_docker_entrypoint.py b/tools/test_docker_entrypoint.py
index 8ac8c4b1f..7cfb5f531 100644
--- a/tools/test_docker_entrypoint.py
+++ b/tools/test_docker_entrypoint.py
@@ -79,11 +79,13 @@ class Entrypoint(unittest.TestCase):
return next(line for line in log.splitlines() if line.startswith("launch --no-tui"))
def test_settings_become_flags_and_sigterm_stops_cleanly(self):
+ (self.tmp / "models").mkdir()
+ (self.tmp / "models" / "m-00001-of-00002.gguf").write_text("x")
p = self.start(MODEL="IQ3_XXS", CONTEXT="64k", PARALLEL="2", VISION="yes", TUNE="quick", GPUS="0,1", PORT="8123", PRESET="office",
- API_KEY="a-long-enough-key-123456", MODEL_PATH="/models", STRATA_SET="prefill=65536 STRATA_PIN_BY_NEED=1")
+ API_KEY="a-long-enough-key-123456", MODEL_PATH=str(self.tmp / "models"), STRATA_SET="prefill=65536 STRATA_PIN_BY_NEED=1")
log = self.wait_for("--show-key")
line = self.launch_line(log)
- for want in ("--access lan", "--port 8123", "--model IQ3_XXS", "--model-path /models", "--context 64k", "--parallel 2",
+ for want in ("--access lan", "--port 8123", "--model IQ3_XXS", "--model-path " + str(self.tmp / "models"), "--context 64k", "--parallel 2",
"--vision on", "--gpu 0,1", "--tune quick", "--set prefill=65536", "--set STRATA_PIN_BY_NEED=1",
"--save-preset office", "--api-key-env STRATA_LAUNCH_KEY"):
self.assertIn(want, line)
@@ -236,6 +238,23 @@ class Entrypoint(unittest.TestCase):
self.wait_for("launch --no-tui")
self.stop(p)
+ def test_model_path_that_is_not_there_or_empty_ends_the_start_in_plain_words(self):
+ missing = self.tmp / "nothing-mounted"
+ r = subprocess.run([SH, str(self.script)], env=self.env(MODEL="IQ3_XXS", MODEL_PATH=str(missing)), capture_output=True, text=True, timeout=30)
+ self.assertEqual(r.returncode, 2)
+ self.assertIn("is not in the container", r.stderr)
+ self.assertIn("-v /srv/gguf/IQ3_XXS:", r.stderr)
+ empty = self.tmp / "empty"
+ (empty / "IQ3_XXS").mkdir(parents=True)
+ r = subprocess.run([SH, str(self.script)], env=self.env(MODEL="IQ3_XXS", MODEL_PATH=str(empty)), capture_output=True, text=True, timeout=30)
+ self.assertEqual(r.returncode, 2)
+ self.assertIn("holds no .gguf files", r.stderr)
+ (empty / "IQ3_XXS" / "a-00001-of-00002.gguf").write_text("x")
+ r = subprocess.run([SH, str(self.script)], env=self.env(MODEL="IQ3_XXS", MODEL_PATH=str(empty)), capture_output=True, text=True, timeout=30)
+ self.assertEqual(r.returncode, 2)
+ self.assertIn("Set MODEL_PATH=" + str(empty / "IQ3_XXS"), r.stderr)
+ self.assertNotIn("launch --no-tui", self.log.read_text() if self.log.exists() else "")
+
def test_other_commands_run_instead_of_the_server(self):
r = subprocess.run([SH, str(self.script), "strata", "launch", "--plan", "--model", "q2_0"], env=self.env(), capture_output=True,
text=True, timeout=30)