laya-rs
Laya typed decisions, in Rust. A port of laya-mlx from MLX/Python to candle.
A bidirectional encoder answers constrained questions — a choice, a rubric score, or the probability of a proposition — in one forward pass. No token-by-token decoding, no generated JSON, 0 output tokens.
The package is
laya-rsbecauselayawas taken on crates.io by an unrelated project. The library target is still namedlaya, so imports readuse laya::….
[]
= "0.1"
use Agent;
use json;
let agent = from_pretrained?;
let result = agent.predict?;
println!;
What this adds over the Python package
The MLX package is macOS + Apple Silicon only. This runs on CPU, CUDA and Metal, across Linux, macOS and Windows, as a single static binary with no Python runtime.
CLI
The cli feature (on by default) builds a laya-rs binary:
Features
| Feature | Default | Effect |
|---|---|---|
cli |
yes | the laya-rs binary |
hub |
yes | download checkpoints from the Hugging Face Hub |
metal |
no | Apple GPU acceleration |
cuda |
no | NVIDIA GPU acceleration |
mkl / accelerate |
no | faster CPU inference |
License
Apache-2.0. See NOTICE for
attribution: upstream Laya is by Convai Innovations, and the MLX port this is based on is
mizorewww/laya-mlx. Neither endorses this project.