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: a volume of the older image is moved into place (no new download), run settings of another image's engine folder are made again

Niko122180f7679b615c
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 3d7341b65..13d652b22 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -69,6 +69,57 @@ for legacy in HOST LOW_RAM REINSTALL RESIDENT_BUDGET_GIB KV_STREAMING LAYER_SPLI
[ -n "$v" ] && warn "$legacy is from the older image and is ignored here. See docs/DOCKER.md (\"From the older image\")."
done
+# ---- a volume from the older (0.1.x) image: its models, packs and draft layer are in /data/models, /data/packs and /data/mtp.
+# This image keeps them in /data/Strata-data. Move them over (a rename inside one volume: instant, no copy, no download).
+# A folder that is its own mount (a bind mount of yours) is never touched.
+legacy_moved=""
+for d in models packs mtp; do
+ [ -d "/data/$d" ] || continue
+ grep -q " /data/$d " /proc/self/mountinfo 2>/dev/null && continue
+ [ -n "$(ls -A "/data/$d" 2>/dev/null)" ] || continue
+ mkdir -p "/data/Strata-data/$d" 2>/dev/null || continue
+ for item in "/data/$d"/* "/data/$d"/.[!.]*; do
+ [ -e "$item" ] || continue
+ name=${item##*/}
+ [ -e "/data/Strata-data/$d/$name" ] && continue
+ if mv "$item" "/data/Strata-data/$d/$name" 2>/dev/null; then legacy_moved="$legacy_moved $d/$name"
+ else warn "Could not move $item into /data/Strata-data/$d (the model is downloaded again unless you set MODEL_PATH=/data/$d/...)."; fi
+ done
+ rmdir "/data/$d" 2>/dev/null || true
+done
+[ -n "$legacy_moved" ] && say "Found model files from the older image in the volume and moved them into /data/Strata-data (no copy, nothing is downloaded again):$legacy_moved"
+
+# ---- run settings made by an image for another card or another engine version name that image's engine folder
+# (/opt/strata/components/engine/<package>/...): in this image that folder is not there, so the server would stop at the start. Drop
+# them; the next step writes them again from the model files, which are kept.
+for c in /data/install/strata-*.json; do
+ [ -f "$c" ] || continue
+ gone=$("$PYBIN" -c '
+import json, os, sys
+def walk(v):
+ if isinstance(v, str):
+ yield v
+ elif isinstance(v, dict):
+ for x in v.values():
+ yield from walk(x)
+ elif isinstance(v, list):
+ for x in v:
+ yield from walk(x)
+try:
+ cfg = json.load(open(sys.argv[1], encoding="utf-8-sig"))
+except (OSError, ValueError):
+ sys.exit(0)
+for s in walk(cfg):
+ if s.startswith("/opt/strata/components/") and not os.path.exists(s):
+ print(s)
+ break
+' "$c" 2>/dev/null)
+ if [ -n "$gone" ]; then
+ say "The saved run settings $(basename "$c") name $gone, which this image does not have (made by an image for another card or engine version): making them again. The model files are kept."
+ rm -f "$c"
+ fi
+done
+
# ---- is there an engine for this card?
phase checking
engine_json=$("$STRATA" components engine --output json 2>/dev/null || true)
@@ -87,9 +138,10 @@ fi
# the card is found through sysfs even when no device file was passed in: say so now instead of failing when the engine starts
backend=$(printf '%s' "$engine_json" | sed -n 's/.*"backend": *"\([a-z0-9]*\)".*/\1/p' | head -1)
+dev="${STRATA_DEV_DIR:-/dev}"
case "$backend" in
- hip) [ -e /dev/kfd ] || { echo "[X] This is an AMD card, but /dev/kfd is not in the container. Add: --device /dev/kfd --device /dev/dri --group-add video --group-add <render group number> (docs/DOCKER.md)" >&2; exit 3; } ;;
- sycl) ls /dev/dri/renderD* >/dev/null 2>&1 || { echo "[X] This is an Intel card, but /dev/dri is not in the container. Add: --device /dev/dri --group-add <render group number> (docs/DOCKER.md)" >&2; exit 3; } ;;
+ hip) [ -e "$dev/kfd" ] || { echo "[X] This is an AMD card, but /dev/kfd is not in the container. Add: --device /dev/kfd --device /dev/dri --group-add video --group-add <render group number> (docs/DOCKER.md)" >&2; exit 3; } ;;
+ sycl) ls "$dev"/dri/renderD* >/dev/null 2>&1 || { echo "[X] This is an Intel card, but /dev/dri is not in the container. Add: --device /dev/dri --group-add <render group number> (docs/DOCKER.md)" >&2; exit 3; } ;;
esac
# ---- the API key
diff --git a/docs/DOCKER.md b/docs/DOCKER.md
index c87dafe7c..24682d925 100644
--- a/docs/DOCKER.md
+++ b/docs/DOCKER.md
@@ -257,8 +257,10 @@ package and start through `strata launch`. Mapping:
| `HOST` | not needed: the server listens on every address inside the container; choose where it is reachable with `-p` |
| `LOW_RAM`, `RESIDENT_BUDGET_GIB`, `KV_STREAMING`, `LAYER_SPLIT`, `CONFIG`, `REINSTALL` | ignored with a warning; use `STRATA_SET` for engine settings and `strata launch --help` for the rest |
-The old volume layout (`/data/config`, `/data/models`) is not read; the model files are found again if you point `MODEL_PATH` at
-the old model folder. The container name, the volume and the port can stay as they were.
+A volume from the older image is picked up: the first start moves `/data/models`, `/data/packs` and `/data/mtp` into
+`/data/Strata-data` (a rename inside the volume: nothing is copied or downloaded again, and the prepared pack is kept). The old
+`/data/config` is not read; the run settings are made again from the files. A folder you mounted yourself at one of those places
+is left alone: point `MODEL_PATH` at it. The container name, the volume and the port can stay as they were.
## Build it yourself
diff --git a/tools/test_docker_entrypoint.py b/tools/test_docker_entrypoint.py
index cb76c85dd..0a4f2eeb3 100644
--- a/tools/test_docker_entrypoint.py
+++ b/tools/test_docker_entrypoint.py
@@ -23,7 +23,7 @@ STUB = r"""#!/bin/sh
# records every call; answers the few read-only queries the entrypoint makes
echo "$*" >> "$STUB_LOG"
case "$1 $2" in
- "components engine") if [ "${STUB_ENGINE:-ok}" = ok ]; then echo '{"usable": true}'; else echo '{"usable": false}'; echo "no engine for this card" >&2; fi; exit 0 ;;
+ "components engine") if [ "${STUB_ENGINE:-ok}" = ok ]; then echo "{\"usable\": true, \"backend\": \"${STUB_BACKEND:-}\"}"; else echo '{"usable": false}'; echo "no engine for this card" >&2; fi; exit 0 ;;
esac
case "$*" in
*"--list-presets --output json"*) if [ -n "${STUB_PRESET:-}" ]; then echo '{"presets": [{"name": "docker"}]}'; fi; exit 0 ;;
@@ -166,6 +166,63 @@ class Entrypoint(unittest.TestCase):
self.stop(p)
self.assertTrue((install / "strata-q2_0.json").exists())
+ def test_a_volume_of_the_older_image_is_moved_not_downloaded_again(self):
+ data = self.tmp / "data"
+ (data / "models" / "Qwen3.8-Flash-Next-IQ3_XXS").mkdir(parents=True)
+ shard = data / "models" / "Qwen3.8-Flash-Next-IQ3_XXS" / "a-00001-of-00002.gguf"
+ shard.write_text("weights")
+ (data / "models" / "Qwen3.8-Flash-Next-IQ3_XXS" / "a-00001-of-00002.gguf.done").write_text("x")
+ (data / "packs" / "qwen3.8-flash-next-iq3_xxs").mkdir(parents=True)
+ (data / "packs" / "qwen3.8-flash-next-iq3_xxs" / "experts.bin").write_text("pack")
+ (data / "mtp" / "rt").mkdir(parents=True)
+ (data / "mtp" / "rt" / "experts.bin").write_text("mtp")
+ ino = shard.stat().st_ino
+ p = self.start(MODEL="IQ3_XXS")
+ self.wait_for("--show-key")
+ code, out, err = self.stop(p)
+ new = data / "Strata-data"
+ moved = new / "models" / "Qwen3.8-Flash-Next-IQ3_XXS" / "a-00001-of-00002.gguf"
+ self.assertEqual(moved.read_text(), "weights")
+ self.assertEqual(moved.stat().st_ino, ino) # renamed, not copied
+ self.assertTrue((moved.parent / "a-00001-of-00002.gguf.done").exists())
+ self.assertTrue((new / "packs" / "qwen3.8-flash-next-iq3_xxs" / "experts.bin").exists())
+ self.assertTrue((new / "mtp" / "rt" / "experts.bin").exists())
+ self.assertFalse((data / "models").exists())
+ self.assertIn("moved them into", out)
+
+ def test_a_file_already_in_the_new_place_is_never_overwritten(self):
+ data = self.tmp / "data"
+ (data / "models" / "t").mkdir(parents=True)
+ (data / "models" / "t" / "f.gguf").write_text("old")
+ (data / "Strata-data" / "models" / "t").mkdir(parents=True)
+ (data / "Strata-data" / "models" / "t" / "f.gguf").write_text("new")
+ p = self.start(MODEL="IQ3_XXS")
+ self.wait_for("--show-key")
+ self.stop(p)
+ self.assertEqual((data / "Strata-data" / "models" / "t" / "f.gguf").read_text(), "new") # never overwritten
+ self.assertEqual((data / "models" / "t" / "f.gguf").read_text(), "old")
+
+ def test_run_settings_that_name_another_images_engine_folder_are_made_again(self):
+ install = self.tmp / "data" / "install"
+ install.mkdir(parents=True)
+ here = self.tmp / "opt" / "components" / "engine" / "0.1.46-cuda12"
+ here.mkdir(parents=True)
+ (here / "strata-vision").write_text("x")
+ gone = self.tmp / "opt" / "components" / "engine" / "0.1.46-cuda13"
+ (install / "strata-a.json").write_text('{"exe": "component:strata-engine", "vision": {"exe": "%s/strata-vision"}}' % gone)
+ (install / "strata-b.json").write_text('{"exe": "component:strata-engine", "vision": {"exe": "%s/strata-vision"}}' % here)
+ (install / "strata-c.json").write_text('{"exe": "component:strata-engine", "args": []}')
+ (install / "strata-bad.json").write_text("not json")
+ p = self.start(MODEL="IQ3_XXS")
+ self.wait_for("--show-key")
+ code, out, err = self.stop(p)
+ self.assertFalse((install / "strata-a.json").exists())
+ self.assertTrue((install / "strata-b.json").exists())
+ self.assertTrue((install / "strata-c.json").exists())
+ self.assertTrue((install / "strata-bad.json").exists())
+ self.assertIn("strata-a.json", out)
+ self.assertIn("does not have", out)
+
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)