File size: 4,234 Bytes
0a74455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
language:
- de
license:
- cc0-1.0
license_details: "Corpus text is sourced from DraCor's GerDraCor export (CC0). Underlying works (Schiller, d. 1805) are public domain. Code/docs are MIT (see LICENSE)."
task_categories:
- text-generation
pretty_name: tiny_schiller
size_categories:
- 1M<n<10M
---

# tiny_schiller

A small (~2 MB) German-language analogue to Karpathy's [tiny_shakespeare](https://huggingface.co/datasets/karpathy/tiny_shakespeare) — 11 of Friedrich Schiller's dramatic works, cleaned and tokenised for tutorial-scale language models.

For a compact, agent-friendly summary (file inventory, load patterns, licensing), see [DATA_CARD.md](DATA_CARD.md).

*"Das Leben ist nur ein Moment, der Tod ist auch nur einer."* — Friedrich Schiller

![Friedrich Schiller](https://raw.githubusercontent.com/schutera/tiny_schiller/main/schiller_thug.gif)

## Corpus

~2.07 MB · 11 works · 2,019,857 characters · sourced from DraCor / GerDraCor (CC0). See [LICENSING.md](LICENSING.md) for details.

| Tokenizer | Tokens | chars/token |
|---|---|---|
| character-level | 2,019,857 | 1.00 |
| GPT-2 BPE | 854,611 | 2.36 |
| `cl100k_base` | 642,593 | 3.14 |

Use **character-level** for teaching-scale models (88-token vocab, no tokenizer needed). Use **cl100k** over GPT-2 when sequence length matters — German umlauts and compounds tokenise 25% more efficiently.

## Works

- Die Räuber
- Die Verschwörung des Fiesco zu Genua
- Kabale und Liebe
- Don Carlos, Infant von Spanien
- Wallensteins Lager
- Maria Stuart
- Die Jungfrau von Orleans
- Die Braut von Messina oder Die feindlichen Brüder
- Wilhelm Tell
- Die Piccolomini
- Wallensteins Tod

## Quick Start — nanoGPT

```bash
python schiller_char/prepare.py    # char-level, 88-vocab
python schiller_bpe/prepare.py     # GPT-2 BPE, 50k vocab
python schiller_cl100k/prepare.py  # cl100k, 100k vocab
```

## HuggingFace Datasets

```python
from datasets import load_dataset

ds = load_dataset("mrkschtr/tiny_schiller")
print(ds["train"][0]["title"])
print(ds["train"][0]["text"][:200])
```

9 works in train, 2 in test (Wilhelm Tell, Die Braut von Messina). Each row is one complete work with `title` and `text` fields.

## Instruction & Character Datasets

Pre-built instruction-format parquet files are in `data/` on the Hub.

**General dialogue style** — 7,607 examples teaching Schiller's dramatic register:
```python
ds = load_dataset("mrkschtr/tiny_schiller", data_files="data/instruct.parquet", split="train")
print(ds[0]["prompt"])
print(ds[0]["completion"])
```

**Per-character** — fine-tune a model to respond as a specific character:
```python
# 330 examples as Wallenstein · 325 as Carlos · 313 as Fiesco
# 237 as Marquis · 195 as Ferdinand · 194 as Königin · ...
ds = load_dataset("mrkschtr/tiny_schiller", data_files="data/char_WALLENSTEIN.parquet", split="train")
```

Rebuild locally (generates `data/instruct.parquet` + 89 `data/char_*.parquet` files by default):
```bash
python scripts/build_instruct.py               # all characters
python scripts/build_instruct.py --list-characters   # show available characters + turn counts
python scripts/build_instruct.py --character KARL    # single character only
```

## Fine-tuning small LLMs

```bash
pip install transformers trl datasets accelerate
python examples/finetune_sft.py --model TinyLlama/TinyLlama-1.1B-Chat-v1.0
```

Default context window is 2048 tokens. Match your model with `--context_length`:

```bash
python examples/finetune_sft.py --model microsoft/Phi-3-mini-4k-instruct --context_length 4096
python examples/finetune_sft.py --model Qwen/Qwen2.5-0.5B --context_length 4096
```

Tested: TinyLlama 1.1B · Phi-3 Mini 3.8B · Llama 3.2 1B/3B · Qwen2.5 0.5B–3B.

## License

Text: public domain (Schiller died 1805) and sourced from DraCor / GerDraCor under CC0. See [LICENSING.md](LICENSING.md) for details.

## Citation

```bibtex
@misc{schutera2023tinyschiller,
  author       = {Schutera, Mark},
  title        = {tiny\_schiller: a small German Schiller corpus for small language models},
  year         = {2023},
  howpublished = {\url{https://github.com/schutera/tiny_schiller}},
  note         = {Source texts: DraCor / GerDraCor (CC0) and public domain.}
}
```