Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- nl
|
| 4 |
+
- en
|
| 5 |
+
license: mit
|
| 6 |
+
tags:
|
| 7 |
+
- causal-lm
|
| 8 |
+
- historical
|
| 9 |
+
- dutch
|
| 10 |
+
- 19th-century
|
| 11 |
+
- nanochat
|
| 12 |
+
datasets:
|
| 13 |
+
- fdeantoni/max-babbelaar-corpus
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Max Babbelaar — Base Model
|
| 17 |
+
|
| 18 |
+
Pretrained base language model for **Max Babbelaar**, a bilingual (Dutch + English) character
|
| 19 |
+
modelled on a 19th-century Dutch gentleman. Trained on public-domain texts from 1750–1899:
|
| 20 |
+
DBNL, Delpher Kranten, DutchDraCor, Project Gutenberg Dutch, and British Library Books.
|
| 21 |
+
Full corpus details and token counts: [fdeantoni/max-babbelaar-corpus](https://huggingface.co/datasets/fdeantoni/max-babbelaar-corpus).
|
| 22 |
+
|
| 23 |
+
This repo holds base checkpoints for multiple model depths. Each tag (`d18`, `d24`, …)
|
| 24 |
+
lives under `base_checkpoints/<tag>/` and shares a single tokenizer.
|
| 25 |
+
|
| 26 |
+
## Latest upload: `d18` at step 6000
|
| 27 |
+
|
| 28 |
+
| Depth | Step | Layers | d_model | Heads (Q/KV) | Vocab | Context |
|
| 29 |
+
|-------|------|--------|---------|--------------|-------|---------|
|
| 30 |
+
| `d18` | 6000 | 18 | 1152 | 9/9 | 32768 | 2048 |
|
| 31 |
+
|
| 32 |
+
Architecture: GPT with RoPE, QK-norm, GQA, relu² MLP, sliding-window pattern `SSSL`,
|
| 33 |
+
value embeddings (ResFormer-style), smear gate, and backout residual. Trained with the
|
| 34 |
+
[nanochat](https://github.com/tventurella/nanochat) fork.
|
| 35 |
+
|
| 36 |
+
## Repo layout
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
+
base_checkpoints/
|
| 40 |
+
<tag>/
|
| 41 |
+
model_<step>.pt — model weights (torch state dict, bf16)
|
| 42 |
+
meta_<step>.json — GPTConfig + training metadata
|
| 43 |
+
tokenizer/
|
| 44 |
+
tokenizer.pkl — tiktoken BPE encoding (vocab 32768, rustbpe-trained)
|
| 45 |
+
token_bytes.pt — per-token byte tensors (needed by SFT dataloader)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## Download and resume SFT
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
from huggingface_hub import snapshot_download
|
| 52 |
+
import os
|
| 53 |
+
|
| 54 |
+
snapshot_download(
|
| 55 |
+
repo_id="fdeantoni/max-babbelaar-base",
|
| 56 |
+
repo_type="model",
|
| 57 |
+
allow_patterns=["base_checkpoints/d18/**", "tokenizer/**"],
|
| 58 |
+
local_dir=os.path.expanduser("~/.cache/nanochat"),
|
| 59 |
+
local_dir_use_symlinks=False,
|
| 60 |
+
)
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
Then resume SFT from the restored checkpoint:
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
NANOCHAT_BASE_DIR=~/.cache/nanochat \
|
| 67 |
+
torchrun --standalone --nproc_per_node=N \
|
| 68 |
+
-m scripts.chat_sft \
|
| 69 |
+
--model-tag=d18 \
|
| 70 |
+
--sft-file /path/to/sft_train.jsonl
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Tokenizer
|
| 74 |
+
|
| 75 |
+
Custom GPT-4-style BPE tokenizer with vocab size 32768, trained on the Babbelaar corpus.
|
| 76 |
+
Special tokens: `<|bos|>` `<|user_start|>` `<|user_end|>` `<|assistant_start|>` `<|assistant_end|>`
|
| 77 |
+
`<|python_start|>` `<|python_end|>` `<|output_start|>` `<|output_end|>`.
|
| 78 |
+
|
| 79 |
+
Stored as a tiktoken pickle at `tokenizer/tokenizer.pkl`. Load within the nanochat project with:
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
from nanochat.tokenizer import get_tokenizer # reads NANOCHAT_BASE_DIR/tokenizer/tokenizer.pkl
|
| 83 |
+
tokenizer = get_tokenizer()
|
| 84 |
+
```
|