tiny_schiller / README.md
mrkschtr's picture
Upload 95 files
0a74455 verified
metadata
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 — 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.

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

Friedrich Schiller

Corpus

~2.07 MB · 11 works · 2,019,857 characters · sourced from DraCor / GerDraCor (CC0). See 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

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

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:

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:

# 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):

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

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:

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 for details.

Citation

@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.}
}