v0.2.0
NandhaKishorM/layav0.2.0Sep 19, 2026by NandhaKishorM
Upgrading?
Key Highlights
- Introduced `Router` for model selection.
- Added `laya.lang` for Unicode script detection.
- Fixed `laya-multilingual` loading issues.
- Disabled ModernBERT `reference_compile` to prevent hangs.
New Features
- Router for model selection
- laya.lang script detection
- route() function
Full Release Notes
Routes each request to the checkpoint best suited to it.
## New
**`Router`** picks between `laya` (English), `laya-multilingual` (100+ languages) and `laya-typed-decisions`, loading lazily with LRU eviction.
```python
from laya import Router
router = Router()
router.predict({"body": "I was charged twice"}, questions) # -> laya
router.predict({"body": "मुझसे दो बार शुल्क लिया गया"}, questions) # -> laya-multilingual
router.predict(state, questions, model="typed-decisions") # explicit
```
`route()` returns the decision and its reasoning without loading anything.
**`laya.lang`** — exact Unicode script detection over 22 scripts plus a best-effort Latin language guess. No new dependencies.
## Fixed
- **`laya-multilingual` could not be loaded at all.** Its `extra_special_tokens` ships as a list where transformers expects a mapping, raising `AttributeError: 'list' object has no attribute 'keys'`.
- ModernBERT's `reference_compile` now disabled — it torch.compiles the encoder at batch sizes where that is a loss, and can hang.
- Dropped a duplicate `email_questions` import that shadowed the presets one.
## Why route
Measured on a T4, identical questions per model:
| | `laya` | `laya-multilingual` |
|---|---|---|
| MASSIVE intent, English | **0.783** | 0.657 |
| MASSIVE intent, 13 others | 0.306 | **0.451** |
| XNLI, 14 non-English | 0.521 | **0.731** |
Across all 51 MASSIVE languages the English checkpoint macro-averages 0.227 and clears 3× random on only 23 of 51; the multilingual checkpoint reaches 0.366 and clears it on 45. Khmer scores 0.000 accuracy at 0.952 confidence — the model's own confidence gives no warning, so the decision has to happen before the forward pass.
## Note
If `laya.load()` hangs and TensorFlow is installed, run with `USE_TF=0`. transformers probes for TF at import and its abseil runtime can deadlock model construction.
**Full benchmark data:** the `research` branch.Related Repositories
public-apis/public-apis★ 491,190
A collective list of free APIs
NousResearch/hermes-agent★ 256,045
The agent that grows with you
yt-dlp/yt-dlp★ 200,215
A feature-rich command-line audio/video downloader
microsoft/markitdown★ 191,537
Python tool for converting files and office documents to Markdown.
Significant-Gravitas/AutoGPT★ 187,699
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.