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++
DeepSeek engine by hand: --dsv41-package FILE (setup and strata launch) or a file put in engine-dsv41/; the package is checked (DeepSeek engine for this system, signed manifest, every file's hash) before it is installed; plain steps in the missing-engine message and docs; tests
Niko122171c674dcdb5d
diff --git a/docs/DEEPSEEK41.md b/docs/DEEPSEEK41.mdindex 12021fd45..20ca1138e 100644--- a/docs/DEEPSEEK41.md+++ b/docs/DEEPSEEK41.md@@ -89,6 +89,22 @@ package for your computer from the signed update feed (resumable, signature and`engine/`. The Qwen engine's files are never changed. If the feed has no package for your graphics card, setup says so in plain words and stops beforeanything big is downloaded.+### Getting the engine by hand++If the automatic download does not work for you (no access to the update feed, or an offline computer), download the engine package yourself from+the release page: the file is named `strata-dsv41-<version>-<system>-<backend>-<variant>.tar.gz` (Windows and Linux; pick the one for your system and+graphics card). Check it against `SHA256SUMS.txt` on the release page if you like. Then give it to Strata in either of two ways:++```+strata launch --model ist-das-2.00bpw --dsv41-package PATH-TO-THE-FILE+python setup.py --family deepseek41 --dsv41-package PATH-TO-THE-FILE+```++or put the file in the `engine-dsv41/` folder (setup tells you its exact place when it cannot find the engine) and run the same command again.+Strata checks the package before it uses it: it must be the DeepSeek engine (not the Strata engine) for your system, its manifest must be signed by a key+Strata trusts, and every file must match the hash in the manifest. A damaged or foreign file is refused with a plain line and nothing is installed.+The unpacked folder works as well as the archive. The Strata (Qwen) engine is not touched either way.+## Compressed experts (trellis), for testing`strata-dsv41` reads the routed experts in the trellis types as well as the source MXFP4: TQK6 and TQK7 (agentionai's files), and thediff --git a/setup.py b/setup.pyindex eb9cb8251..c5f2eb5c4 100644--- a/setup.py+++ b/setup.py@@ -7710,12 +7710,29 @@ def dsv41_engine_dir(eng: Path) -> Path:return (home() if CONTROL else Path(eng).parent) / DSV41_ENGINE_DIR-def get_dsv41_engine(eng: Path, hip: bool) -> Path | None:- """Download, check and unpack the DeepSeek engine package next to the engine `eng`; its strata-dsv41, or None when it cannot be had."""- acquisition.require("the DeepSeek engine")+def dsv41_manual_steps(eng: Path) -> str:+ return (f"If you downloaded the DeepSeek engine package from the release page (the file strata-dsv41-...-{'windows' if WIN else 'linux'}-....{'zip' if WIN else 'tar.gz'}), "+ f"run the same command again with --dsv41-package PATH-OF-THE-FILE (strata launch accepts it too), or put the file in {dsv41_engine_dir(eng)} "+ "and run it again. Strata checks it before it is used.")+++def get_dsv41_engine(eng: Path, hip: bool, package: str | None = None) -> Path | None:+ """The DeepSeek engine package next to the engine `eng`: one the person gave (--dsv41-package) or put in engine-dsv41/ by hand, else downloaded from+ the signed feed. Checked first either way; its strata-dsv41, or None when it cannot be had."""from strata_control import dsv41_engine- from strata_cli import update_cmdroot = dsv41_engine_dir(eng)+ if package:+ exe = dsv41_engine.install_package(root, package, emit=lambda m: say(" " + m))+ if exe is None:+ fail("the DeepSeek engine package you gave could not be used", "see the line above; nothing else was changed")+ return exe+ for f in dsv41_engine.pending(root):+ say(f" Found {f.name} in {root}: checking it ...")+ exe = dsv41_engine.install_package(root, f, emit=lambda m: say(" " + m))+ if exe is not None:+ return exe+ acquisition.require("the DeepSeek engine")+ from strata_cli import update_cmdsource = update_cmd._feed_source(argparse.Namespace(feed=None), root.parent)say(" Downloading the DeepSeek engine (its own package, separate from the Strata engine) ...")hw = None@@ -7932,7 +7949,7 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,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(eng, hip)+ get_dsv41_engine(eng, hip, getattr(a, "dsv41_package", None))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@@ -7940,8 +7957,8 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,if os.environ.get("STRATA_VERBOSE") == "1" or "--verbose" in sys.argv:say(" Details for developers: build it with cmake -DSTRATA_BUILD_DSV41=ON and point STRATA_DSV41_EXE at it.")fail("DeepSeek's engine is not available for this computer yet",- "Supported graphics cards: NVIDIA RTX 30 and RTX 50 series, and the Radeon AI PRO R9700. Update Strata later (a newer version may add "- "your card), or pick another model. Nothing has been downloaded.")+ "Supported graphics cards: NVIDIA RTX 30 and RTX 50 series, and the Radeon AI PRO R9700. " + dsv41_manual_steps(eng)+ + " Or update Strata later (a newer version may add your card), or pick another model. Nothing has been downloaded.")ok(f"engine: {exe}")step(5, f"downloading {fam['title']} {model}")@@ -8370,6 +8387,8 @@ def main() -> int:ap.add_argument("--set-default-data-dir", action="store_true",help="with --data-dir: remember the new folder as the data folder without moving anything")ap.add_argument("--models-dir", help="where the GGUF files go (default: <data folder>/models)")+ ap.add_argument("--dsv41-package", metavar="FILE", help="DeepSeek: the engine package you downloaded from the release page (a .tar.gz or .zip, "+ "or its unpacked folder); it is checked and installed instead of being fetched")ap.add_argument("--gguf-dir", help="use GGUF files you already have (a folder with every shard: ""<name>-00001-of-0000N.gguf ... -0000N-of-0000N.gguf)")ap.add_argument("--yes", action="store_true", help="accept the recommended answers")diff --git a/strata_cli/launch/cmd.py b/strata_cli/launch/cmd.pyindex 09ffde9b7..6a5042e6c 100644--- a/strata_cli/launch/cmd.py+++ b/strata_cli/launch/cmd.py@@ -84,6 +84,8 @@ def add_parsers(sp: argparse._SubParsersAction) -> list[argparse.ArgumentParser]g.add_argument("--preset", metavar="NAME", help="start a saved preset (other flags change it for this start)")g.add_argument("--model", metavar="NAME", help="the model size, e.g. iq3_xxs, q2_0, ud-q4_k_xl (any case)")g.add_argument("--family", metavar="NAME", help="the model family when a size is offered by several (qwen, swift, coder, ...)")+ g.add_argument("--dsv41-package", metavar="FILE", help="DeepSeek: the engine package you downloaded from the release page (.tar.gz or .zip); "+ "it is checked and installed instead of being fetched")g.add_argument("--model-path", metavar="PATH", help="use model files you already have: a folder of shards or one .gguf file")g.add_argument("--data-dir", metavar="DIR", help="where downloaded model files are stored (default: Strata's data folder)")g.add_argument("--move-data", action="store_true",@@ -199,6 +201,8 @@ def settings_from_args(a: argparse.Namespace, catalog=None) -> tuple[S.LaunchSets = store.load(a.preset) if a.preset else S.LaunchSettings()if a.preset:s.name = s.name or a.preset+ if getattr(a, "dsv41_package", None):+ s.dsv41_package = str(Path(a.dsv41_package).expanduser())if a.model_path:s.model_path = str(Path(a.model_path).expanduser())if not a.model:diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.pyindex 22156b15a..710dfbd0d 100644--- a/strata_cli/launch/runner.py+++ b/strata_cli/launch/runner.py@@ -739,6 +739,8 @@ class Runner:if s.model_path:p = Path(s.model_path)args += ["--gguf-dir", str(p if p.is_dir() else p.parent)]+ if s.dsv41_package and s.family == "deepseek41":+ args += ["--dsv41-package", s.dsv41_package]if s.gpu_roles:args += ["--gpu-roles", ",".join(f"{k}={v}" for k, v in sorted(s.gpu_roles.items(), key=lambda kv: int(kv[0])))]elif s.gpus:diff --git a/strata_cli/launch/settings.py b/strata_cli/launch/settings.pyindex a819a3075..dd175f286 100644--- a/strata_cli/launch/settings.py+++ b/strata_cli/launch/settings.py@@ -82,6 +82,7 @@ class LaunchSettings:family: str | None = None # catalog family id (qwen, swift, coder, unsloth, gyro, nvfp4...)model: str | None = None # catalog size (IQ3_XXS ...)model_path: str | None = None # "Use model files I already have": a .gguf file or a folder+ dsv41_package: str | None = None # DeepSeek: the engine package the person downloaded by hand (checked, then installed)data_dir: str | None = None # where model files are stored (None: the Strata default)gpus: list[int] | None = None # None = the engine's choice (all usable cards)gpu_roles: dict[str, str] | None = None # {"1": "main", "0": "helper", "2": "off"}: a role for every card; None = the recommendationdiff --git a/strata_control/dsv41_engine.py b/strata_control/dsv41_engine.pyindex ecd247137..5085c8aad 100644--- a/strata_control/dsv41_engine.py+++ b/strata_control/dsv41_engine.py@@ -29,6 +29,87 @@ def find(dest: Path) -> Path | None:return folders[-1] / exe_name() if folders else None+ARCHIVE_SUFFIXES = (".tar.gz", ".tar.xz", ".zip")+MAX_UNPACKED = 8 << 30 # a DeepSeek engine package is under a GB; this only stops an archive that unpacks into something huge+++def pending(dest: Path) -> list[Path]:+ """Packages the person put in `dest` (engine-dsv41/) by hand: strata-dsv41-*.tar.gz / .zip, newest first."""+ try:+ files = [f for f in Path(dest).iterdir() if f.is_file() and f.name.startswith("strata-dsv41") and f.name.endswith(ARCHIVE_SUFFIXES)]+ except OSError:+ return []+ return sorted(files, key=lambda f: f.stat().st_mtime, reverse=True)+++def install_package(dest: Path, package: str | os.PathLike, *, emit: Callable[[str], None] = print) -> Path | None:+ """Install a DeepSeek engine package the person downloaded from the release page (a .tar.gz / .zip, or the unpacked folder) into `dest`.+ Checked before anything is installed: it is a DeepSeek engine package for this system, its manifest is signed by a key Strata trusts, and every+ file matches the hash in the manifest. Returns the new strata-dsv41, or None with a plain line through `emit`."""+ from strata_control import components, engine_component as ec, signing, updater+ from strata_control.targets import host_platform++ src, dest = Path(package).expanduser(), Path(dest)+ if not src.exists():+ emit(f"{src} is not there. Download the DeepSeek engine package for your system from the release page and give its path again.")+ return None+ work = dest.parent / (DIR + ".manual")+ shutil.rmtree(work, ignore_errors=True)+ work.mkdir(parents=True)+ try:+ if src.is_dir():+ root = work / "pkg"+ shutil.copytree(src, root)+ else:+ fmt = "zip" if src.name.endswith(".zip") else "tar.xz" if src.name.endswith(".tar.xz") else "tar.gz"+ if not src.name.endswith(ARCHIVE_SUFFIXES):+ emit(f"{src.name} is not a package file (.tar.gz or .zip). Download the DeepSeek engine package for your system from the release page.")+ return None+ root = work / "pkg"+ updater.extract(src, root, fmt, MAX_UNPACKED)+ if not (root / ec.MANIFEST).is_file():+ inner = next((d for d in root.iterdir() if d.is_dir() and (d / ec.MANIFEST).is_file()), None) if root.is_dir() else None+ if inner is None:+ emit(f"{src.name} is not an engine package (it has no {ec.MANIFEST}).")+ return None+ root = inner+ component = ec.read_manifest(root)+ if component.entrypoint != exe_name():+ emit(f"{src.name} is not the DeepSeek engine (its program is {component.entrypoint}, not {exe_name()}). "+ "The Strata engine package is a different download.")+ return None+ if component.platform != host_platform():+ emit(f"{src.name} is for {component.platform}, and this computer is {host_platform()}. Download the one for your system.")+ return None+ outer = ec._verifier+ signing.install_component_verifier(signing.load_trusted_keys())+ try:+ ec.verify_signature(component, {**os.environ, ec.ENV_REQUIRE_SIGNED: "1"})+ ec.verify(component, full=True)+ except ec.ComponentProblem as exc:+ emit(f"{src.name} did not pass its check ({exc}). It may be damaged or not from the Strata release: download it again from the release page.")+ return None+ finally:+ ec.register_signature_verifier(outer)+ name = f"{component.version}-{component.platform}-{component.backend}" + (f"-{component.variant}" if component.variant else "")+ dest.mkdir(parents=True, exist_ok=True)+ target = dest / name+ shutil.rmtree(target, ignore_errors=True)+ shutil.move(str(root), str(target))+ if os.name != "nt":+ (target / exe_name()).chmod(0o755)+ for old in dest.iterdir():+ if old.is_dir() and old.name != target.name:+ shutil.rmtree(old, ignore_errors=True)+ emit(f"DeepSeek engine {component.version} ({component.backend}) checked (signed, every file matches) and installed: {target}")+ return target / exe_name()+ except (updater.UpdateError, ec.ComponentProblem, OSError) as exc:+ emit(f"{src.name} could not be installed: {exc}")+ return None+ finally:+ shutil.rmtree(work, ignore_errors=True)++def install(dest: Path, source: str, *, hardware: dict | None = None, emit: Callable[[str], None] = print, cancel=None) -> Path | None:"""Fetch the DeepSeek engine package for this PC from the signed feed at `source` (a URL or a folder) into `dest`.Returns the new strata-dsv41, or None with a plain line through `emit` when there is none (not in the feed, nothing for this PC)."""diff --git a/tests/terminal/test_dsv41_engine.py b/tests/terminal/test_dsv41_engine.pyindex 634803260..26c047564 100644--- a/tests/terminal/test_dsv41_engine.py+++ b/tests/terminal/test_dsv41_engine.py@@ -130,5 +130,74 @@ class Dsv41Engine(unittest.TestCase):self.assertFalse((self.root / "data" / "engine-dsv41").exists() and any((self.root / "data" / "engine-dsv41").iterdir()))+class ManualPackage(Dsv41Engine):+ """A package the person downloaded by hand: a .tar.gz / .zip or the unpacked folder, checked before it is installed."""++ def archive(self, version="0.1.49"):+ folder = build(self.root / f"man-{version}", version, self.key)+ out = self.root / "dl"+ out.mkdir(exist_ok=True)+ entry = feed_tool.pack_engine(folder, out, prefix="strata-dsv41")+ return folder, out / Path(entry["url"]).name++ def test_a_downloaded_archive_is_checked_and_installed_beside_the_engine(self):+ _folder, archive = self.archive()+ lines = []+ exe = dsv41_engine.install_package(self.root / "data" / "engine-dsv41", archive, emit=lines.append)+ self.assertIsNotNone(exe, lines)+ self.assertTrue(exe.is_file())+ self.assertIn("signed, every file matches", " ".join(lines))+ self.assertEqual(self.tree(self.eng), self.before)++ def test_an_unpacked_folder_works_too(self):+ folder, _ = self.archive()+ exe = dsv41_engine.install_package(self.root / "data" / "engine-dsv41", folder)+ self.assertIsNotNone(exe)++ def test_a_damaged_file_is_refused_and_nothing_is_installed(self):+ folder, _ = self.archive()+ (folder / EXE).write_bytes(b"tampered")+ lines = []+ self.assertIsNone(dsv41_engine.install_package(self.root / "data" / "engine-dsv41", folder, emit=lines.append))+ self.assertIn("did not pass its check", " ".join(lines))+ dest = self.root / "data" / "engine-dsv41"+ self.assertFalse(dest.exists() and any(p.is_dir() for p in dest.iterdir()))++ def test_a_package_signed_by_an_unknown_key_is_refused(self):+ other = fx.make_key()+ folder = build(self.root / "foreign", "0.1.49", other)+ lines = []+ self.assertIsNone(dsv41_engine.install_package(self.root / "data" / "engine-dsv41", folder, emit=lines.append))+ self.assertIn("did not pass its check", " ".join(lines))++ def test_the_strata_engine_package_is_not_taken_for_deepseeks(self):+ src = self.root / "qsrc"+ src.mkdir()+ (src / "strata").write_bytes(b"qwen engine")+ folder = package_engine.build(src, "cuda", "0.1.49", components.host_platform(), self.root / "qout", entry="strata", archs=("sm_86",),+ min_driver={"nvidia": "580.65"}, build_id="q", variant="cuda13")+ feed_tool.sign_package(folder, self.key)+ lines = []+ self.assertIsNone(dsv41_engine.install_package(self.root / "data" / "engine-dsv41", folder, emit=lines.append))+ self.assertIn("not the DeepSeek engine", " ".join(lines))++ def test_a_missing_or_wrong_file_is_said_plainly(self):+ lines = []+ self.assertIsNone(dsv41_engine.install_package(self.root / "x", self.root / "nope.tar.gz", emit=lines.append))+ self.assertIn("is not there", " ".join(lines))+ junk = self.root / "notes.txt"+ junk.write_text("x")+ self.assertIsNone(dsv41_engine.install_package(self.root / "x", junk, emit=lines.append))+ self.assertIn("not a package file", " ".join(lines))++ def test_files_put_in_the_folder_are_found(self):+ _f, archive = self.archive()+ dest = self.root / "data" / "engine-dsv41"+ dest.mkdir(parents=True)+ shutil.copy(archive, dest / archive.name)+ (dest / "readme.txt").write_text("x")+ self.assertEqual([p.name for p in dsv41_engine.pending(dest)], [archive.name])++if __name__ == "__main__":unittest.main()