kacperwikiel commited on
Commit
25bc949
·
verified ·
1 Parent(s): a071c11

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +22 -27
README.md CHANGED
@@ -9,39 +9,34 @@ tags:
9
  - bdh
10
  - fast-weights
11
  - polish
12
- - lang-200m
13
  base_model: pathwaycom/bdh
14
  datasets:
15
  - SlayerLab/polish-dynaword-mix
16
-
17
  ---
18
- # BDH-25M-<span>PL</span> — Polish Looped-Transformer (Fast-Weight) Language Model
19
 
20
- Mały, otwarty model językowy z **architekturą BDH (Fast Weight Layers)**,
21
- wytrenowany na czystym, polskim mixie **SlayerLab/polish-dynaword-mix**
22
- (100M tokenów, byte-level).
23
 
24
- ## Architektura
25
 
26
- - `BDH` z [pathwaycom/bdh](https://github.com/pathwaycom/bdh) — looped latent-recurrence / fast weights
27
  - `n_layer=8, n_embd=256, n_head=4, mlp_internal_dim_multiplier=128`
28
- - Vocab: **byte-level (vocab 256)** — brak tokenizera, działa bezpośrednio na UTF-8 bajtach
29
- - **~25.3M parametrów** · seq 2048
30
- - Key feature: `Q==K` (fast-weights) — współdzielony stan jako klucz i wartość (locality latent recurrence)
31
 
32
- ## Trening
33
 
34
- - **Dane**: `SlayerLab/polish-dynaword-mix` (100M tokenów, law cap 7%, dedup, clean)
35
- - **Kroki**: 10000 · **final val loss ~1.41** · byte-level (lat 5.6 dla losowych wag)
36
- - **Zoptymalizowany**: ZClip + protocol B.2 (jak w paperze BDH)
37
 
38
- ## Uwaga o skali
39
 
40
- To **model 25M na 100M tokenów** — zgodnie ze scaling laws jest **niedoćwiczony jakościowo**,
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
- ## Szybki start
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 (bez tokenizera)
59
  prompt = "Warszawa jest stolicą Polski i "
60
  ids = torch.tensor([list(prompt.encode("utf-8"))])
61
- # ... pętla generowania po jednym bajcie z softmax(temp)
62
  ```
63
 
64
- ## Pliki
65
 
66
- - `model.safetensors` — wagi (101MB)
67
- - `config.json` — hyperparametry i metadane treningu
68
 
69
- ## Licencja
70
 
71
- Wagi: **CC-BY-4.0**. Architektura: MIT (pathwaycom/bdh).
 
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).