madewithlaya

Catalog / Tools & apps

0053GitHub

laya-candle: Rust inference with fused Metal kernels tuned for M1 Pro

Loads original Laya safetensors with Candle and runs choice/score/noul with fused kernels, tiled attention and GEMM dispatch tuned for Apple Silicon. Optional f16 on Metal.

Open source ↗ github.comcostfree, localtime-
b0xtch/laya-candleREADME ↗
# laya-candle

Native Rust inference for [Laya](https://github.com/NandhaKishorM/laya) using
[Candle](https://github.com/huggingface/candle). Pass text or JSON and typed
questions to receive choices, ordinal scores, or boolean probabilities.
Loads original Laya safetensors directly, with no Python runtime.

## Usage

Use Rust 1.95 (pinned in `rust-toolchain.toml`) and a native C/C++ build toolchain.
Clone the source and run with CPU float32, the default backend:

```sh
git clone https://github.com/b0xtch/laya-candle.git
cd laya-candle
cargo run --release -- predict \
  --model convaiinnovations/laya \
  --state-file examples/state.json --questions examples/questions.json
```

On Apple Silicon:

```sh
cargo run --release --features metal -- predict \
  --model convaiinnovations/laya --device metal \
  --state 'Please refund the duplicate charge.' \
  --questions examples/questions.json
```

Use `--dtype f16` for reduced precision on Metal. The final scorer and calibration
remain float32, but reduced precision can change probabilities and close decisions.
Metal uses fused kernels, tiled attention, and GEMM dispatch tuned for M1 Pro;
other Metal devices use Candle's matrix dispatch. CPU requires float32.
`--features accelerate` enables Apple's CPU BLAS backend.
CUDA (`--features cuda`, `--device cuda`) and bfloat16 are available but have not
been validated on hardware for this project.

Install the CLI locally with `cargo install --path . --locked` (add
`--features metal` for Apple Silicon), then invoke `laya-candle predict ...`.
The library and CLI are experimental; the 0.1 API may change.

The first Hub load downloads the selected checkpoint. Subsequent loads reuse the
Hugging Face cache. `--model /path/to/checkpoint` loads local weights; `--offline`
uses cached files wi

Also filed under Tools & apps

  1. 0005

    laya-mlx plays Snake at 60 decisions per second

    介绍比Jev快50倍,在你设备上跑的laya-mlx! 只在你的设备上占用最高1G内存 Laya是一个开源的类似于Jev的,基于文本输出概率的分类系统 我将其移植到MLX,并且做了一些性能优化! 视频中就是这个模型在我的本地M3Max上玩贪吃蛇 这个模型能够以每秒决策60次的速度玩贪吃蛇! https://t.co/31KGUiNunb

    @mizorewww · Tools & apps · free, local · 60 decisions/s

  2. 0112

    Laya on Axera AX650 and AX8850 edge NPUs, under 70 ms

    AXERA-TECH's conversion of all three Laya checkpoints for its edge AI chips, reported at latency under 70 ms per decision on AX650/AX8850.

    AXERA-TECH · Tools & apps · free, on-device · < 70 ms on AX650 / AX8850

  3. 0099

    laya-mcp (PerryLink): a warm sidecar that fixes Laya's silent truncation and constant noul

    MCP server plus HTTP sidecar: token-budget preflight that reports what would be cut, a persisted calibration store, structured errors, and a noul fix (P(true) 0.5 → 1.0).

    @PerryLink · Tools & apps · free, local

  4. 0097

    Gomoku against Laya-MLX: you play black, the model picks white's move from six candidates

    Local 15x15 Gomoku on Apple Silicon. Rules in Python, board in the browser, every AI move one real Laya choice over up to six candidates, probabilities shown. No Gomoku training.

    smile-magic · Tools & apps · free, local