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: the README's Router link points at a heading that does not exist (#236)

PerryLink8d86b5805a4a
diff --git a/README.md b/README.md
index a11bdaec..c17dcc9d 100644
--- a/README.md
+++ b/README.md
@@ -536,7 +536,7 @@ All of the capability on this benchmark comes from fine-tuning.
Across all 51 languages the English checkpoint macro-averages **0.227** with macro ECE
**0.733**, and only 23 of 51 languages clear 3x random. Khmer scores **0.000 at 95.2%
-confidence**. This is why [`Router`](#model-routing-three-checkpoints-one-call) exists: the
+confidence**. This is why [`Router`](#quickstart-route-mode-recommended) exists: the
model's own confidence gives no warning, so the routing decision has to be made before the
forward pass.
diff --git a/tests/test_packaging.py b/tests/test_packaging.py
index 1990f3ad..9854b075 100644
--- a/tests/test_packaging.py
+++ b/tests/test_packaging.py
@@ -93,6 +93,59 @@ missing_from_ci = [
]
check("ci/tests every advertised Python version", missing_from_ci, [])
+
+# --------------------------------------------------------------- markdown links
+# Nothing checked these, and the README ships to PyPI and to the model card. Only
+# targets inside the repository are checked: external URLs would make the suite depend
+# on the network, which it must not. The README's Router link pointed at a heading that
+# had been renamed, so it silently went nowhere for as long as the rename was in.
+def _slug(heading):
+ """GitHub's heading anchor: drop anything that is not word/space/hyphen, lowercase,
+ then spaces to hyphens."""
+ text = re.sub(r"[^\w\s-]", "", heading.strip().lower(), flags=re.UNICODE)
+ return re.sub(r"\s+", "-", text)
+
+
+def _headings(path):
+ found = set()
+ for line in read(path).splitlines():
+ match = re.match(r"^#{1,6}\s+(.*?)\s*$", line)
+ if match:
+ found.add(_slug(match.group(1)))
+ return found
+
+
+_md = []
+for _dirpath, _dirnames, _filenames in os.walk("."):
+ # `.pytest_cache` ships a README of its own and is not part of the repository.
+ _dirnames[:] = [d for d in _dirnames
+ if d not in (".git", "__pycache__", "node_modules", ".pytest_cache")]
+ _md.extend(os.path.normpath(os.path.join(_dirpath, f))
+ for f in _filenames if f.endswith(".md"))
+_md = sorted(_md)
+_heading_cache = {p: _headings(p) for p in _md}
+
+check_true("md/at least the README, BENCHMARKS and docs are scanned", len(_md) >= 8, _md)
+check_true("md/no build directory scanned",
+ not any(".pytest_cache" in p for p in _md), _md)
+
+_broken_files, _broken_anchors = [], []
+for _path in _md:
+ for _label, _target in re.findall(r"\[([^\]]*)\]\(([^)\s]+?)(?:\s+\"[^\"]*\")?\)",
+ read(_path)):
+ if _target.startswith(("http://", "https://", "mailto:", "data:")):
+ continue
+ _tpath, _, _frag = _target.partition("#")
+ _dest = os.path.normpath(os.path.join(os.path.dirname(_path), _tpath)) if _tpath else _path
+ if _tpath and not os.path.exists(_dest):
+ _broken_files.append("%s: [%s](%s)" % (_path, _label[:30], _target))
+ continue
+ if _frag and _dest.endswith(".md") and _frag not in _heading_cache.get(_dest, set()):
+ _broken_anchors.append("%s: [%s](%s)" % (_path, _label[:30], _target))
+
+check("md/no link to a file that does not exist", _broken_files, [])
+check("md/no anchor that matches no heading", _broken_anchors, [])
+
print("\n%d passed, %d failed" % (len(PASS), len(FAIL)))
for f in FAIL:
print(" FAIL", f)