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.

docs(citations): point four citations that named no symbol at their referents

Aashishdef0e6636b12
diff --git a/laya/mcp/device.py b/laya/mcp/device.py
index d82ec3be..68a86661 100644
--- a/laya/mcp/device.py
+++ b/laya/mcp/device.py
@@ -108,9 +108,9 @@ def resolve_device(force: str | None = None) -> str:
if torch.cuda.is_available():
return "cuda"
- # Keeps this branch in step with Agent's own auto-detection
- # (laya/agent.py:355-362): cuda -> mps -> xpu -> cpu. The two ``hasattr`` guards are the
- # core's, because ``torch.backends.mps`` and ``torch.xpu`` appeared in different torch
+ # Keeps this branch in step with the availability chain inside
+ # `laya/agent.py::Agent.__init__`: cuda -> mps -> xpu -> cpu. The two ``hasattr`` guards
+ # are the core's, because ``torch.backends.mps`` and ``torch.xpu`` appeared in different torch
# versions; the label must not depend on which one is installed. A machine that answers
# ``mps`` here and has no CUDA is the common case on Apple silicon, and reporting ``cpu``
# there tells a client its checkpoint will not use the GPU it has.
diff --git a/tests/test_example_server_limits.py b/tests/test_example_server_limits.py
index 48f77de5..f8644bfd 100644
--- a/tests/test_example_server_limits.py
+++ b/tests/test_example_server_limits.py
@@ -42,10 +42,10 @@ own lifespan, the Router that builds, `/health` in both representations -- which
and `False` for "the cap came from the environment", "the Router holds laya's default", and
"that default is more than one"; on this branch all three read `True` and the cap reads 2.
-That last line is the half that is not about the default at all: `Router.preload()` raises the
-cap to fit what it preloads (`laya/router.py:275` -> `:372`), so the demo's own default mode ran
-with three checkpoints resident while `/health` reported one. Nothing in the file ever asked the
-running Router what it was holding.
+That last line is the half that is not about the default at all: `laya/router.py::Router.preload`
+raises the cap to fit what it preloads, so the demo's own default mode ran with three checkpoints
+resident while `/health` reported one. Nothing in the file ever asked the running Router what it
+was holding.
`main` is at 66 checks now, and this file is at 81. The fifteen new ones are the request `model`
field. `laya.router.normalise_name` is core's one resolver -- trim, lower-case, alias table,
@@ -405,9 +405,9 @@ def main():
("up to %d kept in memory" % cap)
in client.get("/health", headers={"accept": "text/html"}).text, repr(cap))
# The number cannot come from the requested config, because the config and the
- # Router are allowed to disagree: `Router(preload=True)` raises its own cap to fit
- # what it preloads (laya/router.py:275 -> :372), so the demo's default mode has run
- # with three resident while its env said one. Move the Router and the page must move.
+ # Router are allowed to disagree: `Router(preload=True)` raises its own cap to fit what it
+ # preloads (`laya/router.py::Router.preload`), so the demo's default mode has run with
+ # three resident while its env said one. Move the Router and the page must move.
demo.ROUTER.max_loaded = cap + 1
moved = client.get("/health")
ok("and both follow the Router when the Router raises its own cap",
diff --git a/tests/test_mcp.py b/tests/test_mcp.py
index a0611990..c1491585 100644
--- a/tests/test_mcp.py
+++ b/tests/test_mcp.py
@@ -123,8 +123,8 @@ def test_device():
ok("device/report_keys", set(rep) >= {"device", "torch_cuda", "torch_version"})
ok("device/report_cuda_bool", isinstance(rep["torch_cuda"], bool))
- # The auto-detect branch is a second implementation of Agent's own chain
- # (laya/agent.py:355-362), so it has to be exercised on devices the runner does not have.
+ # The auto-detect branch is a second implementation of the availability chain inside
+ # `laya/agent.py::Agent.__init__`, so it has to be exercised on devices the runner does not have.
# `resolve_device` imports torch inside its body, which makes the module the seam: a fake
# here forces every branch without CUDA, MPS or XPU hardware. Before this block the only
# auto-detect assertion was the domain check above, and it passed on a narrower chain.
diff --git a/tests/test_structured_docs.py b/tests/test_structured_docs.py
index 1488338d..86a2ca77 100644
--- a/tests/test_structured_docs.py
+++ b/tests/test_structured_docs.py
@@ -1,9 +1,9 @@
"""`docs/structured.md`'s tables must be the compiler's behavior, in both directions.
-The page promises a "documented subset" (`laya/structured.py:146` says the mapping is one), and the
-subset table is what a reader trusts. It had drifted both ways at once: it promised `title` as an
-"option label", which no code path reads at all (weight-free proof: the compiled plan is
-byte-identical with and without the key), while `Optional[X]` -- the `anyOf`/`oneOf` unwrap and the
+The page promises a "documented subset" -- `laya/structured.py::questions_from_json_schema` calls it
+one -- and the subset table is what a reader trusts. It had drifted both ways at once: it promised
+`title` as an "option label", which no code path reads at all (weight-free proof: the compiled plan
+is byte-identical with and without the key), while `Optional[X]` -- the `anyOf`/`oneOf` unwrap and
`type: ["x", "null"]` list form -- had been supported for months and appeared nowhere. 13 of the
module's 19 `SchemaError` messages were also undocumented, the three limits collapsed into one row
that said only "the limit is named in the message".