Text Classification
GGUF
llama.cpp
laya
system-one
calibrated-decisions
rlcd
classification
routing
scoring
guardrails
moderation
reinforcement-learning
commercial-use
feature-extraction
Instructions to use fr0stbit3/laya-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use fr0stbit3/laya-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf fr0stbit3/laya-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf fr0stbit3/laya-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf fr0stbit3/laya-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf fr0stbit3/laya-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf fr0stbit3/laya-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf fr0stbit3/laya-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf fr0stbit3/laya-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf fr0stbit3/laya-gguf:Q4_K_M
Use Docker
docker model run hf.co/fr0stbit3/laya-gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use fr0stbit3/laya-gguf with Ollama:
ollama run hf.co/fr0stbit3/laya-gguf:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use fr0stbit3/laya-gguf with Docker Model Runner:
docker model run hf.co/fr0stbit3/laya-gguf:Q4_K_M
- Lemonade
How to use fr0stbit3/laya-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull fr0stbit3/laya-gguf:Q4_K_M
Run and chat with the model
lemonade run user.laya-gguf-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload folder using huggingface_hub
Browse files- README.md +9 -9
- laya-F16.gguf +2 -2
- laya-Q4_K_M.gguf +2 -2
- laya-Q6_K.gguf +2 -2
- laya-Q8_0.gguf +2 -2
- laya-head.safetensors +3 -0
- laya_gguf.py +0 -20
- laya_head.py +12 -0
README.md
CHANGED
|
@@ -8,12 +8,12 @@ base_model_relation: quantized
|
|
| 8 |
---
|
| 9 |
|
| 10 |
> **GGUF conversion** of [convaiinnovations/laya](https://huggingface.co/convaiinnovations/laya) (Apache-2.0), f16, via llama.cpp `convert_hf_to_gguf.py`.
|
| 11 |
-
> `laya-F16.gguf`
|
| 12 |
> **Lightly tested:** outputs matched the original on a limited set (100 AG News + 100 DAIR Emotion samples, a few examples); may need further testing.
|
| 13 |
> **Quantized files** (`laya-Q8_0.gguf`, `-Q6_K.gguf`, `-Q4_K_M.gguf`; `laya-F16.gguf` is the unquantized 16-bit original conversion) are made with `llama-quantize` from the f16 file and are **even less tested**: checked on a single example only, where Q8_0/Q6_K stayed close to f16 and Q4_K_M drifted slightly more (probabilities shifted by up to about 0.02 to 0.03, and score outputs by about 0.04). Prefer f16 or Q8_0 for anything important, and verify Q4_K_M on your own data.
|
| 14 |
|
| 15 |
|
| 16 |
-
**Quant check** (single example: the HF README ticket "Duplicate charge on invoice 4411"; `department`=billing probability, `urgency` score 0-2, `churn_risk` noul; head weights
|
| 17 |
|
| 18 |
| file | size | billing p | urgency | churn |
|
| 19 |
|---|---|---|---|---|
|
|
@@ -30,22 +30,22 @@ base_model_relation: quantized
|
|
| 30 |
llama-server -m laya-F16.gguf --embeddings --pooling none -c 2048 -ub 2048 -b 2048 --port 8080
|
| 31 |
|
| 32 |
# 2. python deps for the decision head + tokenizer
|
| 33 |
-
pip install laya requests torch
|
| 34 |
```
|
| 35 |
|
| 36 |
```python
|
| 37 |
-
# quickstart.py: llama.cpp backbone + Laya head from the
|
| 38 |
import types, requests, torch, laya
|
| 39 |
-
from
|
| 40 |
|
| 41 |
-
|
| 42 |
agent = laya.load("convaiinnovations/laya", device="cpu") # builds the head architecture + tokenizer/prompt logic
|
| 43 |
|
| 44 |
-
# swap in the decision-head weights
|
| 45 |
-
_, head = load_head(
|
| 46 |
sd = agent.model.state_dict()
|
| 47 |
for k, v in head.items():
|
| 48 |
-
if k in sd: sd[k].copy_(
|
| 49 |
|
| 50 |
# swap the PyTorch encoder for the llama.cpp server
|
| 51 |
D = agent.model.encoder.config.hidden_size
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
> **GGUF conversion** of [convaiinnovations/laya](https://huggingface.co/convaiinnovations/laya) (Apache-2.0), f16, via llama.cpp `convert_hf_to_gguf.py`.
|
| 11 |
+
> `laya-F16.gguf` (and the quants) hold the ModernBERT backbone only, and load in llama.cpp as `modern-bert` (use `--embeddings --pooling none`). The decision head and config are in the sibling file `laya-head.safetensors` (like an `mmproj` file); read it with `laya_head.py` (`load_head(path)` returns config + head weights under the original PyTorch names). The head itself must run outside llama.cpp.
|
| 12 |
> **Lightly tested:** outputs matched the original on a limited set (100 AG News + 100 DAIR Emotion samples, a few examples); may need further testing.
|
| 13 |
> **Quantized files** (`laya-Q8_0.gguf`, `-Q6_K.gguf`, `-Q4_K_M.gguf`; `laya-F16.gguf` is the unquantized 16-bit original conversion) are made with `llama-quantize` from the f16 file and are **even less tested**: checked on a single example only, where Q8_0/Q6_K stayed close to f16 and Q4_K_M drifted slightly more (probabilities shifted by up to about 0.02 to 0.03, and score outputs by about 0.04). Prefer f16 or Q8_0 for anything important, and verify Q4_K_M on your own data.
|
| 14 |
|
| 15 |
|
| 16 |
+
**Quant check** (single example: the HF README ticket "Duplicate charge on invoice 4411"; `department`=billing probability, `urgency` score 0-2, `churn_risk` noul; head weights from the head file, backbone in llama.cpp). One example only, not a benchmark.
|
| 17 |
|
| 18 |
| file | size | billing p | urgency | churn |
|
| 19 |
|---|---|---|---|---|
|
|
|
|
| 30 |
llama-server -m laya-F16.gguf --embeddings --pooling none -c 2048 -ub 2048 -b 2048 --port 8080
|
| 31 |
|
| 32 |
# 2. python deps for the decision head + tokenizer
|
| 33 |
+
pip install laya requests torch safetensors
|
| 34 |
```
|
| 35 |
|
| 36 |
```python
|
| 37 |
+
# quickstart.py: llama.cpp backbone + Laya head from the sibling head file
|
| 38 |
import types, requests, torch, laya
|
| 39 |
+
from laya_head import load_head
|
| 40 |
|
| 41 |
+
HEAD = "laya-head.safetensors"
|
| 42 |
agent = laya.load("convaiinnovations/laya", device="cpu") # builds the head architecture + tokenizer/prompt logic
|
| 43 |
|
| 44 |
+
# swap in the decision-head weights from the head file
|
| 45 |
+
_, head = load_head(HEAD)
|
| 46 |
sd = agent.model.state_dict()
|
| 47 |
for k, v in head.items():
|
| 48 |
+
if k in sd: sd[k].copy_(v)
|
| 49 |
|
| 50 |
# swap the PyTorch encoder for the llama.cpp server
|
| 51 |
D = agent.model.encoder.config.hidden_size
|
laya-F16.gguf
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f10551bbe259518d7b00f2b9e5d101a1d6ac557e3f977322bfa875149dd5ddc9
|
| 3 |
+
size 791461088
|
laya-Q4_K_M.gguf
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:37c331ded9b71542541692c877e60452f873f430ef405c5158257e130bd890d7
|
| 3 |
+
size 272208608
|
laya-Q6_K.gguf
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8b084f58fba1c362611f09a84dbe7b09a6eb6b40d62dce03408a1c0d7e195cc8
|
| 3 |
+
size 344031968
|
laya-Q8_0.gguf
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:76a5787a9c853d04db4ff214ae31fe2bd51aa15c8bef2fc886a3493f3c136dae
|
| 3 |
+
size 421407968
|
laya-head.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1ec428e034614c9373ebcf3fdc255d8eafcc04be9b2f0c2ffeef92bb1361b83
|
| 3 |
+
size 106052840
|
laya_gguf.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
"""Read the Laya decision head out of a laya GGUF (stored as base64 f32 KV strings)."""
|
| 2 |
-
import base64, json, sys
|
| 3 |
-
import numpy as np
|
| 4 |
-
from gguf import GGUFReader
|
| 5 |
-
|
| 6 |
-
def _s(f): return bytes(f.parts[f.data[0]]).decode()
|
| 7 |
-
|
| 8 |
-
def load_head(path):
|
| 9 |
-
"""-> (config dict, {tensor_name: np.float32 array}); names match the original PyTorch state_dict."""
|
| 10 |
-
r = GGUFReader(path); cfg = None; head = {}
|
| 11 |
-
for k, f in r.fields.items():
|
| 12 |
-
if k == "laya.config": cfg = json.loads(_s(f))
|
| 13 |
-
elif k.startswith("laya.head.") and not k.endswith(".shape"):
|
| 14 |
-
n = k[len("laya.head."):]
|
| 15 |
-
shape = json.loads(_s(r.fields[k + ".shape"]))
|
| 16 |
-
head[n] = np.frombuffer(base64.b64decode(_s(f)), np.float32).reshape(shape)
|
| 17 |
-
return cfg, head
|
| 18 |
-
|
| 19 |
-
if __name__ == "__main__":
|
| 20 |
-
cfg, h = load_head(sys.argv[1]); print(len(h), "head tensors;", list(cfg)[:5])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
laya_head.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Load the Laya decision head + config from <name>-head.safetensors (sits next to the GGUF backbone)."""
|
| 2 |
+
import json, sys
|
| 3 |
+
from safetensors import safe_open
|
| 4 |
+
|
| 5 |
+
def load_head(path):
|
| 6 |
+
"""-> (config dict, {tensor_name: torch.float32 tensor}); names match the original PyTorch state_dict."""
|
| 7 |
+
with safe_open(path, "pt") as f:
|
| 8 |
+
cfg = json.loads(f.metadata()["laya.config"])
|
| 9 |
+
return cfg, {k: f.get_tensor(k) for k in f.keys()}
|
| 10 |
+
|
| 11 |
+
if __name__ == "__main__":
|
| 12 |
+
cfg, h = load_head(sys.argv[1]); print(len(h), "head tensors;", list(cfg)[:5])
|