Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -9,39 +9,34 @@ tags:
|
|
| 9 |
- bdh
|
| 10 |
- fast-weights
|
| 11 |
- polish
|
| 12 |
-
-
|
| 13 |
base_model: pathwaycom/bdh
|
| 14 |
datasets:
|
| 15 |
- SlayerLab/polish-dynaword-mix
|
| 16 |
-
|
| 17 |
---
|
| 18 |
-
# BDH-25M-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
wytrenowany na czystym, polskim mixie **SlayerLab/polish-dynaword-mix**
|
| 22 |
-
(100M tokenów, byte-level).
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
- `BDH`
|
| 27 |
- `n_layer=8, n_embd=256, n_head=4, mlp_internal_dim_multiplier=128`
|
| 28 |
-
- Vocab: **byte-level (vocab 256)** —
|
| 29 |
-
- **~25.3M
|
| 30 |
-
- Key feature: `Q==K` (fast
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
- **
|
| 35 |
-
- **
|
| 36 |
-
- **
|
| 37 |
|
| 38 |
-
##
|
| 39 |
|
| 40 |
-
|
| 41 |
-
ale stanowi działający baseline: generuje gramatycznie poprawne polskie zdania i
|
| 42 |
-
demonstruje, że architektura BDH trenuje i generuje poprawnie end-to-end.
|
| 43 |
|
| 44 |
-
##
|
| 45 |
|
| 46 |
```python
|
| 47 |
import torch
|
|
@@ -55,17 +50,17 @@ model.load_state_dict({k.replace("model.", ""): v
|
|
| 55 |
for k, v in load_file("model.safetensors").items()}, strict=True)
|
| 56 |
model.eval()
|
| 57 |
|
| 58 |
-
# byte-level prompt (
|
| 59 |
prompt = "Warszawa jest stolicą Polski i "
|
| 60 |
ids = torch.tensor([list(prompt.encode("utf-8"))])
|
| 61 |
-
# ...
|
| 62 |
```
|
| 63 |
|
| 64 |
-
##
|
| 65 |
|
| 66 |
-
- `model.safetensors` —
|
| 67 |
-
- `config.json` —
|
| 68 |
|
| 69 |
-
##
|
| 70 |
|
| 71 |
-
|
|
|
|
| 9 |
- bdh
|
| 10 |
- fast-weights
|
| 11 |
- polish
|
| 12 |
+
- language-model
|
| 13 |
base_model: pathwaycom/bdh
|
| 14 |
datasets:
|
| 15 |
- SlayerLab/polish-dynaword-mix
|
|
|
|
| 16 |
---
|
| 17 |
+
# BDH-25M-PL — Polish Looped-Transformer (Fast-Weight) Language Model
|
| 18 |
|
| 19 |
+
A small, open-weight language model built on the **BDH (Fast Weight Layers)** architecture, trained on a clean Polish mix from **SlayerLab/polish-dynaword-mix** (100M tokens, byte-level).
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
## Architecture
|
| 22 |
|
| 23 |
+
- `BDH` from [pathwaycom/bdh](https://github.com/pathwaycom/bdh) — looped latent recurrence / fast weights
|
| 24 |
- `n_layer=8, n_embd=256, n_head=4, mlp_internal_dim_multiplier=128`
|
| 25 |
+
- Vocab: **byte-level (vocab 256)** — no tokenizer, works directly on UTF-8 bytes
|
| 26 |
+
- **~25.3M parameters** · seq length 2048
|
| 27 |
+
- Key feature: `Q==K` (fast weights) — the shared state acts as both key and value (localized latent recurrence)
|
| 28 |
|
| 29 |
+
## Training
|
| 30 |
|
| 31 |
+
- **Data**: `SlayerLab/polish-dynaword-mix` (100M tokens, law cap 7%, dedup, cleaned)
|
| 32 |
+
- **Steps**: 10000 · **final val loss ≈ 1.41** · byte-level (random-init baseline ≈ 5.6)
|
| 33 |
+
- **Optimizer**: ZClip + protocol B.2 (as in the BDH paper)
|
| 34 |
|
| 35 |
+
## Note on scale
|
| 36 |
|
| 37 |
+
This is a **25M model trained on 100M tokens** — per scaling laws it is **undertrained for high quality**, but it serves as a working baseline: it generates grammatically-correct Polish and demonstrates that the BDH architecture trains and generates correctly end-to-end.
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
## Quick start
|
| 40 |
|
| 41 |
```python
|
| 42 |
import torch
|
|
|
|
| 50 |
for k, v in load_file("model.safetensors").items()}, strict=True)
|
| 51 |
model.eval()
|
| 52 |
|
| 53 |
+
# byte-level prompt (no tokenizer)
|
| 54 |
prompt = "Warszawa jest stolicą Polski i "
|
| 55 |
ids = torch.tensor([list(prompt.encode("utf-8"))])
|
| 56 |
+
# ... autoregressive loop, one byte at a time with softmax(temp)
|
| 57 |
```
|
| 58 |
|
| 59 |
+
## Files
|
| 60 |
|
| 61 |
+
- `model.safetensors` — weights (101MB)
|
| 62 |
+
- `config.json` — hyperparameters and training metadata
|
| 63 |
|
| 64 |
+
## License
|
| 65 |
|
| 66 |
+
Weights: **CC-BY-4.0**. Architecture: MIT (pathwaycom/bdh).
|