Who it is forA DevOps engineer deploying a Node.js service that uses Laya and needs fast, predictable container start-up.
The problemThe first Laya.load() downloads about 1.7 GB, which can stall or fail a container health check at start-up.
The outcomeA build step caches the weights, so a running container loads the model from the local cache and only sends a cheap freshness check.
What you need first
- 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
Steps
- Add
npm install @receptron/layato the image build. - Add
node -e 'import("@receptron/laya").then((m) => m.ensureBundle())'as a build step so the weights are cached. - Set
LAYA_CACHEto a path that the runtime user can read if you want the cache in a fixed location. - Pass
revisionwith a commit hash toLaya.load()to pin the model version for reproducible results. - Start the service and time the first
Laya.load()call to confirm it reads from the cache.
Prompt for your agent
In the receptron/laya repo, write a Dockerfile for a Node.js 20 service at <service-dir> that installs @receptron/laya and runs ensureBundle() during the build. Expected output: an image where the first Laya.load() in the container finishes without a network download. Verify by running the container with networking disabled and confirming that the model loads.
Caveat. The README says the weights are about 1.7 GB in fp32 and the model needs roughly 2 GB of RAM, so size the container memory limit above that before deploying.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
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 [email protected] and we will look at it promptly. Full disclaimer page