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: DeepSeek-V4.1 engine gets the slot switch and a slot folder in Strata's data folder (other families untouched)
Niko1221736a4136e1db
diff --git a/serve/server.py b/serve/server.pyindex 8141108d5..55a371967 100644--- a/serve/server.py+++ b/serve/server.py@@ -3477,6 +3477,21 @@ def hip_auto_devices(cfg: dict, env: dict) -> list[int] | None:return visible+DS41_SLOT_KEEP_DEFAULT = "0" # the engine keeps a displaced conversation in RAM and in the slot folder (see below)+++def deepseek_slot_env(env: dict, cfg: dict) -> None:+ """DeepSeek-V4.1 only. The engine sets a conversation aside when another request takes the model and takes it back+ at its checkpoints (agents and sub-agents that take turns do not read their prompts again). STRATA_DS4_SLOT_KEEP+ switches it (the default above; a config's env or the shell wins); the folder is `ds4-slots` next to the run log, in+ Strata's data folder (STRATA_DS4_SLOT_DIR names another), and the engine caps it (STRATA_DS4_SLOT_GB, 16) and+ removes what is older than a week or not this model's."""+ env.setdefault("STRATA_DS4_SLOT_KEEP", DS41_SLOT_KEEP_DEFAULT)+ log = cfg.get("log")+ if "STRATA_DS4_SLOT_DIR" not in env and log:+ env["STRATA_DS4_SLOT_DIR"] = str(Path(log).parent / "ds4-slots")++def child_env(cfg: dict, *, offline: bool = False) -> dict:"""The engine's environment: the CUDA libraries setup installed (pip's nvidia packages, or the toolkit thatcompiled it) first on the library search path."""@@ -3491,6 +3506,8 @@ def child_env(cfg: dict, *, offline: bool = False) -> dict:env["CUDA_VISIBLE_DEVICES"] = ",".join(str(i) for i in ordered_gpus(cfg))for k, v in (cfg.get("env") or {}).items(): # engine settings the config carries (AMD: the GEMM tuning table)env[str(k)] = str(v)+ if (cfg.get("arch") or "") == "deepseek41": # (only this engine reads these; Qwen's environment is untouched)+ deepseek_slot_env(env, cfg)# Strict offline reaches children through the environment, because a tool subprocess or a model# loader is code this server does not own. Applied last so a profile's own `env` cannot remove# the policy by naming the same variable.diff --git a/serve/test_dsv41.py b/serve/test_dsv41.pyindex a4c13bcd9..b928e8162 100644--- a/serve/test_dsv41.py+++ b/serve/test_dsv41.py@@ -20,7 +20,7 @@ ROOT = Path(__file__).resolve().parents[1]sys.path.insert(0, str(ROOT))sys.path.insert(0, str(ROOT / "tools"))import strata_tokenizer as ST # noqa: E402-from serve import frontend # noqa: E402+from serve import frontend, server # noqa: E402from serve.dsml import DsmlOutputParser, DsmlTranslator, to_dsml_force # noqa: E402from serve.frontend import ChatTemplate, OutputParser, openai_to_messages # noqa: E402from serve.server import (FAMILY_MODEL_NAMES, MockEngine, Service, default_model_name, model_card_sampling, # noqa: E402@@ -575,6 +575,36 @@ class Api(unittest.TestCase):self.assertEqual(req, {})+class SlotEnv(unittest.TestCase):+ """The engine's kept conversations: the folder and the switch reach the DeepSeek engine only."""++ KEYS = ("STRATA_DS4_SLOT_KEEP", "STRATA_DS4_SLOT_DIR")++ def env(self, cfg):+ saved = {k: os.environ.pop(k, None) for k in self.KEYS}+ try:+ return server.child_env(cfg)+ finally:+ for k, v in saved.items():+ if v is not None:+ os.environ[k] = v++ def test_deepseek_gets_a_folder_in_the_data_folder_and_the_default_switch(self):+ env = self.env({"arch": "deepseek41", "log": str(Path("data") / "strata-deepseek.log"), "args": []})+ self.assertEqual(Path(env["STRATA_DS4_SLOT_DIR"]), Path("data") / "ds4-slots")+ self.assertEqual(env["STRATA_DS4_SLOT_KEEP"], server.DS41_SLOT_KEEP_DEFAULT)++ def test_the_configs_own_settings_win(self):+ env = self.env({"arch": "deepseek41", "log": "x/y.log",+ "env": {"STRATA_DS4_SLOT_KEEP": "1", "STRATA_DS4_SLOT_DIR": "elsewhere"}})+ self.assertEqual((env["STRATA_DS4_SLOT_KEEP"], env["STRATA_DS4_SLOT_DIR"]), ("1", "elsewhere"))++ def test_other_families_get_nothing(self):+ for arch in ("qwen4exp", None, "gyro"):+ env = self.env({"arch": arch, "log": "x/y.log"} if arch else {"log": "x/y.log"})+ self.assertFalse([k for k in env if k.startswith("STRATA_DS4_")], arch)++class PickTemplateTests(unittest.TestCase):"""A pack made from another GGUF can ship the V4-Flash template (`tool_calls`, no space): the V4.1 model thenwrites malformed calls (P2003 install test). The server swaps in the V4.1 template for such a pack."""