tiny_schiller / DATA_CARD.md
mrkschtr's picture
Upload 95 files
0a74455 verified
# DATA_CARD — tiny_schiller (agent-ready)
This file is a compact, copy/paste-friendly summary of the **tiny_schiller** corpus and how to load it.
## What this is
- **Corpus**: 11 public-domain dramatic works by Friedrich Schiller (German)
- **Goal**: a *drop-in* German analogue to Karpathy’s *tiny_shakespeare* for small-LM prototyping, fine-tuning, and education
- **Release artifact**: a cleaned, single UTF-8 text file + deterministic preprocessing scripts
## Quantitative summary
**Corpus file (cleaned)**
- File: `tiny_schiller.parsed.txt`
- Characters: 2,019,857
- Bytes (UTF-8): 2,067,041 (~2.07 MB)
- Encoding: UTF-8 (no BOM)
- Line endings: LF
- Unique codepoints: 88
- Guillemets `«` / `»`: 101 / 101
- Works: 11
**Precomputed token streams (90/10 train/val)**
- `schiller_char/`
- Vocab: 88
- Train tokens: 1,817,871
- Val tokens: 201,986
- chars/token: 1.00
- `schiller_bpe/` (GPT-2 BPE)
- Vocab: 50,257
- Train tokens: 768,768
- Val tokens: 85,844
- Total tokens: 854,611
- chars/token: 2.36
- `schiller_cl100k/` (`cl100k_base`)
- Vocab: ~100k
- Train tokens: 578,182
- Val tokens: 64,412
- Total tokens: 642,593
- chars/token: 3.14
**Fine-tuning parquet files (Hub: `data/`)**
- Whole-work split: `data/train.parquet`, `data/test.parquet`
- Rows: 9 train works, 2 test works
- Fields: `title`, `text`
- Instruction-formatted dialogue completion: `data/instruct.parquet`
- Rows: 7,607
- Fields: `prompt`, `completion`, `work`, `character`
- Per-character persona splits: `data/char_*.parquet`
- Files: 89
- Example row counts: `char_WALLENSTEIN.parquet` 264, `char_CARLOS.parquet` 235, `char_MOOR.parquet` 130
**Reference fine-tune (paper)**
- Model: `Qwen/Qwen2.5-0.5B-Instruct` (494M params)
- Hardware: NVIDIA RTX 3060 (12 GB VRAM), bf16
- Stage 1: 2 epochs on `instruct.parquet`, batch 4, context 512, lr 2e-4
- Stage 2: 2 epochs on `char_MOOR.parquet`, lr 1e-4, weight decay 0.05
- Wall-clock time: ~2.7 hours total (~2.6 h stage 1, <3 min stage 2)
- Reported outcome: 99.05% token accuracy, entropy 0.055 (two epochs, weight decay 0.05)
- Recipe: `examples/reference_finetune.py` (two-stage run)
## Canonical text file
- `tiny_schiller.parsed.txt`
- UTF-8, no BOM
- LF line endings
- Canonical speaker turns in the form `SPEAKER:\ntext`
## Precomputed tokenization splits
These match common small-LM workflows (e.g. nanoGPT-style `train.bin`/`val.bin`).
- `schiller_char/` — character-level (88 unique characters)
- `schiller_bpe/` — GPT-2 BPE via `tiktoken`
- `schiller_cl100k/``cl100k_base` via `tiktoken`
Build locally:
```bash
python schiller_char/prepare.py
python schiller_bpe/prepare.py
python schiller_cl100k/prepare.py
```
## HuggingFace datasets (whole works)
Dataset id: `mrkschtr/tiny_schiller`
Each row is one work with at least `title` and `text` fields.
```python
from datasets import load_dataset
ds = load_dataset("mrkschtr/tiny_schiller")
print(ds["train"][0]["title"])
print(ds["train"][0]["text"][:200])
```
Split policy (paper/README): train holds out **Wilhelm Tell** and **Die Braut von Messina** as test.
## Instruction + per-character persona splits (parquet)
These ship on the Hub under `data/`.
- General dialogue-completion: `data/instruct.parquet` (7,607 rows)
- Per-character persona files: `data/char_*.parquet` (89 files)
Schema per row:
- `prompt`: instruction template + preceding context turns
- `completion`: next speaker turn in `NAME:\ntext` format
- `work`: work title
- `character`: normalized speaker id (uppercase, underscores)
Load examples:
```python
from datasets import load_dataset
# Instruction-formatted dialogue completions
ins = load_dataset(
"mrkschtr/tiny_schiller",
data_files="data/instruct.parquet",
split="train",
)
# One character persona dataset
moor = load_dataset(
"mrkschtr/tiny_schiller",
data_files="data/char_MOOR.parquet",
split="train",
)
```
Rebuild locally (writes to `data/` by default):
```bash
python scripts/build_instruct.py
python scripts/build_instruct.py --list-characters
python scripts/build_instruct.py --character MOOR
```
## Intended use
- Rapid prototyping of model/training/tokenization choices under tight compute
- Stylistic fine-tuning on a homogeneous German literary register
- Per-character persona fine-tuning using the prebuilt `char_*.parquet` splits
- Education and reproducibility baselines on a non-English “tiny corpus”
## Licensing (read this)
- **Text content** (`tiny_schiller.txt`, `tiny_schiller.parsed.txt`): public domain (Schiller died 1805) and redistributed from DraCor / GerDraCor under CC0
- **Code + documentation** (everything else, incl. scripts and this file): MIT
See `LICENSING.md` for details and links to the upstream CC0 claim.