laya-weights
Run laya without access to the Hugging Face Hub.
laya normally downloads its model from Hugging Face the first time you use it. Many organisations
allow pip install (directly or through an internal mirror such as Artifactory or Nexus) but block
Hugging Face, so laya fails there. This package ships laya's English checkpoint through pip instead:
pip install laya-weights
That's all. Your existing laya code works unchanged and never contacts Hugging Face for this model.
Maintainer: Aleeza Noor
Quick start
1. Install (about 850 MB download; also installs laya):
pip install laya-weights
2. Run the built-in example to check everything works:
python -m laya_weights.example
tech_support_agent <- The app crashes every time I open settings
billing_agent <- I was charged twice this month, please refund one
sales_agent <- Do you offer a discount for teams of 50?
Try your own query:
python -m laya_weights.example "My invoice shows the wrong company name"
The first run takes a little longer while the weights are unpacked (see How it works).
Use it in your code: agent routing
The English checkpoint suits agent routing and orchestration: read a query and pick the agent whose
description fits it best. Save this as route.py and edit AGENTS to describe your own agents:
import laya
AGENTS = {
"billing_agent": "refunds, invoices, duplicate charges, payment failures",
"tech_support_agent": "crashes, bugs, error messages, login problems",
"sales_agent": "pricing, plans, demos, upgrades for new customers",
}
agent = laya.load() # load once and reuse; no Hugging Face access needed
def route(query):
questions = {"agent": {
"type": "choice",
"instructions": "Which agent should handle this request?",
"criteria": AGENTS,
}}
return agent.predict(query, questions)["answers"]["agent"]["choice"]
print(route("The app crashes every time I open settings")) # tech_support_agent
Tips:
- Load the model once (
laya.load()takes several seconds) and reuse it for every query. - Write specific descriptions that don't overlap. "refunds, invoices" routes better than "money stuff".
- See the laya documentation for other question types.
Installing on a machine with no internet
On a machine that can reach PyPI, download every wheel:
pip download laya-weights -d laya-wheels
Copy the laya-wheels folder across, then install from it:
pip install --no-index --find-links laya-wheels laya-weights
Download on the same OS and Python version as the target machine, because laya's dependencies (such as torch) have platform-specific wheels.
Docker
FROM python:3.11-slim
RUN pip install --no-cache-dir laya-weights \
&& python -m laya_weights # unpack the weights at build time, not at first request
How it works
- PyPI rejects files over 100 MB, so the 843 MB
model.safetensorsships as 9 smalllaya-weights-part-NNpackages thatlaya-weightsdepends on. - On first load, the parts are joined back into one file in
~/.cache/laya-weights, checked against a SHA-256 and reused afterwards. Runpython -m laya_weightsto do this ahead of time (it prints the folder). - A small startup hook catches laya's Hugging Face download request for this checkpoint and serves it from that folder. Requests for other models still go to Hugging Face as normal.
Configuration
| Setting | Default | Purpose |
|---|---|---|
LAYA_WEIGHTS_HOME |
~/.cache/laya-weights |
Where the joined weights are stored. Point it at a writable folder if your home directory is read-only. |
Disk space: about 1.7 GB in total (the installed parts plus the joined copy).
Troubleshooting
- laya still tries to reach Hugging Face. Check that
laya-weightsis installed in the same environment as your code (pip show laya-weights), and that you're using the default English checkpoint (laya.load()with no model name). rebuilt model.safetensors fails its SHA-256 check. A part is corrupt or from a different version. Runpip install --force-reinstall laya-weights.- Permission error on first load. Set
LAYA_WEIGHTS_HOMEto a writable folder.
Limitations
- Only the English checkpoint is included. The multilingual and typed-decisions checkpoints are not,
and
Router()sends non-English text to the multilingual checkpoint, which still needs Hugging Face. - Tested with laya 0.4.34 and 0.4.37.
Building and releasing (maintainers)
pip install build hatchling twine huggingface_hub
python -c "from huggingface_hub import snapshot_download as s; s('convaiinnovations/laya', revision='55cf4c4ebb4ebe31b2550e8bdf3bd21b99753851', local_dir='hf_snapshot', allow_patterns=['rl_agent_config.json','model.safetensors','tokenizer/*','encoder/*'])"
python build_weights.py --version 0.1.1 --parts-version 0.1.0
pip install dist/*.whl && python -m pytest tests
twine upload dist/laya_weights-0.1.1-py3-none-any.whl
For a docs or code change, keep --parts-version on the published parts and upload only the
laya_weights wheel. Bump the parts only when the weights change.
Metadata
Release files for laya-weights 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| laya_weights-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for laya_weights-0.1.1-py3-none-any.whl |
Release files / laya_weights-0.1.1-py3-none-any.whl
| Download URL | laya_weights-0.1.1-py3-none-any.whl |
|---|---|
| Size | 669.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
489c6935d47d084c747ccdf3847ba8ee5057c04960ba500f3e68a0e306475cd7
|
|
BLAKE2b-256 checksum How to use checksums |
ff30200969ce11e37ecaea6bb3bea2cafbb89f4e39194a98a0992ce0f151bd58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for laya-weights 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.