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
fix(agent): a short temperature list now fails at load, not at the first decode
PerryLink71aa638dfb7a
diff --git a/laya/agent.py b/laya/agent.pyindex a76041f7..f3df8aff 100644--- a/laya/agent.py+++ b/laya/agent.py@@ -349,6 +349,13 @@ class Agent(HookRegistry):# Keep what the checkpoint shipped for inspection, but only ever apply clamped values:# some buckets are fitted to sharpen rather than soften (see clamp_temperature).self.temperature_raw = self.cfg.get("temperature", [1.0, 1.0, 1.0])+ # `_decode_answers` indexes this by question type, so a list of the wrong length would+ # load cleanly and then raise a bare `IndexError` on the first `score`/`noul` question;+ # refuse the shape here, the way the language-override check below does.+ if not isinstance(self.temperature_raw, (list, tuple)) or len(self.temperature_raw) != 3:+ raise ValueError(+ "Incompatible model: %r temperature must be a list of 3 floats, got %r"+ % (model_id_or_path, self.temperature_raw))self.temperature_by_options_raw = self.cfg.get("temperature_by_options", {})self.temperature = [clamp_temperature(t) for t in self.temperature_raw]self.temperature_by_options = {k: clamp_temperature(v)diff --git a/tests/test_load_errors.py b/tests/test_load_errors.pyindex 2e7486ed..17f8fbc5 100644--- a/tests/test_load_errors.py+++ b/tests/test_load_errors.py@@ -184,6 +184,24 @@ check_true("options within budget/still answers", _ok)del wide_agent+# ------------------------------------------- 6. a temperature list of the wrong length+# `_decode_answers` indexes `temperature` by question type (`QTYPES`), so a checkpoint that+# ships the wrong number of entries -- say one -- loads cleanly, answers `choice` questions,+# and then raises a bare `IndexError` on the first `score`/`noul` question: a decode-time+# crash whose cause is a single config field. The language-override path already refuses this+# shape ("must be a list of 3 floats"); this pins the same refusal for the checkpoint's own+# list, where there was none.+short_temp = Path(TMP.name) / "short-temperature"+build_checkpoint(short_temp)+_cfg = json.loads((short_temp / "rl_agent_config.json").read_text())+_cfg["temperature"] = [0.9]+(short_temp / "rl_agent_config.json").write_text(json.dumps(_cfg), encoding="utf-8")+err = load_error(short_temp)+check_true("short temperature/raises ValueError", isinstance(err, ValueError), repr(err))+check_true("short temperature/names the field", "temperature" in str(err), str(err))+check_true("short temperature/says the shape", "list of 3" in str(err), str(err))++TMP.cleanup()print("\n%d passed, %d failed" % (len(PASS), len(FAIL)))