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(evidence): stop calling a limitation "fitted with" when it says "not fitted"

Aashishac87ff9107df
diff --git a/laya/evidence.py b/laya/evidence.py
index f88d4b8e..49f6c1fb 100644
--- a/laya/evidence.py
+++ b/laya/evidence.py
@@ -60,7 +60,10 @@ def inspect_calibration(config: Dict[str, Any]) -> Dict[str, Any]:
if not isinstance(issues, list):
types[name] = _entry(UNKNOWN, "calibration entry has no issues list; cannot tell limitations")
elif issues:
- types[name] = _entry(INSUFFICIENT, "fitted with recorded limitations: " + "; ".join(str(i) for i in issues),
+ # The prefix says nothing about whether a fit ran: `calibration_report` writes
+ # "not fitted: N calibration items..." into this same list, so "fitted with ..." here
+ # would contradict the limitation it is quoting a line below.
+ types[name] = _entry(INSUFFICIENT, "limitations recorded: " + "; ".join(str(i) for i in issues),
{"items": items, "issues": issues})
else:
types[name] = _entry(PRESENT, "fitted with no recorded issues on %d items" % items,
diff --git a/tests/test_evidence.py b/tests/test_evidence.py
index 887e6a65..bbeafbd0 100644
--- a/tests/test_evidence.py
+++ b/tests/test_evidence.py
@@ -52,6 +52,23 @@ clamped = calib({"training": {"laya_train_calibration": {"choice": {"items": 200
"issues": ["the fitted temperature 0.5 is on the [0.5, 3] clamp"]}}}})
check("clamped fit stays a visible limitation -> INSUFFICIENT", clamped["types"]["choice"]["state"], evidence.INSUFFICIENT)
+# ---------------------------------------------- the reason text, which nothing pinned at all
+# `low`'s issue list says "not fitted", and the prefix used to say "fitted with recorded
+# limitations", so one `laya-evals evidence` line asserted the fit and denied it in the same
+# breath. The reason's job is to carry the upstream text; it adds no claim of its own.
+check("below-MIN_TYPE_N reason is the prefix plus the upstream text, verbatim",
+ low["types"]["choice"]["reason"],
+ "limitations recorded: not fitted: 5 calibration items, fewer than 10, so the "
+ "temperature stays 1.0")
+check("below-CALIB_WARN_N reason is the prefix plus the upstream text, verbatim",
+ warned["types"]["choice"]["reason"], "limitations recorded: fitted on only 30 calibration items")
+check("clamped reason is the prefix plus the upstream text, verbatim",
+ clamped["types"]["choice"]["reason"],
+ "limitations recorded: the fitted temperature 0.5 is on the [0.5, 3] clamp")
+check_true("no limitation reason states a fit the artifact did not record",
+ all(not t["reason"].startswith("fitted") for t in
+ (low["types"]["choice"], warned["types"]["choice"], clamped["types"]["choice"])))
+
clean = calib({"training": {"laya_train_calibration": {"choice": {"items": 400, "temperature": 1.1, "issues": []}}}})
check("clean supported fit -> PRESENT", clean["types"]["choice"]["state"], evidence.PRESENT)
check("all-clean overall -> PRESENT", clean["state"], evidence.PRESENT)