Fruank4 / laya-ort
git clone https://github.com/Fruank4/laya-ort.git
v1.0.0 · 13d ago
Laya typed decisions on Linux x86_64 via ONNX Runtime
+6
stars, 24h · #2,262
+~42
stars, 7 days · #2,842
+200
stars, 30 days · #2,645
206
★ total · +27% this week
1
forks · 0 open issues
Star history (as recorded here)
LanguagePython
LicenseApache-2.0
Created2026-10-09 (13d ago)
Last push11d ago
Watchers0
OwnerUser
Links
README excerpt
中文 **Typed decisions for Linux x86_64.** Laya scores the options you supply in one forward pass and does not generate text. This repository runs that decision on ONNX Runtime's CPU, for Intel and AMD machines. Python builds the question, tokenizes it, and calibrates the probabilities. [code] ## Installation [code] With uv, run `uv add "git+https://github.com/Fruank4/laya-ort.git"` in a uv project, or `uv pip install "git+https://github.com/Fruank4/laya-ort.git"` in a virtual environment. Python 3.10 or newer. The runtime dependencies are ONNX Runtime, Hugging Face Tokenizers, NumPy, and `huggingface_hub`. A virtual environment keeps that install off the system Python: [code] `check` does not download weights. It runs one probe graph through question building, the ONNX session, and result decoding. The probe treats an option's position as its score, so a three-way choice selects the last label, `sales`. Success prints `ok`. On Linux x86_64 it also prints `target: linux x86_64`. The probe needs the `onnx` package: `python -m pip install "laya-ort[dev] @ git+https://github.com/Fruank4/laya-ort.git"`. ## Quickstart Export the three official checkpoints once, then ask a question. Export is documented below. The graphs are large and are not stored in git. [code] English text uses `models/english`. Chinese uses `models/multilingual`. `predict` prints the chosen label, the distribution, and token usage. The output token count is 0. On one refund question, all three graphs selected `billing`, and the probabilities matched upstream PyTorch to four decimal places. That check is for this question, not a full benchmark. ## Three question types One call can answer several questions. The labels are part of the request, so a new option does not need a new training run. | Type | Returns | Use it for | |---|---|---| | `choice` | one label and the full distribution | triage, routing, which tool to call | | `score` | the expected level on an ordered rubric | urgency, severity | | `noul` | the probability that a proposition is true | refund requested, policy violation | `examples/questions.json` asks all three: [code] A `choice` criterion may be that object, or a list such as `["billing", "technical", "sales"]`. A `noul` question has two slots, `false` then `true`, and the returned number is P(true). Keep a choice under about 20 options, and put the distinguishing words first. Every option shares one token budget, so a long list is truncated until the labels are hard to tell apart. ## Checkpoints The weights are Convai Innovations' release, `convaiinnovations/laya` on Hugging Face. This git repository does not contain them. | Name | Encoder | Parameters | Context | Graph | |---|---|---:|---:|---| | `english` | ModernBERT-large | 421M | 512 | `models/english/laya.onnx` | | `multilingual` | mmBERT-base | 322M | 1024 | `models/multilingual/laya.onnx` | | `typed-decisions` | ModernBERT-large | 421M | 1024 | `models/typed-decisions/laya.onnx` | After export, ea