Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

refactor(verify): drop setup_laya.sh and move the smoke test under verify/

thread3d582d9fad4434
diff --git a/.gitignore b/.gitignore
index 15cf1136..828b74da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,8 +74,6 @@ site/
.ruff_cache/
research/*_benchmark_results.json
-# local setup artifacts written by setup_laya.sh: the checkpoint weights, and the Hugging Face
-# and pip caches it keeps inside the checkout
+# local checkpoint weights, kept out of the tree
+# (fetch them with: python verify/checkpoints.py --fetch)
models/
-.hf-cache/
-.pip-cache/
diff --git a/verify/edge_sweep.py b/verify/edge_sweep.py
index 9f5affd8..754d61f6 100644
--- a/verify/edge_sweep.py
+++ b/verify/edge_sweep.py
@@ -1,12 +1,12 @@
"""Edge-case sweep: the inference paths the repo's other suites do not cover.
-`tests/test_local_e2e.py` and `laya_smoke_test.py` check that Laya answers the right things.
+`tests/test_local_e2e.py` and `verify/laya_smoke_test.py` check that Laya answers the right things.
This checks the shapes and API paths around that: one forward pass answering many questions,
high-cardinality choice sets (the `head_max_len` option budget), odd input shapes and encodings,
long-context truncation, the router lifecycle (preload / LRU / attach / unload) and explicit
device selection, including CPU-vs-MPS agreement.
-Needs the local checkpoints (~2.3 GB, see setup_laya.sh):
+Needs the local checkpoints (~2.3 GB; fetch with `verify/checkpoints.py --fetch`):
.venv/bin/python verify/edge_sweep.py [--models ./models] [--device auto|cpu|mps]
@@ -63,7 +63,8 @@ def main():
"typed-decisions": os.path.join(args.models, "laya-typed-decisions")}
for name, path in models.items():
if not os.path.exists(os.path.join(path, "model.safetensors")):
- sys.exit("missing checkpoint %r at %s -- run ./setup_laya.sh" % (name, path))
+ sys.exit("missing checkpoint %r at %s -- fetch it with "
+ "python verify/checkpoints.py --fetch" % (name, path))
device = None if args.device == "auto" else args.device
mixed = {"a": {"type": "choice", "instructions": "Which team?", "criteria": {"billing": "money", "tech": "bugs"}},
diff --git a/verify/laya_smoke_test.py b/verify/laya_smoke_test.py
index 9b9ec906..c96ad525 100644
--- a/verify/laya_smoke_test.py
+++ b/verify/laya_smoke_test.py
@@ -4,7 +4,7 @@
Exercises everything the README promises -- routing, the three checkpoints, all three
decision primitives, the built-in presets -- and prints per-checkpoint latency.
- python laya_smoke_test.py --models ./models [--device auto|cpu|mps] [--repeat 5]
+ python verify/laya_smoke_test.py --models ./models [--device auto|cpu|mps] [--repeat 5]
Exits non-zero if any check fails.
"""
@@ -20,7 +20,8 @@ os.environ.setdefault("USE_TORCH", "1")
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
HERE = os.path.dirname(os.path.abspath(__file__))
-sys.path.insert(0, HERE) # repository root; <root>/laya/email.py must not shadow stdlib email
+ROOT = os.path.dirname(HERE)
+sys.path.insert(0, ROOT) # repository root; <root>/laya/email.py must not shadow stdlib email
import laya # noqa: E402
from laya.router import Router # noqa: E402
@@ -70,7 +71,7 @@ def timed(fn, repeat):
def main():
ap = argparse.ArgumentParser()
- ap.add_argument("--models", default=os.path.join(HERE, "models"),
+ ap.add_argument("--models", default=os.path.join(ROOT, "models"),
help="directory holding laya/, laya-multilingual/, laya-typed-decisions/")
ap.add_argument("--device", default="auto", help="auto (Laya picks), cpu, or mps")
ap.add_argument("--repeat", type=int, default=5, help="timed iterations per checkpoint")
@@ -82,7 +83,8 @@ def main():
"typed-decisions": os.path.join(root, "laya-typed-decisions")}
for name, path in local.items():
if not os.path.exists(os.path.join(path, "model.safetensors")):
- sys.exit("missing checkpoint %r at %s -- run ./setup_laya.sh" % (name, path))
+ sys.exit("missing checkpoint %r at %s -- fetch it with "
+ "python verify/checkpoints.py --fetch" % (name, path))
device = None if args.device == "auto" else args.device
print("laya %s | python %s | torch %s | transformers %s"
diff --git a/verify/soak_check.py b/verify/soak_check.py
index 652dba25..171bfa55 100644
--- a/verify/soak_check.py
+++ b/verify/soak_check.py
@@ -98,7 +98,8 @@ def main():
"typed-decisions": os.path.join(args.models, "laya-typed-decisions")}
for name, path in models.items():
if not os.path.exists(os.path.join(path, "model.safetensors")):
- sys.exit("missing checkpoint %r -- run ./setup_laya.sh" % name)
+ sys.exit("missing checkpoint %r -- fetch it with "
+ "python verify/checkpoints.py --fetch" % name)
device = None if args.device == "auto" else args.device
print("torch %s | pid %d | RSS via %s | %d calls, %d cycles, %d threads"