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

launch: the Speed choice and --experts need a DeepSeek engine of 0.1.50 or newer (0.1.49.2 does not accept the flag): an older or unknown engine gets no flag, no Speed step and no plan line, and no error; the version comes from the package folder, else --version; tests

Niko12219b4092a94db9
diff --git a/docs/DEEPSEEK41.md b/docs/DEEPSEEK41.md
index 0854c731c..212a9e2dd 100644
--- a/docs/DEEPSEEK41.md
+++ b/docs/DEEPSEEK41.md
@@ -92,7 +92,7 @@ Not in this version: several requests at once (`--parallel` is ignored with a wa
DeepSeek picks 6 experts for every word it writes. **Faster** uses 5 of them (engine flag `--experts 5`): a small quality change, usually not noticeable, and answers come sooner. It is the default on a PC whose graphics cards total 16 GiB or less: the engine decides that itself (`--experts auto`), and Strata passes `--experts` only when you choose. **Full quality** uses all 6 (`--experts 6`).
-In `strata launch` the guided screens have a Speed step for DeepSeek; with flags use `--speed faster|full`, or `--full-quality` in scripts. `strata launch --plan` shows which one this PC gets.
+The choice needs the DeepSeek engine 0.1.50 or newer (0.1.49.2 does not take `--experts`); with an older engine the step and the plan line are left out and nothing is passed. In `strata launch` the guided screens have a Speed step for DeepSeek; with flags use `--speed faster|full`, or `--full-quality` in scripts. `strata launch --plan` shows which one this PC gets.
## Tuning
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py
index 0f5e65469..76a4a6bd5 100644
--- a/strata_cli/launch/runner.py
+++ b/strata_cli/launch/runner.py
@@ -398,6 +398,33 @@ def cards_for_launch(s: S.LaunchSettings, catalog, ram_gb: float | None = None,
return None
+EXPERTS_MIN_ENGINE = (0, 1, 50) # the first DeepSeek engine that accepts --experts (0.1.49.2, the one shipped before, does not)
+
+
+def dsv41_engine_version(exe) -> tuple:
+ """The version of a DeepSeek engine: from its package folder's name ("0.1.50-windows-x86_64-cuda-cuda13"), else what `--version` prints;
+ () when neither says."""
+ if not exe:
+ return ()
+ from strata_control import dsv41_engine
+ folder = Path(str(exe)).parent.name
+ version = dsv41_engine.version_key(folder) if folder[:1].isdigit() else ()
+ if version:
+ return version
+ try:
+ done = subprocess.run([str(exe), "--version"], capture_output=True, text=True, timeout=10, stdin=subprocess.DEVNULL)
+ found = re.search(r"(\d+\.\d+\.\d+(?:\.\d+)?)", (done.stdout or "") + (done.stderr or ""))
+ return tuple(int(x) for x in found.group(1).split(".")) if found else ()
+ except (OSError, subprocess.SubprocessError, ValueError):
+ return ()
+
+
+def engine_takes_experts(exe) -> bool:
+ """Does this DeepSeek engine accept --experts (0.1.50 or newer)? An engine whose version cannot be told counts as not: nothing is passed,
+ nothing is shown, no error."""
+ return dsv41_engine_version(exe) >= EXPERTS_MIN_ENGINE
+
+
def used_vram_gb(computer, s: "S.LaunchSettings") -> float:
"""Graphics memory (GiB) of the cards this launch uses, summed as the engine sums it: the cards named (--gpu, the Cards step; a role other than
off), else every card that can be used."""
@@ -1330,9 +1357,9 @@ class Runner:
from strata_control import tune_knobs
base = read_config(base_path)
cfg = derive_config(base, self.s, bool_flags=tune_knobs.BOOL_FLAGS,
- log=str(launch_dir() / f"{self.name}.engine.log"), gpus=cards_for_launch(self.s, self.catalog, base=base),
- experts=self.experts_flag())
+ log=str(launch_dir() / f"{self.name}.engine.log"), gpus=cards_for_launch(self.s, self.catalog, base=base))
self.use_own_dsv41_engine(cfg)
+ apply_experts(cfg, self.experts_flag(cfg.get("exe"))) # after the engine is settled: only a 0.1.50+ engine is given --experts
wait = self.start_wait()
if wait > 600 and not cfg.get("engine_ready_s"): # the server's own wait for the engine (900 s) must not end before the start's
cfg["engine_ready_s"] = wait + 60
@@ -1950,7 +1977,7 @@ class Runner:
def resolved_speed(self) -> tuple[str, bool] | None:
"""DeepSeek's speed: ("faster" | "full", whether it is the default for this PC); None for any other model. The default is the engine's own
rule (`--experts auto`: 5 when the cards used total 16 GiB or less); only an explicit choice is written as --experts."""
- if not self.multi_file():
+ if not self.multi_file() or not self.speed_engine_ok():
return None
try:
default = S.faster_default(used_vram_gb(self.catalog.computer(), self.s))
@@ -1960,10 +1987,20 @@ class Runner:
return self.s.speed, (self.s.speed == "faster") == default
return ("faster" if default else "full"), True
- def experts_flag(self) -> int | None:
- """The engine's --experts for this launch: 5 or 6 only when the person chose; None (nothing is passed, the engine's `--experts auto`
- decides) when they did not, and for a model that has no such choice."""
- if self.resolved_speed() is None or self.s.speed not in S.SPEED_MODES:
+ def speed_engine_ok(self, exe=None) -> bool:
+ """The DeepSeek engine this launch will run takes --experts (0.1.50 or newer; the self-upgrade normally brings it first, but nothing relies
+ on that). `exe`: the engine a config names; else the one launch finds. No engine yet, or an older one: False, and the Speed choice stays out."""
+ if exe is None:
+ try:
+ exe = self.dsv41_engine_found()[0]
+ except Exception: # noqa: BLE001
+ exe = None
+ return engine_takes_experts(exe)
+
+ def experts_flag(self, exe=None) -> int | None:
+ """The engine's --experts for this launch: 5 or 6 only when the person chose and the engine takes it; None (nothing is passed, the engine's
+ `--experts auto` decides) when they did not, for an engine that is too old, and for a model that has no such choice."""
+ if not self.multi_file() or self.s.speed not in S.SPEED_MODES or not self.speed_engine_ok(exe):
return None
return 5 if self.s.speed == "faster" else 6
diff --git a/strata_cli/launch/screens.py b/strata_cli/launch/screens.py
index b1ebdf0fe..9550c960a 100644
--- a/strata_cli/launch/screens.py
+++ b/strata_cli/launch/screens.py
@@ -33,12 +33,29 @@ STEPS = (("model", "Model"), ("cards", "Cards"), ("folder", "Folder"), ("context
STEP_LABELS = {**dict(STEPS), "speed": "Speed"}
+def speed_choice_available(ctx) -> bool:
+ """The Speed step is an active choice only when the DeepSeek engine launch will run takes --experts (0.1.50 or newer); otherwise it is not
+ there, with no error. Asked once per run of the screens (the engine files are looked up once)."""
+ cached = getattr(ctx, "_speed_ok", None)
+ if cached is None:
+ try:
+ from strata_cli.launch.runner import Runner
+ cached = bool(Runner(ctx.settings, catalog=ctx.catalog, emit=lambda e: None).speed_engine_ok())
+ except Exception: # noqa: BLE001
+ cached = False
+ try:
+ ctx._speed_ok = cached
+ except AttributeError:
+ pass
+ return cached
+
+
def flow_for(ctx) -> list[str]:
"""The steps of this computer: the Cards step exists only when two or more graphics cards can be used; the Speed step only for DeepSeek."""
ids = [sid for sid, _ in STEPS]
if len(ctx.computer.usable_gpus) < 2:
ids.remove("cards")
- if getattr(ctx.settings, "family", None) == "deepseek41":
+ if getattr(ctx.settings, "family", None) == "deepseek41" and speed_choice_available(ctx):
ids.insert(ids.index("context") + 1, "speed")
return ids
@@ -1537,7 +1554,7 @@ class SaveScreen(Base):
("Context", S.context_label(s.context) + f", memory {s.kv or 'int8'}"),
("Pictures", "on" if s.vision != "off" else "off"),
*([("Speed", S.speed_words(s.speed or ("faster" if S.faster_default(used_vram_gb(self.ctx.computer, s)) else "full"),
- s.speed is None))] if s.family == "deepseek41" else []),
+ s.speed is None))] if s.family == "deepseek41" and speed_choice_available(self.ctx) else []),
("Parallel", f"{s.parallel} at a time" if s.parallel else f"fit to your card ({S.fit_parallel(self.ctx.computer.main_vram_gb)})"),
("Tuning", ({"quick": "quick (about 5-10 min)", "thorough": "thorough (about 10-15 min)", "skip": "skipped"} if s.family == "deepseek41"
else {"quick": "quick (about 20 min)", "thorough": "thorough (up to 2 h)", "skip": "skipped"})[s.tune]),
diff --git a/tests/terminal/test_launch_speed.py b/tests/terminal/test_launch_speed.py
index ca8853584..068ccb3ef 100644
--- a/tests/terminal/test_launch_speed.py
+++ b/tests/terminal/test_launch_speed.py
@@ -5,11 +5,13 @@ from __future__ import annotations
import asyncio
import json
import unittest
+from pathlib import Path
from unittest import mock
from strata_cli.launch import settings as S
from strata_cli.launch.app import LaunchApp
-from strata_cli.launch.runner import Runner, apply_experts, derive_config, experts_from_log, used_vram_gb
+from strata_cli.launch.runner import (Runner, apply_experts, derive_config, dsv41_engine_version, engine_takes_experts, experts_from_log,
+ used_vram_gb)
from strata_cli.launch.screens import SpeedScreen, flow_for
from tests.terminal import test_launch as TL
from tests.terminal.launch_support import Home, text_of
@@ -102,7 +104,11 @@ class Resolve(unittest.TestCase):
cat.strata.multi_family.return_value = True
gpus = [{"index": i, "vram_gb": gb} for i, gb in enumerate(cards)]
cat.computer.return_value = mock.Mock(usable_gpus=gpus)
- return Runner(S.LaunchSettings(family="deepseek41", model="IST-DAS-2.00bpw", **kw), catalog=cat, emit=lambda e: None)
+ r = Runner(S.LaunchSettings(family="deepseek41", model="IST-DAS-2.00bpw", **kw), catalog=cat, emit=lambda e: None)
+ r.dsv41_engine_found = lambda: (Path(self.engine), True)
+ return r
+
+ engine = "/x/engine-dsv41/0.1.50-linux-x86_64-cuda-cuda13/strata-dsv41"
def test_a_12_gb_pc_gets_faster_and_a_big_one_full_quality_in_the_words(self):
self.assertEqual(self.runner(12).resolved_speed(), ("faster", True))
@@ -147,6 +153,35 @@ class Resolve(unittest.TestCase):
self.assertIn("Faster (default on this PC)", self.runner(12).speed_line())
self.assertEqual(self.runner(12, speed="full").speed_line(), "Speed: Full quality: all 6 experts per word")
+ def test_an_engine_older_than_0_1_50_gets_no_experts_flag_and_no_speed(self):
+ old = "/x/engine-dsv41/0.1.49.2-linux-x86_64-cuda-cuda13/strata-dsv41"
+ r = self.runner(12, speed="full")
+ r.dsv41_engine_found = lambda: (Path(old), True)
+ self.assertFalse(r.speed_engine_ok())
+ self.assertIsNone(r.experts_flag()) # an explicit choice too: this engine would not understand the flag
+ self.assertIsNone(r.resolved_speed())
+ self.assertEqual(r.speed_line(), "") # no line in --plan, no error
+ r.dsv41_engine_found = lambda: (None, None) # no engine yet: nothing either
+ self.assertIsNone(r.experts_flag())
+ self.assertEqual(self.runner(12, speed="full").experts_flag(), 6)
+ self.assertEqual(r.experts_flag(self.engine), 6) # the config's engine decides in build_config (after the self-upgrade)
+
+ def test_the_version_comes_from_the_package_folder(self):
+ for name, want in (("0.1.49.2", False), ("0.1.49.9", False), ("0.1.50", True), ("0.1.50.1", True), ("0.2.0", True), ("0.1.49", False)):
+ exe = f"/x/engine-dsv41/{name}-windows-x86_64-cuda-cuda13/strata-dsv41.exe"
+ self.assertEqual(engine_takes_experts(exe), want, name)
+ self.assertEqual(dsv41_engine_version("/x/engine-dsv41/0.1.50-a/strata-dsv41"), (0, 1, 50))
+ self.assertFalse(engine_takes_experts(None))
+ self.assertFalse(engine_takes_experts("/nowhere/strata-dsv41")) # a name that says nothing and a program that is not there
+
+ def test_a_build_of_your_own_is_asked_for_its_version(self):
+ done = mock.Mock(stdout="strata-dsv41 0.1.50.1 (abc)\n", stderr="")
+ with mock.patch("strata_cli.launch.runner.subprocess.run", return_value=done):
+ self.assertTrue(engine_takes_experts("/home/me/build/strata-dsv41"))
+ done = mock.Mock(stdout="strata-dsv41 0.1.49.2\n", stderr="")
+ with mock.patch("strata_cli.launch.runner.subprocess.run", return_value=done):
+ self.assertFalse(engine_takes_experts("/home/me/build/strata-dsv41"))
+
def test_another_model_has_no_speed(self):
cat = mock.Mock()
cat.strata.multi_family.return_value = False
@@ -200,13 +235,18 @@ class Screen(unittest.TestCase):
ctx = make_ctx()
self.assertNotIn("speed", flow_for(ctx))
ctx.settings.family = "deepseek41"
- flow = flow_for(ctx)
+ with mock.patch.object(Runner, "speed_engine_ok", return_value=False): # engine 0.1.49.2 or none: the step is not there
+ self.assertNotIn("speed", flow_for(ctx))
+ ctx._speed_ok = None
+ with mock.patch.object(Runner, "speed_engine_ok", return_value=True):
+ flow = flow_for(ctx)
self.assertEqual(flow[flow.index("context") + 1], "speed")
def test_the_screen_offers_two_choices_and_remembers_only_a_change(self):
ctx = make_ctx()
ctx.settings.family, ctx.settings.model = "deepseek41", "IST-DAS-2.00bpw"
faster_here = S.faster_default(used_vram_gb(ctx.computer, ctx.settings))
+ ctx._speed_ok = True
app = LaunchApp(ctx)
async def go():