mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
The Python side of the product no longer knows DeepSeek-V4.1-Flash (the refusal of commit 2 answers every way
it can still come in):
- setup.py: MULTI_FILE_FAMILIES / the DSV41_* pins, install_dsv41, mac_dsv41_setup, the engine package fetch and
its helpers, the --check line, the menu row and --family deepseek41 go; model_alias is the identity; a hidden
--dsv41-package answers the "no longer offers" line; the AMD one-card widening and the per-start card memory,
which acted on DeepSeek configs only, go; setup_config.py loses Dsv41Inputs / dsv41_config_for.
- strata_control: dsv41_{context,engine,fit,flags,parallel,paths,sets}.py and gpu_pick.py are deleted;
folder_use.in_use is dsv41_paths.in_use (every package kind used it); updater: no DeepSeek engine step, report
or notice (discover_run_config leaves DeepSeek configs out through retired.py); engine_library: the Qwen family
and the shape engines only ("deepseek" answers the "no longer offers" line); engine_component / engine_update:
no DeepSeek offer; feed.py does not read the dsv41 member (it may stay in the feed for older Strata);
cfg_paths / runtime: no engine-dsv41 repair; models.py: no DeepSeek import preview; the one-line deepseek41
guards in vram_fit, amd_four_card, split_engine, replica_profile go (pictures.py keeps a retired.py guard).
- strata launch: no DeepSeek rows, Speed step, tuner, context list, picture tower, --parallel words or engine
package; --dsv41-package, --speed, --full-quality and --dspark stay hidden and answer the "no longer offers"
line. The --context help loses its DeepSeek parenthesis ([DRAFT] until the owner reads it).
- tools/strata_mcp.py (the catalog of the app, the Terminal and the MCP tools): no DeepSeek rows or plans; rows keep
"multi_file": False, "disk_gb" / "rdna4_faster": None as every Qwen size had them.
- tests: the DeepSeek-only files go (tests/terminal 21 + the launch speed file, tools 4, fixtures); the DeepSeek
cases leave the shared ones; the snapshot matrix loses its DeepSeek set and its 8 goldens (every Qwen golden is
unchanged byte for byte); new: each dropped launch flag answers the line, an engine-dsv41 folder is neither
listed nor touched, a DeepSeek config is left as it was by the path repair.
108 lines
5.4 KiB
Python
108 lines
5.4 KiB
Python
"""A launch, a setup and a model download never update an engine by themselves (owner, 11-01; the same shape as #4823: "downloading a model changed my
|
|
engine without asking"). An engine update is the person's choice, and never beside a loaded model.
|
|
|
|
* Qwen: `strata launch` with an engine older than the model needs warns and goes on; it updates only on a yes (--yes, or the answer on the screens),
|
|
and never with a model loaded. No engine installed at all is still fetched (nothing runs on it yet).
|
|
* The app's model download for Qwen never fetches an engine (control_engine_step), as before.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import ast
|
|
import json
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
from strata_cli.launch import settings as S # noqa: E402
|
|
from strata_cli.launch.runner import Runner # noqa: E402
|
|
from strata_control import engine_component as ec, engine_update, updater # noqa: E402
|
|
from tests.terminal.test_launch_engine_first import FakeProc, qwen_catalog, update_events # noqa: E402
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
OLD = {"usable": True, "engine": {"version": "0.1.45", "backend": "cuda"}, "notice": None}
|
|
NEW = {"usable": True, "engine": {"version": "0.1.50", "backend": "cuda"}, "notice": None}
|
|
NONE = {"usable": False, "engine": None, "notice": "No engine for this PC was found"}
|
|
RUNNING = [{"profile": "launch-demo", "state": "ready"}]
|
|
|
|
|
|
class QwenStaleEngine(unittest.TestCase):
|
|
def ensure(self, statuses, *, serving=(), confirm=None, assume_yes=False):
|
|
spawns, seen = [], []
|
|
r = Runner(S.LaunchSettings(family="qwen", model="Q2_0", context=32768), catalog=qwen_catalog(), emit=seen.append,
|
|
confirm=confirm, assume_yes=assume_yes)
|
|
r.check_cancel = lambda: None
|
|
with mock.patch.object(ec, "status", side_effect=list(statuses)), \
|
|
mock.patch.object(Runner, "needed_engine", return_value=(0, 1, 50)), \
|
|
mock.patch.object(updater, "serving_now", return_value=list(serving)), \
|
|
mock.patch.object(Runner, "_spawn", side_effect=lambda argv, **kw: spawns.append(argv) or FakeProc(update_events("updated"), 0)):
|
|
r.ensure_engine()
|
|
return spawns, r, seen
|
|
|
|
def test_a_loaded_model_blocks_the_update_even_with_yes(self):
|
|
for kwargs in ({"assume_yes": True}, {"confirm": lambda *a: True}, {}):
|
|
spawns, r, seen = self.ensure([OLD], serving=RUNNING, **kwargs)
|
|
self.assertEqual(spawns, [], kwargs)
|
|
self.assertTrue(any("running, so Strata did not update the engine" in n for n in r.notices), r.notices)
|
|
self.assertTrue(any("strata launch --stop" in n for n in r.notices))
|
|
|
|
def test_no_yes_no_update(self):
|
|
spawns, r, _ = self.ensure([OLD])
|
|
self.assertEqual(spawns, [])
|
|
self.assertIn("Strata did not update it. Run `strata update` (or start with --yes)", r.notices[0])
|
|
|
|
def test_no_to_the_question_no_update(self):
|
|
asked = []
|
|
spawns, r, _ = self.ensure([OLD], confirm=lambda t, b: asked.append((t, b)) or False)
|
|
self.assertEqual(spawns, [])
|
|
self.assertEqual(len(asked), 1)
|
|
self.assertIn("older than this model needs", asked[0][1])
|
|
|
|
def test_yes_to_the_question_updates(self):
|
|
spawns, r, _ = self.ensure([OLD, NEW], confirm=lambda t, b: True)
|
|
self.assertEqual(len(spawns), 1)
|
|
self.assertEqual(r.notices, [])
|
|
|
|
def test_yes_flag_updates_when_nothing_is_loaded(self):
|
|
spawns, r, _ = self.ensure([OLD, NEW], assume_yes=True)
|
|
self.assertEqual(len(spawns), 1)
|
|
|
|
def test_no_engine_at_all_is_still_fetched_because_nothing_runs_on_it(self):
|
|
spawns, r, _ = self.ensure([NONE, NEW])
|
|
self.assertEqual(len(spawns), 1)
|
|
|
|
def test_an_engine_that_is_new_enough_asks_nothing(self):
|
|
asked = []
|
|
spawns, r, _ = self.ensure([NEW], confirm=lambda t, b: asked.append(t))
|
|
self.assertEqual((spawns, asked), ([], []))
|
|
|
|
def test_plan_says_it_will_ask(self):
|
|
r = Runner(S.LaunchSettings(family="qwen", model="Q2_0", context=32768), catalog=qwen_catalog(), emit=lambda e: None)
|
|
with mock.patch.object(ec, "status", return_value=OLD), mock.patch.object(Runner, "needed_engine", return_value=(0, 1, 50)), \
|
|
mock.patch("strata_cli.launch.runner.install_isolation_words", return_value=[]):
|
|
words = r.preflight_words()
|
|
self.assertTrue(any("will ask before updating it" in w for w in words), words)
|
|
|
|
|
|
class SourceRules(unittest.TestCase):
|
|
def calls(self, path, function):
|
|
tree = ast.parse((ROOT / path).read_text(encoding="utf-8"))
|
|
names = set()
|
|
for node in ast.walk(tree):
|
|
if isinstance(node, ast.FunctionDef) and node.name == function:
|
|
for inner in ast.walk(node):
|
|
if isinstance(inner, ast.Call):
|
|
f = inner.func
|
|
names.add(f.attr if isinstance(f, ast.Attribute) else f.id if isinstance(f, ast.Name) else "")
|
|
return names
|
|
|
|
def test_the_apps_qwen_model_download_never_fetches_an_engine(self):
|
|
names = self.calls("setup.py", "control_engine_step")
|
|
for forbidden in ("engine_from_feed", "get_prebuilt", "get_prebuilt_hip", "update_installed_engine", "run", "urlopen", "check_call", "Popen"):
|
|
self.assertNotIn(forbidden, names)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|