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 for DeepSeek: the tune text says what it really does and its result lists what was timed (or that nothing could be compared); the plan names an installed DeepSeek engine ('installed, 0.1.49') instead of saying setup will download it; preset test; tests

Niko12215be4964c2b11
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py
index 710dfbd0d..b408ff739 100644
--- a/strata_cli/launch/runner.py
+++ b/strata_cli/launch/runner.py
@@ -1265,7 +1265,8 @@ class Runner:
mode = "thorough" if s.tune == "thorough" else "quick"
argv = [sys.executable, str(Path(__file__).resolve().parents[2] / "tools" / "dsv41" / "tune.py"), "--config", str(cfg), "--mode", mode,
"--output", "json"]
- self.emit("tune", "Tuning DeepSeek for the best speed: a few short test runs (1-3 minutes each). Close other heavy programs.", 0)
+ self.emit("tune", "Tuning DeepSeek: it times a short question with your standard settings, then with the DSpark drafter on (and, if that helps, a shorter "
+ "draft block) and the CPU threads set to your physical cores; each run loads the model once. It keeps only a clear gain. Close other heavy programs.", 0)
try:
p = self._spawn(argv)
except Exception as e: # noqa: BLE001 - a tune never stops a launch
@@ -1830,21 +1831,54 @@ class Runner:
except Exception: # noqa: BLE001
return ""
- def dsv41_engine(self) -> bool | None:
- """Whether the installed engine carries strata-dsv41 (True / False); None when no engine is installed yet or it cannot be told."""
+ def dsv41_engine_found(self) -> tuple[Path | None, bool | None]:
+ """(strata-dsv41 already installed, or None; whether the engine can be told at all). Looks where setup puts DeepSeek's own engine package
+ (engine-dsv41/ beside the engine, in Strata's own folder, and in the data folder), and at STRATA_DSV41_EXE (a build of your own)."""
+ from strata_control import dsv41_engine
own = (os.environ.get("STRATA_DSV41_EXE") or "").strip()
if own:
- return Path(own).is_file()
+ return (Path(own) if Path(own).is_file() else None), True
+ folders: list[Path] = []
try:
from strata_control import engine_component as ec
rep = ec.status()
exe = (rep.get("engine") or {}).get("exe") if rep.get("usable") else None
- if not exe:
- return None
- folder = Path(str(exe)).parent
- return any((d / n).is_file() for d in (folder, folder.parent / "engine-dsv41") for n in ("strata-dsv41", "strata-dsv41.exe"))
+ if exe:
+ folder = Path(str(exe)).parent
+ folders += [folder.parent / dsv41_engine.DIR]
+ try:
+ folders.append(self.catalog.strata.setup_module().dsv41_engine_dir(folder))
+ except Exception: # noqa: BLE001
+ pass
+ known = True
+ else:
+ known = None
except Exception: # noqa: BLE001
- return None
+ known = None
+ try: # where the setup this Terminal runs puts it (its own engine folder, or Strata's folder)
+ mod = self.catalog.strata.setup_module()
+ folders += [Path(self.catalog.root) / dsv41_engine.DIR, # setup runs here in the app's installer mode: its home() is this folder
+ mod.dsv41_engine_dir(Path(mod.ROOT) / "engine"), Path(mod.home()) / dsv41_engine.DIR]
+ except Exception: # noqa: BLE001
+ pass
+ try:
+ folders.append((Path(self.s.data_dir) if self.s.data_dir else self.catalog.data_dir()) / dsv41_engine.DIR)
+ except Exception: # noqa: BLE001
+ pass
+ for f in folders:
+ found = dsv41_engine.find(f)
+ if found is not None:
+ return found, True
+ for f in folders[:1]: # the engine's own folder: an all-in-one package carries it
+ for n in ("strata-dsv41", "strata-dsv41.exe"):
+ if (f.parent / n).is_file():
+ return f.parent / n, True
+ return None, known
+
+ def dsv41_engine(self) -> bool | None:
+ """Whether the installed engine carries strata-dsv41 (True / False); None when no engine is installed yet or it cannot be told."""
+ found, known = self.dsv41_engine_found()
+ return True if found is not None else (False if known else None)
def placement(self) -> dict:
"""Where DeepSeek-V4.1-Flash would go on this computer's cards (strata_control/dsv41_fit.py): the cards this launch names, else every
@@ -1858,7 +1892,11 @@ class Runner:
free = None
p = self.catalog.strata.dsv41_plan(hw, free, s.gpus, model=s.model)
warnings = list(p["warnings"])
- engine = self.dsv41_engine()
+ found, known = self.dsv41_engine_found()
+ engine = True if found is not None else (False if known else None)
+ if found is not None:
+ ver = next((part for part in (found.parent.name.split("-")[0], ) if part[:1].isdigit()), "")
+ p["lines"].append("DeepSeek engine: installed" + (f", {ver}" if ver else "") + ".")
if engine is False:
warnings.append("DeepSeek runs on its own engine package (about 70 MB, separate from the Strata engine): setup downloads it first. "
"If it cannot be fetched, setup stops with a message before the model is downloaded.")
diff --git a/tests/terminal/test_dsv41_tui_items.py b/tests/terminal/test_dsv41_tui_items.py
index 69f42dbbd..6c99c0db1 100644
--- a/tests/terminal/test_dsv41_tui_items.py
+++ b/tests/terminal/test_dsv41_tui_items.py
@@ -48,6 +48,36 @@ class Advanced(unittest.TestCase):
self.assertIn("not in this engine's list", next(r for r in rows if r.name == "--dsparkk").description)
+class Presets(unittest.TestCase):
+ def test_a_saved_preset_is_read_from_where_it_is_written_whatever_the_data_dir(self):
+ import tempfile
+ from strata_cli.launch import settings as S, store
+ with tempfile.TemporaryDirectory() as d, mock.patch.dict("os.environ", {"STRATA_LAUNCH_PRESET_DIR": d}):
+ s = S.LaunchSettings(family="deepseek41", model="IST-DAS-2.00bpw", data_dir=str(Path(d) / "elsewhere"), name="DS 8K")
+ store.save(s, "DS 8K")
+ self.assertEqual([p.name for p in store.list_presets()], ["DS 8K"])
+ self.assertEqual(store.preset_dir(), Path(d)) # (the folder does not depend on the launch's --data-dir)
+
+
+class PlanEngine(unittest.TestCase):
+ def test_an_installed_deepseek_engine_is_named_in_the_plan_not_downloaded(self):
+ import tempfile
+ from strata_cli.launch import runner as R
+ with tempfile.TemporaryDirectory() as d:
+ pkg = Path(d) / "engine-dsv41" / "0.1.49-windows-x86_64-cuda-cuda13"
+ pkg.mkdir(parents=True)
+ exe = pkg / ("strata-dsv41.exe" if sys.platform == "win32" else "strata-dsv41")
+ exe.write_bytes(b"x")
+ fake = mock.MagicMock()
+ fake.s.data_dir = d
+ fake.catalog.data_dir.return_value = Path(d)
+ fake.catalog.strata.setup_module.side_effect = RuntimeError("no setup")
+ with mock.patch.dict("os.environ", {"STRATA_DSV41_EXE": ""}), mock.patch("strata_control.engine_component.status", return_value={"usable": False}):
+ found, known = R.Runner.dsv41_engine_found(fake)
+ self.assertEqual(found, exe)
+ self.assertTrue(known)
+
+
class Disk(unittest.TestCase):
def setUp(self):
import strata_mcp as M
diff --git a/tests/terminal/test_dsv41_tune.py b/tests/terminal/test_dsv41_tune.py
index aa81fb399..30b28a0d9 100644
--- a/tests/terminal/test_dsv41_tune.py
+++ b/tests/terminal/test_dsv41_tune.py
@@ -51,6 +51,18 @@ class Tune(unittest.TestCase):
self.assertEqual(len(calls), 4) # baseline, drafter on, block 3, threads
self.assertIn("tuned", json.loads(self.cfg.read_text()))
+ def test_the_result_says_what_was_tried(self):
+ res, _ = self.run_tune(lambda a: 4.5)
+ text = " ".join(res["lines"])
+ self.assertIn("Tried (tokens a second): standard 4.5", text)
+ self.assertIn("the drafter on (DSpark) 4.5", text)
+
+ def test_a_single_timing_says_there_was_nothing_to_compare(self):
+ def only_baseline(a):
+ return 4.5 if "--dspark" in a and a[a.index("--dspark") + 1] == "auto" and "--cpu-threads" not in a else None
+ res, _ = self.run_tune(only_baseline)
+ self.assertIn("nothing to compare", " ".join(res["lines"]))
+
def test_noise_changes_nothing(self):
before = self.cfg.read_text()
res, _ = self.run_tune(lambda a: 4.5 + 0.1 * (len(a) % 2))
diff --git a/tools/dsv41/tune.py b/tools/dsv41/tune.py
index 1b286ba8c..fd3aa8b66 100644
--- a/tools/dsv41/tune.py
+++ b/tools/dsv41/tune.py
@@ -142,6 +142,7 @@ def tune(config: Path, mode: str = "quick", n: int = 48, timeout: int = 1500, me
if v > best * GAIN:
best, best_args = v, cand
res["changed"].append(label)
+ tried = ", ".join(f"{k} {v:.1f}" for k, v in res["speeds"].items())
if res["changed"]:
new = [a for a in best_args]
cfg["args"] = new
@@ -151,6 +152,10 @@ def tune(config: Path, mode: str = "quick", n: int = 48, timeout: int = 1500, me
f"({base:.1f} -> {best:.1f} tokens a second). The RAM store sizes itself when the model starts.")
else:
res["lines"].append(f"Your computer already runs DeepSeek best with the standard settings ({base:.1f} tokens a second); nothing changed.")
+ if len(res["speeds"]) > 1:
+ res["lines"].append(f"Tried (tokens a second): {tried}.")
+ else:
+ res["lines"].append("Only the standard settings could be timed here, so there was nothing to compare.")
return res