{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "receptron-laya--rebuild-the-onnx-bundle-from-a-newer-checkpoint",
 "repo": "receptron/laya",
 "repo_url": "https://github.com/receptron/laya",
 "repo_slug": "receptron-laya",
 "title": "Export a fresh ONNX bundle from a newer Laya checkpoint",
 "page_title": "How to export a fresh ONNX bundle from a newer Laya checkpoint with Laya",
 "summary": "Rebuild the ONNX bundle from the Hugging Face checkpoint and check it against PyTorch.",
 "who": "A machine learning engineer who needs a bundle from a newer checkpoint or a variant that is not published under receptron/laya-onnx.",
 "problem": "The published bundle may lag the upstream checkpoint, and a custom variant cannot be used without an export.",
 "outcome": "A local ./onnx folder with the five bundle files, verified to match PyTorch to within about 1e-5 in max logit difference, that Laya.load() can read.",
 "steps": [
  "Run `cd export` and then `uv venv -p 3.12 .venv` in the cloned repo.",
  "Run `uv pip install -p .venv/bin/python torch transformers safetensors onnx onnxscript onnxruntime huggingface_hub` to install the export dependencies.",
  "Run the `snapshot_download('convaiinnovations/laya', local_dir='model', ...)` command from the README to fetch the checkpoint. (inferred, check the README)",
  "Run `.venv/bin/python export_onnx.py model ../onnx` and check that the printed max logit difference is about 1e-5.",
  "Call `Laya.load({ modelDir: \"./onnx\" })` and run `LAYA_MODEL_DIR=./onnx yarn example`."
 ],
 "agent_prompt": "In the receptron/laya repo, follow the export section of the README to build an ONNX bundle from convaiinnovations/laya into ../onnx. Expected output: the export script prints a max logit difference against PyTorch that is about 1e-5 and the five bundle files exist. Verify by running `LAYA_MODEL_DIR=./onnx yarn example` and confirming it completes.",
 "agents": [
  "any"
 ],
 "difficulty": "Advanced",
 "time": "1 hour 30 minutes",
 "basis": "readme",
 "caveat": "The README notes that the published bundle uses a different temperature for choice questions with 11 or more options than the upstream checkpoint, so a rebuilt bundle will not match published confidences unless you keep the same calibration values.",
 "category": "Work and operations",
 "tags": [
  "Work and operations"
 ],
 "lang": "typescript",
 "requirements": [
  "Node.js 20 or newer",
  "About 2 GB of RAM for the loaded model, plus a few hundred MB per batch of questions",
  "About 1.7 GB of free disk space for the ONNX weights cached under ~/.cache/receptron-laya",
  "Network access to Hugging Face for the first download"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.7,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/receptron-laya/rebuild-the-onnx-bundle-from-a-newer-checkpoint/",
 "md": "https://dedupedai.com/use-cases/receptron-laya/rebuild-the-onnx-bundle-from-a-newer-checkpoint/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/receptron-laya--rebuild-the-onnx-bundle-from-a-newer-checkpoint.json",
 "api_version": "v1"
}
