Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
51 lines
2.1 KiB
Python
51 lines
2.1 KiB
Python
"""tools/_paths.py - where the tools find llama.cpp's gguf-py (for the MTP packer and the fixtures).
|
|
|
|
Order: $STRATA_GGUF_PY, then <engine>/third_party/llama.cpp/gguf-py (what setup.py clones), then the development
|
|
tree's ../../.ref/llama.cpp/gguf-py, then (#3269) the install folders: in the Control package setup.py writes third_party/
|
|
to the per-user install folder ($STRATA_INSTALL_DIR, else the app's folder, the Terminal's remembered installs), not
|
|
beside the tools, so a tool run by hand from the package finds it there.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ENGINE = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def _install_dirs() -> list[Path]:
|
|
"""The per-user install folders a Control-mode setup.py writes third_party/ into. Best effort: never raises."""
|
|
out: list[Path] = []
|
|
raw = os.environ.get("STRATA_INSTALL_DIR")
|
|
if raw:
|
|
out.append(Path(raw).expanduser())
|
|
try:
|
|
if str(ENGINE) not in sys.path:
|
|
sys.path.append(str(ENGINE))
|
|
from strata_control import discovery
|
|
out.append(discovery.app_install_dir())
|
|
out += [pl.path for pl in discovery.places(here=ENGINE)]
|
|
except Exception:
|
|
pass
|
|
return out
|
|
|
|
|
|
def gguf_py() -> str:
|
|
cands = [os.environ.get("STRATA_GGUF_PY"), ENGINE / "third_party" / "llama.cpp" / "gguf-py",
|
|
ENGINE.parents[min(1, len(ENGINE.parents) - 1)] / ".ref" / "llama.cpp" / "gguf-py"] # the dev tree; a shallow install (G:\Strata) has no grandparent
|
|
cands += [d / "third_party" / "llama.cpp" / "gguf-py" for d in _install_dirs()]
|
|
for c in cands:
|
|
if c and (Path(c) / "gguf").is_dir():
|
|
return str(c)
|
|
sys.exit("llama.cpp's gguf-py was not found. Set STRATA_GGUF_PY to the gguf-py folder of any llama.cpp checkout "
|
|
"(<llama.cpp>/gguf-py), or run setup.py once (it downloads llama.cpp into third_party/ of the install "
|
|
"folder; in the desktop app or the Terminal package that folder is STRATA_INSTALL_DIR, which this tool also "
|
|
"looks in)")
|
|
|
|
|
|
def add_gguf_py() -> None:
|
|
p = gguf_py()
|
|
if p not in sys.path:
|
|
sys.path.insert(0, p)
|