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.

build(deps): cap NumPy below 2 in the onnx extra

thread3d495b590be438
diff --git a/pyproject.toml b/pyproject.toml
index 420661e2..60f30233 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -54,7 +54,21 @@ structured = ["pydantic>=2.0.0"]
# `pip install laya[onnx]` adds ONNX Runtime for `laya.onnx_agent` and `onnxscript`, which
# `torch.onnx.export` requires (`scripts/export_onnx.py`, `tests/test_onnx.py`).
-onnx = ["onnx", "onnxruntime", "onnxscript"]
+#
+# The NumPy cap is not about ONNX: the extra's own resolution (onnx -> ml-dtypes) otherwise
+# pulls NumPy 2, and torch below 2.3 is built against NumPy 1.x and raises "Numpy is not
+# available" when it converts a tensor against 2.x, which `predict()` needs for its final
+# `.numpy()`. This package declares `torch>=2.0.0`, so the extra must not force a NumPy the
+# declared floor cannot use.
+#
+# It is scoped by marker rather than written as a blanket `numpy<2`, because a hard upper cap
+# binds every `laya[onnx]` install -- including the many on a current torch -- and makes the
+# extra unresolvable next to anything else requiring `numpy>=2`. The marker names the stack this
+# actually affects: the macOS/Intel checkout (#948), where torch tops out at 2.2.2 and NumPy 1.26
+# satisfies onnx, onnxruntime and onnxscript. Every other platform resolves what `onnx` wants,
+# so none of those three is quietly pinned to NumPy 1.x on its behalf.
+onnx = ["onnx", "onnxruntime", "onnxscript",
+ "numpy<2; platform_system == 'Darwin' and platform_machine == 'x86_64'"]
# `pip install laya[langchain]` adds the LangChain / LangGraph integrations (laya.integrations).
langchain = [