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(install): document installing with uv

nefro31396f939dcf275
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e3055414..749d1b43 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -32,6 +32,15 @@ pip install -e ".[mcp]"
Optional extras are declared in `pyproject.toml`: `serve`, `fast`, `onnx`, `langchain`, `langgraph`.
Install the ones a change needs, for example `pip install -e ".[serve]"`.
+If you use [uv](https://docs.astral.sh/uv/), the same setup is below. uv environments come without
+`pip`, so use `uv pip install` wherever this guide says `pip install`.
+
+```bash
+uv venv --python 3.12
+source .venv/bin/activate
+uv pip install -e ".[mcp]"
+```
+
The server and ONNX paths are exercised by `tests/test_serve.py` and `tests/test_onnx.py`, which
skip when their extras are not installed.
diff --git a/README.md b/README.md
index 54c20cf9..e49e1e2e 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,8 @@
python -m pip install laya
```
+With [uv](https://docs.astral.sh/uv/), run `uv add laya` in a uv project or `uv pip install laya` in a virtual environment.
+
Python 3.10 or newer. Optional extras: `laya[serve]` (HTTP server), `laya[mcp]` (MCP server), `laya[langchain]` (LangChain and LangGraph), `laya[onnx]` (ONNX Runtime), `laya[fast]` (TileLang GPU fast path). Step-by-step setup for each platform, CPU-only or GPU PyTorch builds, and troubleshooting are in [Installation details](#installation-details).
**Long documents.** `laya-multilingual` reads up to 8,192 tokens with `max_len=8192`. Measured accuracy and time by document length, reproducible with [`research/scripts/bench_long_context.py`](https://github.com/NandhaKishorM/laya/blob/main/research/scripts/bench_long_context.py):
@@ -181,6 +183,26 @@ To use the development version instead of the PyPI release, create the virtual e
Run the same version check afterward. The GitHub version follows the repository's default branch and may differ from the published release.
+**Install with uv**
+
+[uv](https://docs.astral.sh/uv/) creates the virtual environment, downloads a matching Python if none is installed, and installs into it. The commands are the same on macOS, Linux and Windows PowerShell:
+
+```bash
+uv venv --python 3.12
+uv pip install laya
+```
+
+`uv pip install` targets the `.venv` in the current directory without activating it, so run the version check for your platform above afterward. Extras and the GitHub version install the same way: `uv pip install "laya[serve]"`, `uv pip install "git+https://github.com/NandhaKishorM/laya.git"`. For a CPU-only or GPU-specific PyTorch build, add `--torch-backend=auto` to pick the build that matches the machine's GPU driver, or name one such as `--torch-backend=cpu`; [uv's PyTorch guide](https://docs.astral.sh/uv/guides/integration/pytorch/) has the list.
+
+If your application is a uv project, add Laya as a dependency instead:
+
+```bash
+uv add laya
+uv run python -I -c "import laya; print(laya.__version__)"
+```
+
+`--torch-backend` applies to `uv pip` only; in a uv project, uv's PyTorch guide shows how to set the PyTorch index in `pyproject.toml`.
+
**Model setup and troubleshooting**
Continue with the [Router quickstart](#quickstart-route-mode-recommended) to run inference. Loading a Hub checkpoint requires access to Hugging Face on its first download; the quickstart's `Router(preload=True)` loads all three configured checkpoints at construction.