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.

fix(compose): forward LAYA_SHA256_DIGESTS to quickstart service in compose.yaml

naveenprasaath235065d94e212c
diff --git a/compose.yaml b/compose.yaml
index de24dbb3..d9978a3d 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -16,11 +16,13 @@ services:
LAYA_MODEL: "${LAYA_MODEL:-auto}"
LAYA_MODEL_PATH: "${LAYA_MODEL_PATH:-}"
LAYA_REQUEST_FILE: "${LAYA_REQUEST_FILE:-/opt/laya/examples/request.json}"
- # The Hub commit, branch or tag every checkpoint download resolves to, or `reviewed` for the
- # reviewed SHAs in `laya/revisions.py`. Empty keeps the Hub default, which is what these
- # images have always done. This service builds its Router with no `revision=` argument
- # (`examples/docker/quickstart.py`), so this variable is the only way to pin from Compose.
+ # The supply-chain pair: LAYA_REVISION says which Hub commit a checkpoint download resolves to
+ # (a commit, branch, tag, or `reviewed` for the reviewed SHAs in `laya/revisions.py`) and
+ # LAYA_SHA256_DIGESTS verifies the artifact that arrives (`docs/security.md`). This service
+ # builds its Router with no `revision=` or `sha256_digests=` argument
+ # (`examples/docker/quickstart.py`), so these variables are the only way to pin from Compose.
LAYA_REVISION: "${LAYA_REVISION:-}"
+ LAYA_SHA256_DIGESTS: "${LAYA_SHA256_DIGESTS:-}"
HF_HUB_OFFLINE: "${HF_HUB_OFFLINE:-0}"
HF_TOKEN: "${HF_TOKEN:-}"
HF_TOKEN_FILE: "${HF_TOKEN_FILE:-}"
diff --git a/docs/docker.md b/docs/docker.md
index 36df8567..6ecda76c 100644
--- a/docs/docker.md
+++ b/docs/docker.md
@@ -73,6 +73,7 @@ work with `docker run -e`; Compose-only settings are identified below.
| `LAYA_MODEL` | `auto` | Router alias: `auto`, `english`, `multilingual`, `typed-decisions` |
| `LAYA_MODEL_PATH` | unset | Compatible checkpoint path inside the container |
| `LAYA_REVISION` | unset | Hub commit, branch or tag used for every checkpoint download, or `reviewed` for the reviewed SHAs in `laya/revisions.py`; a `revision=` argument still wins |
+| `LAYA_SHA256_DIGESTS` | unset | JSON digests verified before weights are parsed and loaded: `{artifact: digest}` for every checkpoint, or `{model: {artifact: digest}}` per checkpoint. See [Security](security.md) |
| `LAYA_REQUEST_FILE` | bundled request | JSON request path inside the container |
| `OMP_NUM_THREADS` | `4` | CPU threads; keep within available cores |
| `HF_TOKEN` / `HF_TOKEN_FILE` | unset | Optional Hugging Face credential |
diff --git a/tests/test_compose_env.py b/tests/test_compose_env.py
index 58874a55..d00e2b2a 100644
--- a/tests/test_compose_env.py
+++ b/tests/test_compose_env.py
@@ -443,8 +443,9 @@ DEFERRED = ()
required = sorted((package_read & documented_rows) - excluded - set(DEFERRED))
check_true("core/the widened set is not empty", len(required) >= 10, required)
-check_true("core/the widened set includes the name this change forwards",
- "LAYA_REVISION" in required, sorted(required))
+check_true("core/the widened set includes the names this change forwards",
+ "LAYA_REVISION" in required and "LAYA_SHA256_DIGESTS" in required,
+ sorted(required))
check_true("core/nothing is deferred out of the widened set", DEFERRED == (),
"a deferred name is a documented knob that no shipped deployment can set")
@@ -588,6 +589,17 @@ if server_doc:
re.search(r"^\| `%s` \|" % _name, _body, re.M) is not None,
"the two sections above derive their demand from this table, so a row "
"deleted by accident retires the gate instead of reopening the question")
+ _quickstart_env = env_blocks(read("compose.yaml")).get("laya", {})
+ check_true("compose/compose.yaml defines the laya service",
+ "laya" in env_blocks(read("compose.yaml")), sorted(_quickstart_env))
+ for _name in ("LAYA_REVISION", "LAYA_SHA256_DIGESTS"):
+ check_true("compose/compose.yaml/laya forwards the supply-chain knob %s"
+ % _name, _name in _quickstart_env,
+ "it is documented and read by the quickstart runtime, and the service "
+ "that needs it is the one that never named it")
+ check_true("docs/docker.md keeps the %s row in the main table" % _name,
+ re.search(r"^\| `%s` \|" % _name, docker_md, re.M) is not None,
+ "the base compose file forwards it so the main table must document it")
# 7. the real renderer, when this machine has one: the rendered environment must carry the value.
if shutil.which("docker"):