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(packaging): raise the Python floor to 3.10 and drop the stale metadata copy (#46)
BladeDeve3ef1dc9a13a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 9fecc50c..d04d70c7 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -23,7 +23,7 @@ jobs:strategy:fail-fast: falsematrix:- python: ["3.9", "3.11", "3.13"]+ python: ["3.10", "3.11", "3.13"]steps:- uses: actions/checkout@v4- uses: actions/setup-python@v5diff --git a/README.md b/README.mdindex da95bc05..b41419ff 100644--- a/README.md+++ b/README.md@@ -42,6 +42,8 @@ Three checkpoints, and a `Router` that picks between them per request:pip install laya```+Python 3.10 or newer. The dependencies set that floor: `huggingface_hub` 1.x, `transformers` 5.x and `torch` 2.14 all require 3.10.+---## Quickstart: Route Mode (Recommended)diff --git a/laya/agent.py b/laya/agent.pyindex 849db907..c63325be 100644--- a/laya/agent.py+++ b/laya/agent.py@@ -145,7 +145,8 @@ class Agent:if not os.path.exists(cfg_path):raise FileNotFoundError(f"Incompatible model: {model_id_or_path!r} does not contain 'rl_agent_config.json'. "- f"Make sure you are loading a compatible RL Agent model (e.g. 'convaiinnovations/rl-agent')."+ f"That file ships with the weights of a Laya checkpoint, so load one of those "+ f"(e.g. 'convaiinnovations/laya') or a directory your own training run wrote.")with open(cfg_path) as f:diff --git a/pyproject.toml b/pyproject.tomlindex f247394b..3c82fd60 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -7,7 +7,7 @@ name = "laya"version = "0.3.4"description = "Fast, non-autoregressive System 1 decision engine with calibrated probabilities"readme = "README.md"-requires-python = ">=3.8"+requires-python = ">=3.10"license = { text = "Apache-2.0" }authors = [{ name = "Convai Innovations" }@@ -18,21 +18,24 @@ classifiers = ["Intended Audience :: Developers","License :: OSI Approved :: Apache Software License","Programming Language :: Python :: 3",- "Programming Language :: Python :: 3.8",- "Programming Language :: Python :: 3.9","Programming Language :: Python :: 3.10","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12",+ "Programming Language :: Python :: 3.13","Topic :: Scientific/Engineering :: Artificial Intelligence",]dependencies = ["torch>=2.0.0",- "transformers>=4.45.0",+ "transformers>=4.48.0","safetensors>=0.4.0","huggingface_hub>=0.20.0","numpy>=1.20.0",]+[tool.setuptools]+# assets/, research/ and notebooks/ sit in the root, so auto-discovery bails out.+packages = ["laya"]+[project.urls]Homepage = "https://huggingface.co/convaiinnovations/laya"Demo = "https://huggingface.co/spaces/convaiinnovations/laya-demo"diff --git a/setup.py b/setup.pyindex 93db822b..ac0f9047 100644--- a/setup.py+++ b/setup.py@@ -1,25 +1,4 @@-from setuptools import setup, find_packages+"""Shim for tooling that still invokes setup.py; metadata lives in pyproject.toml."""+from setuptools import setup-setup(- name="laya",- version="0.3.4",- description="Fast, non-autoregressive System 1 decision engine with calibrated probabilities",- long_description=open("README.md").read(),- long_description_content_type="text/markdown",- author="Convai Innovations",- license="Apache-2.0",- packages=find_packages(),- python_requires=">=3.8",- install_requires=[- "torch>=2.0.0",- "transformers>=4.45.0",- "safetensors>=0.4.0",- "huggingface_hub>=0.20.0",- "numpy>=1.20.0",- ],- classifiers=[- "Programming Language :: Python :: 3",- "License :: OSI Approved :: Apache Software License",- "Topic :: Scientific/Engineering :: Artificial Intelligence",- ],-)+setup()diff --git a/tests/test_packaging.py b/tests/test_packaging.pynew file mode 100644index 00000000..5a969106--- /dev/null+++ b/tests/test_packaging.py@@ -0,0 +1,78 @@+"""Packaging metadata must match what the dependencies actually need (#34).++Text parsing, not tomllib: the floor is 3.10 and tomllib arrives in 3.11.+"""+import os+import re+import sys++ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))++PASS, FAIL = [], []+++def check(name, got, want):+ if got == want:+ PASS.append(name)+ else:+ FAIL.append("%s:\n got %r\n want %r" % (name, got, want))+++def check_true(name, cond, detail=""):+ if cond:+ PASS.append(name)+ else:+ FAIL.append("%s%s" % (name, ": " + detail if detail else ""))+++def read(name):+ with open(os.path.join(ROOT, name), encoding="utf-8") as f:+ return f.read()+++def version_tuple(text):+ return tuple(int(part) for part in text.split("."))+++pyproject = read("pyproject.toml")+setup_py = read("setup.py")++requires_python = re.search(r'requires-python\s*=\s*"[>=~^]*\s*([\d.]+)"', pyproject)+check_true("pyproject/declares requires-python", requires_python is not None)+floor = version_tuple(requires_python.group(1)) if requires_python else (0, 0)++classifier_versions = [+ version_tuple(v)+ for v in re.findall(r'"Programming Language :: Python :: (\d+\.\d+)"', pyproject)+]+check_true("pyproject/advertises specific Python versions", len(classifier_versions) > 0)+below_floor = [".".join(str(p) for p in v) for v in classifier_versions if v < floor]+check("classifiers/none below requires-python", below_floor, [])++# Checkpoints run on answerdotai/ModernBERT-large, which transformers only knows from 4.48.+transformers_floor = re.search(r'"transformers>=([\d.]+)"', pyproject)+check_true("pyproject/pins a transformers floor", transformers_floor is not None)+check_true(+ "transformers/floor covers ModernBERT",+ transformers_floor is not None and version_tuple(transformers_floor.group(1)) >= (4, 48),+ "ModernBERT support starts in transformers 4.48",+)++for field in ("python_requires", "install_requires", "classifiers"):+ check_true(+ "setup.py/does not duplicate %s" % field,+ field not in setup_py,+ "metadata belongs in pyproject.toml only",+ )++workflow = read(os.path.join(".github", "workflows", "ci.yml"))+ci_versions = [version_tuple(v) for v in re.findall(r'"(\d+\.\d+)"', workflow)]+stale = [".".join(str(p) for p in v) for v in ci_versions if v < floor]+check("ci/tests no Python below requires-python", stale, [])++print("\n%d passed, %d failed" % (len(PASS), len(FAIL)))+for f in FAIL:+ print(" FAIL", f)+if not FAIL:+ print("all packaging tests passed")+sys.exit(1 if FAIL else 0)