Instructions to use trinacratech/snake-trap-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use trinacratech/snake-trap-onnx with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
snake-trap (ONNX)
Laya laya-multilingual fine-tuned to play Snake from a text
description of the board, taught by a hand-written rule planner. Superseded by
trinacratech/snake-rl-room-onnx, which reads the
same input but learned from a reinforcement-learning teacher (102 vs 85 points). Kept for comparison: it is
selectable in the "hard" mode of laya-pi.
| file | what |
|---|---|
model-fp32.onnx |
the model, 1.29 GB, fp32, single file |
rl_agent_config.json |
encoder name, max_len, calibration temperatures |
tokenizer/ |
tokenizer |
encoder/config.json, snake_report.json |
encoder config; evaluation report |
Input
Identical to snake-rl-room: four lines of
head-relative board facts and a neutral move choice (UP/DOWN/LEFT/RIGHT). The only difference is the
optional trap question:
"If the head moves one cell <dir>, is the snake trapped: dead, or cut off from its own tail?"
Build prompts with laya-pi's
snakeweb/snake_state.py;
other wording plays worse.
Training
- Base:
convaiinnovations/laya-multilingual(encoderjhu-clsp/mmBERT-base). - Teacher: a rule planner (breadth-first search over the board) giving the best move(s) and a "tail still reachable" trap label.
- 55,134 training items, 4 epochs, 87 minutes on one GPU.
Evaluation
2,000 held-out boards and 20 full games (24 ร 16, seeds 50000โ50019), real game engine, no planner help.
| this model | laya-multilingual zero-shot | |
|---|---|---|
| mean score, plain | 85.2 (median 91, max 107) | 0.05 |
| mean score, trap shield | 90.8 (median 94, max 119) | โ |
| any best move chosen | 96.7% | 52.8% |
| fatal move chosen | 0.0% | 11% |
One full game on a Raspberry Pi 4 (ONNX Runtime fp32, no shield): 108 points, length 114, 2,273 moves, ~3 s per move.
Limitations
24 ร 16 boards only, exact prompt only; greedy on long snakes. For demonstration and teaching.
Credits
Laya by Convai Innovations (Apache-2.0). Snake rules from laya-mlx (Apache-2.0).
- Downloads last month
- -
Model tree for trinacratech/snake-trap-onnx
Base model
convaiinnovations/laya-multilingual