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.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
chore: wire the new guardrails suite, reach LAYA_EXTRA_MODELS from nix, drop #1035's test
Nandakishor367685bbfefa
diff --git a/nix/laya-serve.nix b/nix/laya-serve.nixindex af3b528e..3ae5b63b 100644--- a/nix/laya-serve.nix+++ b/nix/laya-serve.nix@@ -284,6 +284,22 @@ in'';};+ extraModels = lib.mkOption {+ type = lib.types.nullOr lib.types.str;+ default = null;+ example = ''{"my-checkpoint": "/var/lib/laya/my-checkpoint"}'';+ description = ''+ Checkpoints to register beside the bundled ones (sets+ `LAYA_EXTRA_MODELS`), as a JSON object mapping a name to its source: a+ Hub repo id, a local checkpoint directory, or a `["repo", "subfolder"]`+ pair. A name matching a bundled checkpoint re-points it, which is how a+ fine-tune is served under `english` without a code change. The server+ parses and validates this at startup and refuses to start on a malformed+ value or a name it will not accept, so this module passes it through+ rather than restating the rules. null registers nothing.+ '';+ };+defaultModel = lib.mkOption {type = lib.types.nullOr (lib.types.strMatching "[A-Za-z0-9._/-]+");default = null;@@ -365,6 +381,8 @@ inLAYA_MAX_BATCH_TOKENS = toString cfg.maxBatchTokens;} // lib.optionalAttrs (cfg.revision != null) {LAYA_REVISION = cfg.revision;+ } // lib.optionalAttrs (cfg.extraModels != null) {+ LAYA_EXTRA_MODELS = cfg.extraModels;} // lib.optionalAttrs (cfg.defaultModel != null) {LAYA_DEFAULT_MODEL = cfg.defaultModel;} // {diff --git a/scripts/test_suites.py b/scripts/test_suites.pyindex 9c845b34..089fdf77 100644--- a/scripts/test_suites.py+++ b/scripts/test_suites.py@@ -86,6 +86,7 @@ SCRIPT_SUITES = ["tests/test_mcp_device.py","tests/test_langchain.py","tests/test_portability.py",+ "tests/test_guard_document_781.py","tests/test_training.py","tests/test_train.py","tests/test_kaggle_ddp_convergence.py",diff --git a/tests/test_common.py b/tests/test_common.pydeleted file mode 100644index 34381942..00000000--- a/tests/test_common.py+++ /dev/null@@ -1,61 +0,0 @@-import json--import pytest--from laya.common import render_options, render_criterion---def test_render_options_sorts_criteria():- """Criteria keys must be sorted so JSON key order doesn't change options or model decisions.-- Issue #779 reported that changing JSON key order in criteria modified the model's selected option.- Since choice questions treat options as ordered slots, different sequences produce different- slot embeddings and can flip decisions. The fix sorts criterion keys deterministically.- """- q1 = {"t": "choice", "crit": {"b": "desc b", "a": "desc a", "c": "desc c"}}- q2 = {"t": "choice", "crit": {"a": "desc a", "b": "desc b", "c": "desc c"}}- q3 = {"t": "choice", "crit": {"c": "desc c", "a": "desc a", "b": "desc b"}}-- opts1 = render_options(q1)- opts2 = render_options(q2)- opts3 = render_options(q3)-- expected = ["a: desc a", "b: desc b", "c: desc c"]- assert opts1 == expected, f"Q1 failed: {opts1}"- assert opts2 == expected, f"Q2 failed: {opts2}"- assert opts3 == expected, f"Q3 failed: {opts3}"- assert opts1 == opts2 == opts3, "Options must be identical across all key orders"---def test_render_options_with_numeric_keys():- """Numeric keys should sort numerically when compared as strings."""- q1 = {"t": "choice", "crit": {2: "desc 2", 1: "desc 1", 3: "desc 3"}}- q2 = {"t": "choice", "crit": {3: "desc 3", 1: "desc 1", 2: "desc 2"}}-- opts1 = render_options(q1)- opts2 = render_options(q2)-- expected = ["1: desc 1", "2: desc 2", "3: desc 3"]- assert opts1 == expected, f"Q1 failed: {opts1}"- assert opts2 == expected, f"Q2 failed: {opts2}"- assert opts1 == opts2, "Options must be identical across different key orders"---def test_render_options_preserves_descriptions():- """Descriptions must remain unchanged; only key order is normalized."""- q = {"t": "choice", "crit": {"zebra": "last one", "apple": "first one", "middle": "in between"}}-- opts = render_options(q)-- expected = ["apple: first one", "middle: in between", "zebra: last one"]- assert opts == expected, f"Expected {expected}, got {opts}"---def test_render_options_with_none_values():- """None values should render as just the label without description prefix."""- q = {"t": "choice", "crit": {"b": None, "a": "has desc", "c": ""}}-- opts = render_options(q)-- expected = ["a: has desc", "b", "c"]- assert opts == expected, f"Expected {expected}, got {opts}"