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

setup: a start prints the settings it uses (#564)

Niko12216e205094775f
diff --git a/setup.py b/setup.py
index f1495bf4f..55a48cfbc 100644
--- a/setup.py
+++ b/setup.py
@@ -50,6 +50,7 @@ import shutil
import struct
import subprocess
import sys
+import textwrap
import time
import urllib.error
import urllib.request
@@ -2585,6 +2586,29 @@ def update_install(have: list, a) -> int:
return 0
+def settings_summary(cfg: dict, port=None) -> str:
+ """#564: the settings a start uses, in one line: the config's engine options (the model's file paths left out)
+ and the server's own fields, so a change made by hand to strata-<model>.json can be checked without the log."""
+ a, out, i = [str(x) for x in cfg.get("args") or []], [], 0
+ while i < len(a):
+ flag = a[i]
+ val = a[i + 1] if i + 1 < len(a) and not a[i + 1].startswith("--") else None
+ i += 1 if val is None else 2
+ if not flag.startswith("--"):
+ continue # a positional: the model file
+ if val is not None and ("/" in val or "\\" in val or val.lower().endswith((".gguf", ".bin"))):
+ continue # a path: --native, --mtp, --profile ...
+ out.append(flag if val is None else f"{flag} {val}")
+ srv = [f"{cfg.get('host', '127.0.0.1')}:{port or cfg.get('port', 8080)}"]
+ if cfg.get("api_key"):
+ srv.append("api key set")
+ for k in ("gpu", "layer_split", "draft_vocab", "fit_max_tokens", "reasoning_budget_tokens", "anthropic_thinking"):
+ if cfg.get(k) is not None:
+ v = cfg[k]
+ srv.append(f"{k} {','.join(map(str, v)) if isinstance(v, list) else str(v).lower() if isinstance(v, bool) else v}")
+ return " ".join(out) + ("; " if out else "") + "server " + ", ".join(srv)
+
+
def start(cfg_path: Path, port: int | None, gpu: int | list | None = None, open_browser=True, yes=False,
layer_split=None, keep=None) -> int:
"""keep: settings given on this start that the model keeps from now on (--host, --api-key, --draft-vocab,
@@ -2698,6 +2722,9 @@ def start(cfg_path: Path, port: int | None, gpu: int | list | None = None, open_
say(" restart). That is normal: please wait and don't close this window - the browser opens when it is ready.")
say(" Later, closing this window stops the model.")
say(" " + "-" * 100)
+ for n, line in enumerate(textwrap.wrap(f"Settings ({cfg_path.name}): {settings_summary(cfg, port)}", 100,
+ break_on_hyphens=False)): # #564: what this start uses
+ say((" " if n == 0 else " ") + line)
if not WIN and os.environ.get("STRATA_EXECV"):
# Replace this process instead of spawning a child. The Docker image sets STRATA_EXECV=1,
# so there the server is PID 1 and docker stop's SIGTERM reaches the process that can
diff --git a/tools/test_setup_update.py b/tools/test_setup_update.py
index d1908d458..12b1026e2 100644
--- a/tools/test_setup_update.py
+++ b/tools/test_setup_update.py
@@ -106,5 +106,40 @@ class Update(unittest.TestCase):
start.assert_not_called()
+class SettingsLine(unittest.TestCase):
+ """#564: a start prints the settings it uses (the engine options without the model's paths, and the server's
+ fields), so a change made by hand to strata-<model>.json shows without reading the log."""
+
+ CFG = {"exe": "x", "host": "0.0.0.0", "port": 8081, "api_key": "secret", "gpu": [0, 1], "fit_max_tokens": True,
+ "args": ["--native", "E:\\Strata\\packs\\iq3_s", "--mtp", "/s/mtp/rt", "m.gguf", "--kv", "int8",
+ "--kv-resident", "32768", "--spec-min-p", "0.5", "--vram-reserve-mib", "2048", "--mmap-experts",
+ "--prefill", "auto"]}
+
+ def test_summary(self):
+ s = setup.settings_summary(self.CFG)
+ self.assertEqual(s, "--kv int8 --kv-resident 32768 --spec-min-p 0.5 --vram-reserve-mib 2048 --mmap-experts "
+ "--prefill auto; server 0.0.0.0:8081, api key set, gpu 0,1, fit_max_tokens true")
+ self.assertNotIn("secret", s)
+ self.assertIn("127.0.0.1:9000", setup.settings_summary({"args": []}, 9000))
+
+ def test_a_start_prints_it(self):
+ with tempfile.TemporaryDirectory() as d:
+ exe = Path(d) / "strata.exe"
+ exe.write_bytes(b"")
+ p = Path(d) / "strata-iq3_s.json"
+ args = [x for x in self.CFG["args"] if x != "m.gguf"] # no model file here
+ p.write_text(json.dumps({**self.CFG, "exe": str(exe), "gpu": 0, "args": args}), encoding="utf-8")
+ out = io.StringIO()
+ with mock.patch.object(setup, "gpus", lambda: []), \
+ mock.patch.object(setup, "refresh_draft_vocab"), \
+ mock.patch.object(setup, "is_wsl", lambda: False), \
+ mock.patch.object(setup.subprocess, "call", return_value=0), \
+ contextlib.redirect_stdout(out):
+ setup.start(p, None, open_browser=False, yes=True)
+ text = " ".join(out.getvalue().split())
+ self.assertIn("Settings (strata-iq3_s.json): --kv int8 --kv-resident 32768", text)
+ self.assertIn("--vram-reserve-mib 2048", text)
+
+
if __name__ == "__main__":
unittest.main()