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++
serve: an engine option written as one entry of the config's args is split, a JSON slip is said with its place (#2267)
Niko12218101a8903bed
diff --git a/serve/server.py b/serve/server.pyindex 3ca03b03b..116725c19 100644--- a/serve/server.py+++ b/serve/server.py@@ -6485,6 +6485,43 @@ def clean_shared_defaults(d) -> dict:return out+def split_joined_args(cfg: dict) -> None:+ """#2267: an engine option written as ONE element of the config's "args" - "--ple-io mmap" or "--ple-io=mmap" - reaches+ the engine as a single argument ("unknown argument: --ple-io mmap"; the usual form is two elements, "--ple-io",+ "mmap"). Recommend, never force: such an element is split into the flag and its value, and said at startup. Only an+ element that starts with a flag name (--letters-digits-dashes) followed by a space or "=" is touched, and never one+ that sits in the value place of the flag before it."""+ args = cfg.get("args")+ if not isinstance(args, list):+ return+ out, changed = [], []+ for a in args:+ m = re.match(r"^(--[A-Za-z0-9][A-Za-z0-9-]*)(?:\s+|=)(\S.*)$", a) if isinstance(a, str) else None+ prev = out[-1] if out else None+ in_value_place = isinstance(prev, str) and re.match(r"^--[A-Za-z0-9][A-Za-z0-9-]*$", prev) is not None+ if m is None or in_value_place:+ out.append(a)+ continue+ out += [m.group(1), m.group(2).strip()]+ changed.append(a)+ if changed:+ cfg["args"] = out+ print("[strata] the config's args hold " + ", ".join(repr(c) for c in changed) + " as one element each: split into the "+ 'flag and its value (write them as two elements, e.g. "--ple-io", "mmap")', flush=True)+++def read_config(path) -> dict:+ """The run config's JSON. A mistake in it (a missing comma between two args, a trailing comma) is said with its+ place in the file instead of a traceback (#2267: editing "args" by hand is where it happens)."""+ text = Path(path).read_text(encoding="utf-8-sig") # Notepad adds a BOM+ try:+ return json.loads(text)+ except json.JSONDecodeError as e:+ raise SystemExit(f"[strata] {path} is not valid JSON: {e.msg} at line {e.lineno}, column {e.colno}. Check the commas "+ 'between the entries of "args" (each option and each value is its own quoted entry, e.g. '+ '"--ple-io", "mmap",) and that no entry is followed by a comma at the end of a list.') from None++def lift_reasoning_effort_arg(cfg: dict) -> None:"""#1641: "--reasoning-effort high" in a config's "args" is meant for the thinking level, which is not an engineoption (the engine stopped at the unknown flag). It is the config's "reasoning_effort" (none, low, medium or high:@@ -6719,7 +6756,8 @@ def main() -> int:"each, requests spread over them (also \"replicas\" in the config: a number, or ""[{\"gpus\": [0, 1]}, {\"gpus\": [2, 3]}])")a = ap.parse_args()- cfg = json.loads(Path(a.config).read_text(encoding="utf-8-sig")) if a.config else {} # Notepad adds a BOM+ cfg = read_config(a.config) if a.config else {}+ split_joined_args(cfg)lift_reasoning_effort_arg(cfg)if a.replicas is not None:cfg["replicas"] = a.replicasdiff --git a/serve/test_server.py b/serve/test_server.pyindex 0e566ef5c..c99d51647 100644--- a/serve/test_server.py+++ b/serve/test_server.py@@ -2855,6 +2855,46 @@ class ConfigReasoningEffort(unittest.TestCase):self.assertEqual(cfg, {"args": ["--ctx", "4096"]})+class JoinedEngineArgs(unittest.TestCase):+ """#2267: "--ple-io mmap" written as one element of the config's args reached the engine as one argument."""++ def split(self, args):+ from serve.server import split_joined_args+ cfg = {"args": list(args)}+ with mock.patch("builtins.print") as pr:+ split_joined_args(cfg)+ return cfg["args"], pr.called++ def test_one_element_becomes_flag_and_value(self):+ self.assertEqual(self.split(["--spec", "4", "--ple-io mmap"]), (["--spec", "4", "--ple-io", "mmap"], True))+ self.assertEqual(self.split(["--ple-io=mmap", "--kv int8"]), (["--ple-io", "mmap", "--kv", "int8"], True))++ def test_proper_args_are_untouched(self):+ args = ["--ple-io", "mmap", "--native", "/data/My Models/a b.gguf", "--max-context", "131072", "--vision"]+ self.assertEqual(self.split(args), (args, False))+ # a value in a flag's value place stays whole, whatever it looks like+ args = ["--system-prompt", "--be brief please"]+ self.assertEqual(self.split(args), (args, False))++ def test_no_args(self):+ from serve.server import split_joined_args+ cfg = {}+ split_joined_args(cfg)+ self.assertEqual(cfg, {})++ def test_bad_json_names_the_place(self):+ import tempfile+ from serve.server import read_config+ with tempfile.TemporaryDirectory() as d:+ p = Path(d) / "c.json"+ p.write_text('{"args": ["--ple-io" "mmap"]}', encoding="utf-8")+ with self.assertRaises(SystemExit) as cm:+ read_config(p)+ self.assertIn("line 1", str(cm.exception))+ p.write_text('{"args": ["--ple-io", "mmap"]}', encoding="utf-8")+ self.assertEqual(read_config(p), {"args": ["--ple-io", "mmap"]})++class SharedSettings(unittest.TestCase):"""The web app's "Use for other apps too": POST /settings makes its Chat settings every client's defaults."""diff --git a/src/program/generate.cpp b/src/program/generate.cppindex 770eec4e4..cc2a1aeed 100644--- a/src/program/generate.cpp+++ b/src/program/generate.cpp@@ -3546,7 +3546,7 @@ int main(int argc, char** argv) {"MB/s of random 4 KiB reads): a prompt can spend minutes reading layer 1 and trip the ""stall watchdog (#1425, #1629). --ple-io mmap was 40-100x faster on some DRAM-less NVMe drives but 7x slower on a SATA SSD (#2040), so it is not chosen for you; ""--ple-io ram needs the RAM for the table%s\n", rps, rps * 4096.0 / 1e6,- o.ple_io_explicit ? "" : " (kept direct: pass --ple-io mmap or --ple-io ram to change it)");+ o.ple_io_explicit ? "" : " (kept direct: pass --ple-io mmap or --ple-io ram to change it; in a config file's \"args\" they are two entries: \"--ple-io\", \"mmap\")");}}}diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cppindex 8f29ed18c..5794a27cc 100644--- a/sycl/src/program/generate.cpp+++ b/sycl/src/program/generate.cpp@@ -3093,7 +3093,7 @@ int main(int argc, char **argv) try {"MB/s of random 4 KiB reads): a prompt can spend minutes reading layer 1 and trip the ""stall watchdog (#1425, #1629). --ple-io mmap was 40-100x faster on some DRAM-less NVMe drives but 7x slower on a SATA SSD (#2040), so it is not chosen for you; ""--ple-io ram needs the RAM for the table%s\n", rps, rps * 4096.0 / 1e6,- o.ple_io_explicit ? "" : " (kept direct: pass --ple-io mmap or --ple-io ram to change it)");+ o.ple_io_explicit ? "" : " (kept direct: pass --ple-io mmap or --ple-io ram to change it; in a config file's \"args\" they are two entries: \"--ple-io\", \"mmap\")");}}}