Text Classification
Transformers
Safetensors
Laya
minimal
snapshot
english-checkpoint
fine-tuning
french
Instructions to use PIXMELT/laya with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PIXMELT/laya with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="PIXMELT/laya")# pip install -U transformers accelerate # Load model directly from transformers import LayaTypedDecisions model = LayaTypedDecisions.from_pretrained("PIXMELT/laya", device_map="auto") - Laya
How to use PIXMELT/laya 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
File size: 5,366 Bytes
4e98125 97155c0 29a1a48 4e98125 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 97155c0 29a1a48 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | ---
license: apache-2.0
library_name: transformers
pipeline_tag: text-classification
tags: [laya, minimal, snapshot, english-checkpoint, fine-tuning, french]
---
# Laya — Minimal Snapshot (English Checkpoint)
This repository is a **minimalist snapshot** of the [`convaiinnovations/laya`](https://huggingface.co/convaiinnovations/laya) model hub. It keeps **only the English base checkpoint** (`laya`, ModernBERT-large backbone, 421M params) together with the files needed to run and fine-tune it.
**Upstream:**
- Model hub: [convaiinnovations/laya](https://huggingface.co/convaiinnovations/laya)
- Code & docs: [github.com/NandhaKishorM/laya](https://github.com/NandhaKishorM/laya)
- Package: `pip install laya`
## What was removed
- `multilingual/` and `typed-decisions/` checkpoints (~1.4 GB of weights)
- Benchmark images and eval results (`assets/`, `eval/`)
- Legacy research scripts (`rl_agent_api.py`, `email_utils.py`)
The English weights themselves are **byte-identical to the upstream snapshot** — this repo does not modify, retrain, or re-quantize the original model in any way. It is simply a trimmed copy, ideal for pulling the model onto a device with limited disk space (~810 MB total, fully standalone and offline-capable).
The multilingual and typed-decisions checkpoints remain available from the upstream hub if you ever need them.
## Layout
```
config.json model marker (architectures: LayaTypedDecisions)
model.safetensors full weights: encoder + decision heads (~804 MB)
rl_agent_config.json hyperparameters and calibration temperatures
encoder/config.json ModernBERT-large architecture config
tokenizer/ tokenizer.json + tokenizer_config.json
rl_common.py training reference (RLCD: model build, rewards, metrics)
test.py standalone smoke test
```
## Quickstart
```bash
pip install laya
```
The checkpoint is fully self-contained: the `model.safetensors` already embeds the ModernBERT-large encoder, so nothing is downloaded from the Hugging Face hub at load time.
```python
import os
os.environ["HF_HUB_OFFLINE"] = "1" # run fully offline
import laya
agent = laya.load(".") # loads this directory
```
## Concrete example (`test.py`)
Non-autoregressive typed decisions over a state, all questions answered in a **single forward pass**:
```python
import os
os.environ["HF_HUB_OFFLINE"] = "1"
import laya
import time
# Load the local checkpoint
agent = laya.load(".")
# State to evaluate
article = ("By 2031, artificial intelligences no longer merely answer: they anticipate, "
"negotiate and sometimes push back. In newsrooms, hospitals and courtrooms, "
"autonomous agents propose decisions, draft summaries and flag their own "
"uncertainty. Some observers speak of a 'second cognitive wave': systems capable "
"of doubting, asking for clarification and refusing a poorly specified task. "
"Others worry about a silent dependency, where humans approve without truly "
"understanding. One thing is certain: the question is no longer whether AIs "
"think, but how we will coexist with them.")
# Typed questions (choice / score / noul)
payload = {
"tone": {
"type": "choice",
"instructions": "What is the dominant tone of `body`?",
"criteria": {
"neutral": "factual account, no judgment",
"alarmist": "emphasis on risks and dangers",
"enthusiastic": "emphasis on promises and benefits"
}
},
"domain_coverage": {
"type": "score",
"instructions": "How many distinct application domains are covered in `body`?",
"criteria": ["none", "one", "two", "three or more"]
},
"mentions_doubt": {
"type": "noul",
"instructions": "Does the text mention AIs' ability to doubt or flag their own uncertainty?"
}
}
# One single forward pass for all questions
timer = time.perf_counter()
result = agent.predict({"body": article}, payload)
for name in payload:
qtype = payload[name]["type"]
print(payload[name]["instructions"])
print("->", result["answers"][name][qtype], "\n")
print(f"Duration: {((time.perf_counter() - timer) * 1000):.2f} ms")
```
Expected output:
```
What is the dominant tone of `body`?
-> neutral
How many distinct application domains are covered in `body`?
-> 3
Does the text mention AIs' ability to doubt or flag their own uncertainty?
-> 0.98...
```
## Fine-tuning (French)
This snapshot is prepared for fine-tuning on French data:
- `rl_common.py` keeps the upstream RLCD training code (model construction, strictly-proper scoring rewards, metrics) as a reference.
- Default config: `max_len=512`, `head_max_len=192` — raise `agent.cfg["max_len"]` if your French documents are long (ModernBERT handles up to 8,192 tokens with RoPE).
- Tip: refit the calibration temperatures in `rl_agent_config.json` on your own French eval set before trusting the probabilities (see the upstream fine-tuning notebook).
## License
**Apache-2.0** — unchanged from the upstream [`convaiinnovations/laya`](https://huggingface.co/convaiinnovations/laya) checkpoint. All credit for the model, training recipe (RLCD), and original documentation goes to Convai Innovations and the upstream authors.
|