Text Classification
Laya
ONNX
Safetensors
English
llm-router
prompt-routing
modernbert
Eval Results (legacy)
Instructions to use KVRun/kvrun-relay-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use KVRun/kvrun-relay-v1 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
Download examples/predict_onnx.py from KVRun/kvrun-relay-v1: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/KVRun/kvrun-relay-v1/resolve/main/examples/predict_onnx.py
- Command line
-
hf download hf://KVRun/kvrun-relay-v1/examples/predict_onnx.py
-
curl -L -o predict_onnx.py https://huggingface.co/KVRun/kvrun-relay-v1/resolve/main/examples/predict_onnx.py
1.16 kB
| """Classify prompts with the ONNX export (ONNX Runtime; no PyTorch at inference). | |
| pip install "laya[onnx]" huggingface_hub | |
| python predict_onnx.py "Summarize this: the council voted to expand bike lanes" | |
| `laya.onnx_agent.ONNXAgent` reproduces the exact input layout (question header, option markers, | |
| state) and temperature scaling the graph was trained with. To call the graph directly, see its | |
| `_encode_state` / `_decode_answers`. The Router app's Rust port (crates/router-core/src/router/laya.rs) | |
| is a second reference implementation. | |
| """ | |
| import json | |
| import sys | |
| from huggingface_hub import snapshot_download | |
| from laya.onnx_agent import ONNXAgent | |
| REPO = "[org]/router-laya-v1" | |
| local = snapshot_download(REPO, allow_patterns=["onnx/*", "tokenizer/*", "rl_agent_config.json", "questions.json", "encoder/*"]) | |
| agent = ONNXAgent(local, onnx_path=f"{local}/onnx/router.onnx") | |
| questions = json.load(open(f"{local}/questions.json")) | |
| for prompt in sys.argv[1:] or ["hi there", "Write a haiku about rain"]: | |
| a = agent.predict(prompt, questions)["answers"] | |
| print(f"{a['category']['choice']:<18} complexity={a['complexity']['score']:.2f} {prompt[:60]}") | |