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: DeepSeek's engine is its own package (engine-dsv41/ beside the engine, never inside it): downloaded with resume and a SHA-256 check from the --prebuilt base, found before the old all-in-one place; launch's note says so; tests

Niko1221134f24f1999c
diff --git a/setup.py b/setup.py
index 0f4b13bdf..5b23caf9b 100644
--- a/setup.py
+++ b/setup.py
@@ -7687,13 +7687,96 @@ def install_own_path(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopte
return start(cfg_path, port)
+# DeepSeek's engine is its own package, downloaded when DeepSeek is chosen and unpacked in engine-dsv41/ beside the engine: the Qwen engine's
+# files are never touched. Same places as the engine packages (--prebuilt / STRATA_PREBUILT_URL: a release folder, a mirror, a local folder),
+# one asset for each kind of computer, and a <asset>.sha256 beside it (checked when it is there; a GitHub release without one is checked
+# against the digest GitHub publishes, like the engine).
+DSV41_ENGINE_DIR = "engine-dsv41"
+DSV41_ENGINE_ASSETS = {"windows-cuda": "strata-dsv41-windows-x64-cuda13.zip", "linux-cuda": "strata-dsv41-linux-x64-cuda13.zip",
+ "linux-hip": "strata-dsv41-linux-x64-hip-gfx120x.zip"}
+
+
+def dsv41_engine_asset(hip: bool) -> str | None:
+ """The DeepSeek engine package for this computer, None where there is none (Windows AMD, Mac, Intel)."""
+ if hip:
+ return None if WIN else DSV41_ENGINE_ASSETS["linux-hip"]
+ return DSV41_ENGINE_ASSETS["windows-cuda" if WIN else "linux-cuda"]
+
+
+def dsv41_engine_dir(eng: Path) -> Path:
+ """Beside the engine folder; for the app / Terminal (the engine is a component folder Strata does not write into): in Strata's own folder."""
+ return (home() if CONTROL else Path(eng).parent) / DSV41_ENGINE_DIR
+
+
+def get_dsv41_engine(url_base, eng: Path, hip: bool) -> Path | None:
+ """Download, check and unpack the DeepSeek engine package next to the engine `eng`; the folder, or None when it cannot be had (no package
+ for this computer or version, no internet). Resumes like the model files (download()); the engine in `eng` is not touched."""
+ asset = dsv41_engine_asset(hip)
+ dest = dsv41_engine_dir(eng)
+ if asset is None or not url_base:
+ return None
+ acquisition.require("the DeepSeek engine")
+ base = prebuilt_bases(url_base)[-1] if url_base != PREBUILT_URL else prebuilt_bases(url_base)[0]
+ work = dest.parent / (DSV41_ENGINE_DIR + ".download")
+ work.mkdir(parents=True, exist_ok=True)
+ z, side = work / asset, work / (asset + ".sha256")
+ say(" Downloading the DeepSeek engine (its own package, separate from the Strata engine) ...")
+ try:
+ download(base + asset, z, "DeepSeek engine")
+ except SystemExit:
+ warn(f"no DeepSeek engine package at {base} ({asset})")
+ return None
+ want = None
+ try:
+ download(base + asset + ".sha256", side, "its SHA-256")
+ want = side.read_text(encoding="utf-8", errors="replace").split()[0].lower()
+ except (SystemExit, OSError, IndexError):
+ side.unlink(missing_ok=True)
+ if want:
+ h = hashlib.sha256()
+ with open(z, "rb") as f:
+ for b in iter(lambda: f.read(8 << 20), b""):
+ h.update(b)
+ if h.hexdigest() != want:
+ drop_archive(z)
+ side.unlink(missing_ok=True)
+ fail(f"the downloaded {asset} does not match its SHA-256 (it was deleted)", "run setup again; if it keeps failing, the mirror's file is damaged")
+ ok(f"{asset} matches its SHA-256")
+ else:
+ try:
+ verify_engine_archive(z, asset, base)
+ except UnverifiedEngine as e:
+ drop_archive(z)
+ fail(f"the DeepSeek engine package was refused: {e}", "run setup again later")
+ tmp = work / "_unpack"
+ shutil.rmtree(tmp, ignore_errors=True)
+ with zipfile.ZipFile(z) as f:
+ f.extractall(tmp)
+ exe_name = "strata-dsv41.exe" if WIN else "strata-dsv41"
+ inner = tmp if (tmp / exe_name).is_file() else next((d for d in tmp.iterdir() if d.is_dir() and (d / exe_name).is_file()), None)
+ if inner is None:
+ shutil.rmtree(tmp, ignore_errors=True)
+ drop_archive(z)
+ fail(f"{asset} has no {exe_name}", "tell us: the package is wrong")
+ if not WIN:
+ (inner / exe_name).chmod(0o755)
+ shutil.rmtree(dest, ignore_errors=True)
+ shutil.move(str(inner), str(dest))
+ shutil.rmtree(work, ignore_errors=True)
+ ok(f"DeepSeek engine installed: {dest}")
+ return dest
+
+
def dsv41_exe(eng: Path) -> Path | None:
- """The DeepSeek-V4.1 engine (strata-dsv41) beside the engine in `eng`, or STRATA_DSV41_EXE (a build of your own); None when
- there is none."""
+ """The DeepSeek-V4.1 engine (strata-dsv41): STRATA_DSV41_EXE (a build of your own), else its own package folder beside the engine (engine-dsv41/),
+ else beside the engine in `eng` (an older all-in-one package); None when there is none."""
own = (os.environ.get("STRATA_DSV41_EXE") or "").strip()
if own:
return Path(own) if Path(own).is_file() else None
- exe = Path(eng) / ("strata-dsv41.exe" if WIN else "strata-dsv41")
+ name = "strata-dsv41.exe" if WIN else "strata-dsv41"
+ exe = dsv41_engine_dir(eng) / name
+ if not exe.is_file():
+ exe = Path(eng) / name
if exe.is_file() and not WIN and not os.access(exe, os.X_OK): # a package copied without its modes (scp / tar from Windows): fix it, do not stop
try:
exe.chmod(0o755)
@@ -7888,6 +7971,11 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
step(4, "the Strata engine")
llama, eng, meta, lib_dirs, gpu, _vision = engine_step(a, gpu, hip, amd, cuda_tk, "none")
exe = dsv41_exe(eng)
+ if exe is None and not getattr(a, "build", False):
+ get_dsv41_engine(getattr(a, "prebuilt", None), eng, hip)
+ exe = dsv41_exe(eng)
+ if exe is not None and exe.parent != Path(eng):
+ lib_dirs = [*lib_dirs, str(exe.parent)] # its own package carries the libraries it needs
if exe is None:
fail(f"this engine ({meta.get('version')}) has no DeepSeek-V4.1 engine (strata-dsv41) yet",
"update Strata, or compile it with cmake -DSTRATA_BUILD_DSV41=ON and point STRATA_DSV41_EXE at it, then run setup again "
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py
index 607e90fae..ab473464d 100644
--- a/strata_cli/launch/runner.py
+++ b/strata_cli/launch/runner.py
@@ -1838,7 +1838,7 @@ class Runner:
if not exe:
return None
folder = Path(str(exe)).parent
- return any((folder / n).is_file() for n in ("strata-dsv41", "strata-dsv41.exe"))
+ return any((d / n).is_file() for d in (folder, folder.parent / "engine-dsv41") for n in ("strata-dsv41", "strata-dsv41.exe"))
except Exception: # noqa: BLE001
return None
@@ -1856,8 +1856,8 @@ class Runner:
warnings = list(p["warnings"])
engine = self.dsv41_engine()
if engine is False:
- warnings.append("The engine installed here has no DeepSeek-V4.1 engine (strata-dsv41) yet: setup stops with a message before "
- "anything is downloaded. Update Strata, or build it (cmake -DSTRATA_BUILD_DSV41=ON) and set STRATA_DSV41_EXE.")
+ 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.")
return {"verdict": p["verdict"], "lines": p["lines"], "warnings": warnings, "cards": p["cards"], "args": p["args"],
"engine_has_dsv41": engine,
"experts_in_vram": p["experts_in_vram"], "experts_total": p["experts_total"], "vram_experts_gb": p["vram_experts_gb"],
diff --git a/tools/test_setup_dsv41.py b/tools/test_setup_dsv41.py
index 7ddb917f1..58f64bc03 100644
--- a/tools/test_setup_dsv41.py
+++ b/tools/test_setup_dsv41.py
@@ -382,6 +382,31 @@ class OfficialSets(unittest.TestCase):
self.assertEqual(dsv41_fit.plan([RTX5070], 64.0, None, model="UD-Q8_K_XL")["verdict"], "spills") # the big set is unchanged
+class EnginePackage(unittest.TestCase):
+ """DeepSeek's engine is its own package beside the engine; the Qwen engine folder is never written."""
+
+ def test_asset_names_and_folder(self):
+ with mock.patch.object(setup, "WIN", True):
+ self.assertEqual(setup.dsv41_engine_asset(False), "strata-dsv41-windows-x64-cuda13.zip")
+ self.assertIsNone(setup.dsv41_engine_asset(True)) # Windows AMD: no package
+ with mock.patch.object(setup, "WIN", False):
+ self.assertEqual(setup.dsv41_engine_asset(False), "strata-dsv41-linux-x64-cuda13.zip")
+ self.assertEqual(setup.dsv41_engine_asset(True), "strata-dsv41-linux-x64-hip-gfx120x.zip")
+ self.assertEqual(setup.dsv41_engine_dir(Path("/d/engine")), Path("/d") / "engine-dsv41")
+
+ def test_the_own_package_is_found_before_the_old_place(self):
+ with tempfile.TemporaryDirectory() as d, mock.patch.dict("os.environ", {"STRATA_DSV41_EXE": ""}):
+ eng = Path(d) / "engine"
+ eng.mkdir()
+ name = "strata-dsv41.exe" if setup.WIN else "strata-dsv41"
+ self.assertIsNone(setup.dsv41_exe(eng))
+ (eng / name).write_text("old")
+ self.assertEqual(setup.dsv41_exe(eng), eng / name) # an all-in-one engine still works
+ (Path(d) / "engine-dsv41").mkdir()
+ (Path(d) / "engine-dsv41" / name).write_text("new")
+ self.assertEqual(setup.dsv41_exe(eng), Path(d) / "engine-dsv41" / name)
+
+
class InstallOfficial(Install):
"""install_dsv41 for an official set, the engine and the tools mocked."""