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.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for receptron/laya and "Bake Laya weights into a container image at build time"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer