mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
- Deleted: packaging/build_dsv41_cuda.sh, build_dsv41_hip_linux.sh, build_dsv41_windows.bat,
packaging/mac/build_dsv41_engine.sh, tools/dsv41 (pack, smoke, tune, refs, its HIP build scripts) and
third_party/project-maya (its notice covered only the DeepSeek port).
- package_engine.py: no strata-dsv41 beside the engine, no --require-dsv41; build_hip_linux.sh (rx9070),
build_cuda_linux_aarch64.sh and spark/build_engine.sh build and package the Qwen engine only (the same tree,
flags and architectures; the packages no longer carry strata-dsv41); package_terminal.py no longer bundles the
dsv41 scripts; feed_tool.py / make_local_feed.py have no --dsv41; make_model_release.py no DeepSeek bucket;
mac/sign-and-notarize.sh: --engine is the generic engine-package step (a model shape's engine uses it), its
DeepSeek words go; docker/build.sh and entrypoint.sh comments; tools/check py-optional without tools/dsv41.
- docs/DEEPSEEK41.md and docs/DEEPSEEK_MAC.md: the owner's five-line page (approved 11-11), each page with the
whole text, so an old link to either lands on the full answer ("on a Mac" in the Mac one).
- Tests: the DeepSeek build-script and --require-dsv41 checks go (test_engine_manifest, test_bundle_tools_paths,
tools/test_quant_header_names, tools/test_no_llama_download's list, test_update_feed's --dsv41 build test).
The feed member for older Strata versions, frozen, is the next commit (the owner chose to keep it).
87 lines
3.9 KiB
Python
87 lines
3.9 KiB
Python
"""Every tools/*.py that setup.py, strata_cli or strata_control runs BY PATH is in the packaged Terminal (and so in the Control bundle).
|
|
|
|
0.2.4 shipped without tools/dsv41/pack_gguf.py: the tests ran from the checkout, where the file exists, and the packaged Terminal failed at
|
|
"Preparing your model" with "can't open file .../tools/dsv41/pack_gguf.py". This test reads the by-path references out of the source (an
|
|
AST scan: `ROOT / "tools" / "x" / "y.py"` and the plain string "tools/x/y.py"), stages the bundle the way package_terminal does, and checks that
|
|
each referenced file is in it. It then runs the DeepSeek scripts from the BUNDLE with --help in a folder that holds nothing else, so an import
|
|
they need (the sibling smoke.py, strata_tokenizer.py) must come from the bundle too."""
|
|
from __future__ import annotations
|
|
|
|
import ast
|
|
import glob
|
|
import os
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT / "packaging"))
|
|
import package_terminal as pt # noqa: E402
|
|
|
|
#: by-path references that are NOT part of the packaged Terminal on purpose (engine build and install code the bundle never runs). None today.
|
|
NOT_BUNDLED: set[str] = set()
|
|
|
|
|
|
def _flatten(node):
|
|
if isinstance(node, ast.BinOp) and isinstance(node.op, ast.Div):
|
|
return _flatten(node.left) + _flatten(node.right)
|
|
return [node]
|
|
|
|
|
|
def referenced_tools(root: Path = ROOT) -> dict[str, set[str]]:
|
|
"""{'tools/dsv41/pack_gguf.py': {files that name it}} for setup.py, strata_cli/**, strata_control/**."""
|
|
files = [root / "setup.py"] + sorted((root / "strata_cli").rglob("*.py")) + sorted((root / "strata_control").rglob("*.py"))
|
|
found: dict[str, set[str]] = {}
|
|
for f in files:
|
|
tree = ast.parse(f.read_text(encoding="utf-8-sig"))
|
|
for node in ast.walk(tree):
|
|
if isinstance(node, ast.BinOp) and isinstance(node.op, ast.Div):
|
|
vals = [p.value if isinstance(p, ast.Constant) and isinstance(p.value, str) else None for p in _flatten(node)]
|
|
if "tools" in vals:
|
|
rest = []
|
|
for v in vals[vals.index("tools") + 1:]:
|
|
if v is None:
|
|
break
|
|
rest.append(v)
|
|
if rest and rest[-1].endswith(".py"):
|
|
found.setdefault("tools/" + "/".join(rest), set()).add(f.relative_to(root).as_posix())
|
|
elif isinstance(node, ast.Constant) and isinstance(node.value, str):
|
|
m = re.fullmatch(r"tools[/\\]((?:\w+[/\\])*\w+\.py)", node.value)
|
|
if m:
|
|
found.setdefault("tools/" + m.group(1).replace("\\", "/"), set()).add(f.relative_to(root).as_posix())
|
|
return found
|
|
|
|
|
|
class ByPathToolsAreBundled(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.temp = tempfile.TemporaryDirectory()
|
|
cls.root = Path(cls.temp.name) / "bundle"
|
|
cls.root.mkdir()
|
|
(cls.root / "tools").mkdir()
|
|
for item in pt.TOOLS_SUBSET:
|
|
shutil.copy2(ROOT / "tools" / item, cls.root / "tools" / item)
|
|
pt.add_installer(cls.root, ROOT)
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
cls.temp.cleanup()
|
|
|
|
def test_the_scan_finds_the_by_path_tools(self):
|
|
# (a scan that finds nothing would make the next test pass for the wrong reason)
|
|
refs = referenced_tools()
|
|
for name in ("tools/iq_pack.py", "tools/mtp_fetch.py"):
|
|
self.assertIn(name, refs)
|
|
self.assertGreaterEqual(len(refs), 12)
|
|
|
|
def test_every_file_run_by_path_is_in_the_bundle(self):
|
|
missing = {p: sorted(by) for p, by in referenced_tools().items() if p not in NOT_BUNDLED and not (self.root / p).is_file()}
|
|
self.assertEqual(missing, {}, f"run by path, absent from the packaged Terminal: {missing}")
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|