model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
datasets:
|
| 5 |
+
- disco-jack-basement/byob-pd-book-corpus
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
- fr
|
| 9 |
+
- de
|
| 10 |
+
- it
|
| 11 |
+
- es
|
| 12 |
+
- pt
|
| 13 |
+
- nl
|
| 14 |
+
- sv
|
| 15 |
+
- da
|
| 16 |
+
- 'no'
|
| 17 |
+
- fi
|
| 18 |
+
- pl
|
| 19 |
+
- hu
|
| 20 |
+
- cs
|
| 21 |
+
- la
|
| 22 |
+
- el
|
| 23 |
+
- grc
|
| 24 |
+
- uk
|
| 25 |
+
tags:
|
| 26 |
+
- pytorch
|
| 27 |
+
- gpt
|
| 28 |
+
- transformer
|
| 29 |
+
- character-level
|
| 30 |
+
- language-model
|
| 31 |
+
- from-scratch
|
| 32 |
+
- public-domain
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
# letterpress - trained character-level GPTs
|
| 36 |
+
|
| 37 |
+
The trained checkpoints of [letterpress](https://github.com/Novotarskyi/letterpress),
|
| 38 |
+
a character-level GPT built from scratch in PyTorch (following Karpathy's "Let's
|
| 39 |
+
build GPT" lecture) and trained on nested tiers of a public-domain book corpus.
|
| 40 |
+
These are **base models**: they continue text in the style of the books they read,
|
| 41 |
+
one character at a time - they are not chatbots and do not follow instructions.
|
| 42 |
+
|
| 43 |
+
(The checkpoint files keep the model family's historical name `byob-lm` - the
|
| 44 |
+
letterpress repo was formerly `byob_llm` - so paths, benchmark reports, and the
|
| 45 |
+
companion dataset stay stable.)
|
| 46 |
+
|
| 47 |
+
## Models
|
| 48 |
+
|
| 49 |
+
| tier | params | layers x width | context | vocab | best val loss | held-out bpc | wikitext bpc | file |
|
| 50 |
+
|---|--:|---|--:|--:|--:|--:|--:|---|
|
| 51 |
+
| `nano` | 0.82M | 4 x 128 | 128 | 65 | - | **2.68** | 4.09 | `nano/shakespeare-nano.pt` |
|
| 52 |
+
| `medium` | 25.4M | 8 x 512 | 256 | 97 | 1.2278 | **1.69** | 2.91 | `medium/byob-lm.best.pt` |
|
| 53 |
+
| `large` | 49.7M | 10 x 640 | 384 | 198 | 1.1111 | **1.57** | 2.30 | `large/byob-lm.best.pt` |
|
| 54 |
+
| `xlarge` | 99.9M | 14 x 768 | 512 | 199 | 0.9411 | **1.31** | 1.88 | `xlarge/byob-lm.best.pt` |
|
| 55 |
+
| `2xlarge` | 202M | 16 x 1024 | 512 | 204 | 0.8725 | **1.17** | 1.71 | `2xlarge/byob-lm.best.pt` |
|
| 56 |
+
|
| 57 |
+
Held-out bpc = bits-per-char on public-domain books absent from every training
|
| 58 |
+
tier; wikitext = out-of-domain. Both measured by the repo's bundled `lm_bench`
|
| 59 |
+
harness (seed 1337, byte-normalized); full scorecards live in the repo under
|
| 60 |
+
`lm_bench/benchmarks/`. Lower is better; the corpus tiers are nested, so every
|
| 61 |
+
gain down the table is scale, not data luck.
|
| 62 |
+
|
| 63 |
+
## How to use
|
| 64 |
+
|
| 65 |
+
The checkpoints are self-describing (`{model, config, stoi, itos}`, optimizer
|
| 66 |
+
state stripped) but unpickle the letterpress `GPTConfig`, so you need the repo's
|
| 67 |
+
source next to them:
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
git clone https://github.com/Novotarskyi/letterpress.git && cd letterpress
|
| 71 |
+
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
|
| 72 |
+
hf download disco-jack-basement/letterpress 2xlarge/byob-lm.best.pt --local-dir models
|
| 73 |
+
|
| 74 |
+
.venv/bin/python -m inference.sample --ckpt models/2xlarge/byob-lm.best.pt --prompt "ROMEO:"
|
| 75 |
+
.venv/bin/python -m inference.interact --ckpt models/2xlarge/byob-lm.best.pt
|
| 76 |
+
cd lm_bench && ../.venv/bin/python -m lm_bench run --model byob:../models/2xlarge/byob-lm.best.pt --tasks core
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## Training provenance
|
| 80 |
+
|
| 81 |
+
- **nano** - Tiny Shakespeare (1.1M chars); the lecture demo, trained locally
|
| 82 |
+
- **medium** - medium tier (523M chars); Apple-Silicon MPS, ~1 h
|
| 83 |
+
- **large** - large tier (1.08B chars); Apple-Silicon MPS, ~3.5 h
|
| 84 |
+
- **xlarge** - xlarge tier (2.05B chars); rented H100 SXM, ~2.5 h
|
| 85 |
+
- **2xlarge** - 2xlarge tier (4.26B chars); rented H200, ~12.6 h
|
| 86 |
+
|
| 87 |
+
Each `<tier>/` folder here also carries the archive's provenance files
|
| 88 |
+
(context.md with the full hyperparameters and val curve, corpus_stats.txt,
|
| 89 |
+
corpus.lock.json, corpus_index.md) where the archive has them.
|
| 90 |
+
|
| 91 |
+
## Data
|
| 92 |
+
|
| 93 |
+
Trained exclusively on the companion public-domain corpus
|
| 94 |
+
[`disco-jack-basement/byob-pd-book-corpus`](https://huggingface.co/datasets/disco-jack-basement/byob-pd-book-corpus)
|
| 95 |
+
(CC0; Project Gutenberg, Standard Ebooks, Internet Archive, Wikisource), curated
|
| 96 |
+
under a strict, code-enforced no-Russian-content rule.
|
| 97 |
+
|
| 98 |
+
## License
|
| 99 |
+
|
| 100 |
+
Code and weights: MIT. The training corpus is CC0 and published separately.
|