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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license:
|
| 3 |
+
- other # source content: public domain (Schiller, d. 1805)
|
| 4 |
+
- mit # pipeline code (this repo)
|
| 5 |
+
language:
|
| 6 |
+
- de
|
| 7 |
+
multilinguality:
|
| 8 |
+
- monolingual
|
| 9 |
+
size_categories:
|
| 10 |
+
- 1M<n<10M
|
| 11 |
+
source_datasets:
|
| 12 |
+
- original
|
| 13 |
+
task_categories:
|
| 14 |
+
- text-generation
|
| 15 |
+
- fill-mask
|
| 16 |
+
task_ids:
|
| 17 |
+
- language-modeling
|
| 18 |
+
- masked-language-modeling
|
| 19 |
+
pretty_name: tiny_schiller
|
| 20 |
+
tags:
|
| 21 |
+
- literature
|
| 22 |
+
- drama
|
| 23 |
+
- german
|
| 24 |
+
- 19th-century
|
| 25 |
+
- public-domain
|
| 26 |
+
- schiller
|
| 27 |
+
- tiny-language-models
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
# Dataset Card for tiny_schiller
|
| 31 |
+
|
| 32 |
+
> *"Das Leben ist nur ein Moment, der Tod ist auch nur einer!"* — Friedrich Schiller
|
| 33 |
+
|
| 34 |
+
## Dataset Description
|
| 35 |
+
|
| 36 |
+
`tiny_schiller` is a small (~2 MB) plain-text corpus of Friedrich Schiller's
|
| 37 |
+
dramatic works, intended as a German-language analogue to Andrej Karpathy's
|
| 38 |
+
[`tiny_shakespeare`](https://huggingface.co/datasets/tiny_shakespeare). It is
|
| 39 |
+
sized for tutorial-scale language models — character-level RNNs, small
|
| 40 |
+
GPT-style transformers, BPE tokenizer experiments — where the goal is
|
| 41 |
+
reproducibility and pedagogy, not state-of-the-art benchmarking.
|
| 42 |
+
|
| 43 |
+
The corpus is a single concatenated file containing 13 works
|
| 44 |
+
(10 dramas, the unfinished *Demetrius* scenario, plus *Briefe über Don Carlos*), drawn from Projekt
|
| 45 |
+
Gutenberg-DE.
|
| 46 |
+
|
| 47 |
+
- **Curated by:** Mark Schutera (`schutera`)
|
| 48 |
+
- **Languages:** German (de), 19th-century editorial orthography
|
| 49 |
+
- **License:** see *Licensing Information* below — dual: source content is
|
| 50 |
+
public domain; pipeline code is MIT
|
| 51 |
+
- **Repository:** <https://github.com/schutera/tiny_schiller>
|
| 52 |
+
|
| 53 |
+
### Intended Use
|
| 54 |
+
|
| 55 |
+
**Tutorial and teaching**
|
| 56 |
+
|
| 57 |
+
- Teaching language-model fundamentals on a non-English literary corpus
|
| 58 |
+
- Tokenizer experiments (character-level, GPT-2 BPE, `cl100k_base`)
|
| 59 |
+
- Small-scale German text-generation demos and overfitting studies
|
| 60 |
+
- A drop-in replacement for `tiny_shakespeare` in lecture material
|
| 61 |
+
|
| 62 |
+
**Fine-tuning and domain adaptation**
|
| 63 |
+
|
| 64 |
+
- Continued pre-training or domain adaptation target for any fine-tuneable
|
| 65 |
+
causal LM (e.g. GPT-2, LLaMA, Mistral, Phi): the corpus is clean,
|
| 66 |
+
stylistically consistent, and free of web noise
|
| 67 |
+
- Style transfer experiments: the corpus provides a strong, distinctive
|
| 68 |
+
register (elevated 19th-century dramatic German) that can be imprinted
|
| 69 |
+
on a base model through a short fine-tuning run
|
| 70 |
+
- Persona modeling: speaker turns are tagged, so individual characters can
|
| 71 |
+
be isolated and used as instruction-tuning or RLHF preference data targets
|
| 72 |
+
- Historical-German language adaptation: useful for probing how well a model
|
| 73 |
+
generalises to pre-1901-reform orthography after fine-tuning
|
| 74 |
+
|
| 75 |
+
**Hugging Face Transformers integration**
|
| 76 |
+
|
| 77 |
+
- The corpus loads directly with `datasets.load_dataset` and works with the
|
| 78 |
+
Transformers `Trainer` / `SFTTrainer` API for causal LM fine-tuning with
|
| 79 |
+
no preprocessing beyond tokenization
|
| 80 |
+
|
| 81 |
+
**Evaluation**
|
| 82 |
+
|
| 83 |
+
- Held-out perplexity reference for German literary prose and drama: the
|
| 84 |
+
`train_test` split provides a small but stylistically coherent test set
|
| 85 |
+
that is complementary to modern German benchmarks (GermanQuAD, MLQA, etc.)
|
| 86 |
+
|
| 87 |
+
### Out-of-Scope
|
| 88 |
+
|
| 89 |
+
- Production language modeling (size and coverage are deliberately small;
|
| 90 |
+
fine-tuning a base model on this corpus alone will not produce a
|
| 91 |
+
general-purpose German assistant)
|
| 92 |
+
- Stylometry or authorship attribution (single author, single source edition)
|
| 93 |
+
- Modern German NLP evaluation (orthography is 19th-century; perplexity
|
| 94 |
+
scores are not comparable to contemporary German benchmarks)
|
| 95 |
+
- Critical / scholarly use (no annotations, no critical apparatus)
|
| 96 |
+
- Representative German prose: the corpus is overwhelmingly dramatic dialog;
|
| 97 |
+
it is not a substitute for a balanced German text corpus
|
| 98 |
+
|
| 99 |
+
## Languages
|
| 100 |
+
|
| 101 |
+
German (`de`). The text reflects the orthographic conventions of the
|
| 102 |
+
19th-century print editions used as source material — pre-1901 spelling
|
| 103 |
+
reform conventions, German chevron quotation marks (»…«), and editorial
|
| 104 |
+
punctuation that does not match contemporary Duden norms.
|
| 105 |
+
|
| 106 |
+
## Dataset Structure
|
| 107 |
+
|
| 108 |
+
### Data Instances
|
| 109 |
+
|
| 110 |
+
A single `text` field containing the concatenated corpus.
|
| 111 |
+
|
| 112 |
+
```python
|
| 113 |
+
FeaturesDict({
|
| 114 |
+
'text': Text(shape=(), dtype=string),
|
| 115 |
+
})
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### Data Fields
|
| 119 |
+
|
| 120 |
+
- `text` *(string)*: full concatenated text of all included works.
|
| 121 |
+
|
| 122 |
+
### Splits
|
| 123 |
+
|
| 124 |
+
The default release ships a single split. Two configurations are provided:
|
| 125 |
+
|
| 126 |
+
| Config | Split | Bytes (UTF-8) |
|
| 127 |
+
|----------------|---------|------------------|
|
| 128 |
+
| `default` | `train` | 2,216,450 bytes |
|
| 129 |
+
| `train_test` | `train` | ~90% of total |
|
| 130 |
+
| `train_test` | `test` | ~10% of total |
|
| 131 |
+
|
| 132 |
+
The 90/10 split is contiguous-tail (last 10% of the concatenated stream is
|
| 133 |
+
held out), matching `tiny_shakespeare` convention; it is **not** a per-work
|
| 134 |
+
split and therefore leaks within-work distribution between train and test.
|
| 135 |
+
Treat it as a sanity-check held-out, not a benchmark split.
|
| 136 |
+
|
| 137 |
+
### Line Organization
|
| 138 |
+
|
| 139 |
+
After Phase 1b cleaning, the file follows the Karpathy `tiny_shakespeare`
|
| 140 |
+
convention: each speaker turn is preceded by a SPEAKER tag on its own line,
|
| 141 |
+
followed by the spoken text. Stage directions appear inline in parentheses
|
| 142 |
+
or on their own lines, as in the source editions. Act and scene markers
|
| 143 |
+
are preserved as headings.
|
| 144 |
+
|
| 145 |
+
### Token Counts
|
| 146 |
+
|
| 147 |
+
| Tokenizer | Token count | chars/token |
|
| 148 |
+
|-----------------|---------------|-------------|
|
| 149 |
+
| character-level | 2,168,278 | 1.00 |
|
| 150 |
+
| GPT-2 BPE | 913,675 | 2.37 |
|
| 151 |
+
| `cl100k_base` | 681,548 | 3.18 |
|
| 152 |
+
|
| 153 |
+
### Tokenizer Choice
|
| 154 |
+
|
| 155 |
+
**Character-level** is the right default for tutorial use. The 97-character
|
| 156 |
+
vocabulary is small enough that an embedding table and output projection add
|
| 157 |
+
negligible parameters to a teaching-scale model. Every codepoint is
|
| 158 |
+
unambiguous — no out-of-vocabulary tokens, no merging surprises — and the
|
| 159 |
+
prepare script is a single `np.frombuffer`. This is what `tiny_shakespeare`
|
| 160 |
+
uses and why this corpus was designed to be a drop-in replacement.
|
| 161 |
+
|
| 162 |
+
**GPT-2 BPE** (`gpt2` via tiktoken) is the right choice when you want to
|
| 163 |
+
reuse a pre-trained tokenizer from Karpathy's nanoGPT tutorials without
|
| 164 |
+
modification. The 50,257-token vocabulary encodes German with 2.37
|
| 165 |
+
chars/token — noticeably worse than cl100k because GPT-2's merge table was
|
| 166 |
+
learned on English text. Umlauts (ä, ö, ü, Ä, Ö, Ü) and ß appear
|
| 167 |
+
frequently in Schiller and they fall outside the most common ASCII merges,
|
| 168 |
+
so many compound words are split more aggressively than necessary. Token ids
|
| 169 |
+
fit in `uint16` (max id 50,256), so `train.bin` / `val.bin` are compact.
|
| 170 |
+
Ready-to-use files are in `schiller_bpe/`.
|
| 171 |
+
|
| 172 |
+
**`cl100k_base`** (GPT-4 / Claude-era tokenizer) is the best choice when
|
| 173 |
+
sequence length matters — 682k tokens versus 914k for GPT-2 on the same
|
| 174 |
+
text means 25% more context per fixed-length window. The merge table was
|
| 175 |
+
trained on multilingual data and handles German compounds and umlauts much
|
| 176 |
+
more cleanly (3.18 chars/token). The trade-off: the vocabulary is ~100k
|
| 177 |
+
tokens, so ids require `uint32` rather than `uint16`, and the output
|
| 178 |
+
projection over 100k classes may be disproportionately large for a
|
| 179 |
+
tutorial-scale model. Ready-to-use files are in `schiller_cl100k/`.
|
| 180 |
+
|
| 181 |
+
**When to choose which:**
|
| 182 |
+
|
| 183 |
+
| Goal | Tokenizer |
|
| 184 |
+
|------|-----------|
|
| 185 |
+
| Drop-in for nanoGPT / makemore tutorials | character-level |
|
| 186 |
+
| Follow Karpathy's nanoGPT BPE tutorial exactly | GPT-2 BPE |
|
| 187 |
+
| Minimise sequence length / maximise context | `cl100k_base` |
|
| 188 |
+
| Cross-lingual transfer from a GPT-4-style model | `cl100k_base` |
|
| 189 |
+
| Explore tokenizer design for German | compare all three |
|
| 190 |
+
|
| 191 |
+
## Data Sources
|
| 192 |
+
|
| 193 |
+
All texts are sourced from [Projekt Gutenberg-DE](https://www.projekt-gutenberg.org/autoren/namen/schiller.html)
|
| 194 |
+
(projekt-gutenberg.org). Note: this is the German Projekt Gutenberg-DE,
|
| 195 |
+
operated by Hille & Partner / *Der Spiegel*, and is **distinct** from the
|
| 196 |
+
US-based Project Gutenberg at gutenberg.org. The two have different reuse
|
| 197 |
+
terms; see *Licensing Information* below.
|
| 198 |
+
|
| 199 |
+
Per-work source URLs are recorded in `scripts/sources.yaml`. Note: SHA-256 hashes of the original HTML are unavailable — the Projekt Gutenberg-DE site restructured in early 2026 and original chapter HTML files are no longer publicly accessible for re-verification.
|
| 200 |
+
|
| 201 |
+
Included works:
|
| 202 |
+
|
| 203 |
+
- Briefe über Don Carlos
|
| 204 |
+
- Aus dem Szenar zum »Demetrius«
|
| 205 |
+
- Demetrius
|
| 206 |
+
- Die Huldigung der Künste
|
| 207 |
+
- Die Jungfrau von Orleans
|
| 208 |
+
- Die Räuber
|
| 209 |
+
- Die Verschwörung des Fiesco zu Genua
|
| 210 |
+
- Don Carlos, Infant von Spanien
|
| 211 |
+
- Kabale und Liebe
|
| 212 |
+
- Maria Stuart
|
| 213 |
+
- Wallenstein (trilogy as published)
|
| 214 |
+
- Wilhelm Tell
|
| 215 |
+
- Die Braut von Messina
|
| 216 |
+
|
| 217 |
+
## Curation Rationale
|
| 218 |
+
|
| 219 |
+
`tiny_shakespeare` is a teaching staple because it is small, homogeneous,
|
| 220 |
+
and rich in dialog structure. There is no equally convenient German
|
| 221 |
+
counterpart. Schiller is a natural choice: a single canonical author,
|
| 222 |
+
multiple long dramas with explicit speaker turns, and a body of work
|
| 223 |
+
entirely in the public domain. The goal was a single plain-text artifact
|
| 224 |
+
that drops into existing tutorial pipelines with minimal friction, plus
|
| 225 |
+
a reproducible audit trail (sources, hashes, cleaning script).
|
| 226 |
+
|
| 227 |
+
## Considerations for Using the Data
|
| 228 |
+
|
| 229 |
+
The corpus is a single 19th-century male author writing about idealised
|
| 230 |
+
historical and political subjects; it encodes the worldview and
|
| 231 |
+
historiographic assumptions of late-Enlightenment German drama. Models
|
| 232 |
+
trained on it will reflect that distribution and should not be used to
|
| 233 |
+
generate text presented as contemporary or neutral.
|
| 234 |
+
|
| 235 |
+
- **Orthography:** pre-1901-reform German; downstream evaluation against
|
| 236 |
+
modern German benchmarks is unfair.
|
| 237 |
+
- **Quotation marks:** German chevrons »…« are preserved; tokenizers may
|
| 238 |
+
treat them as rare characters.
|
| 239 |
+
- **Dialog-heavy:** overwhelmingly dramatic dialog with speaker tags;
|
| 240 |
+
not a representative sample of German prose.
|
| 241 |
+
- **Editorial layer:** old non-critical print editions; spelling and
|
| 242 |
+
punctuation reflect the digitiser's editorial choices, not Schiller's
|
| 243 |
+
manuscripts.
|
| 244 |
+
- **Size:** ~2 MB / 11 works is a teaching toy. Schiller's poetry,
|
| 245 |
+
philosophical essays, and historical writing are excluded in v1.
|
| 246 |
+
- **Encoding artifacts:** the cleaning pipeline normalises common HTML
|
| 247 |
+
boilerplate and mojibake; residual artifacts are tracked in the audit
|
| 248 |
+
log.
|
| 249 |
+
|
| 250 |
+
## Licensing Information
|
| 251 |
+
|
| 252 |
+
This dataset has **two distinct licenses**, one for the source content
|
| 253 |
+
and one for the pipeline that produces it.
|
| 254 |
+
|
| 255 |
+
### Source content — public domain
|
| 256 |
+
|
| 257 |
+
Friedrich Schiller died on 9 May 1805. Under the EU `Schutzdauerrichtlinie`
|
| 258 |
+
(life + 70 years) and equivalent rules in the United States and the
|
| 259 |
+
United Kingdom, all of Schiller's works passed into the public domain
|
| 260 |
+
no later than 1 January 1876, and copyright in the original works has
|
| 261 |
+
not been recoverable since. The texts themselves are therefore free of
|
| 262 |
+
authorial copyright.
|
| 263 |
+
|
| 264 |
+
The print editions used as the source for the Projekt Gutenberg-DE
|
| 265 |
+
digitisations are old non-critical editions; they do not carry separate
|
| 266 |
+
editorial / critical-apparatus copyright that would survive in the body
|
| 267 |
+
text. (Modern critical / annotated editions — e.g. the *Nationalausgabe*
|
| 268 |
+
or Hanser editions — are **not** used here, and their annotations would
|
| 269 |
+
remain in copyright.)
|
| 270 |
+
|
| 271 |
+
### Pipeline code — MIT
|
| 272 |
+
|
| 273 |
+
The scripts, configuration, and documentation in this repository are
|
| 274 |
+
licensed under the MIT License (see `LICENSE`). MIT covers only the
|
| 275 |
+
code, not the textual content.
|
| 276 |
+
|
| 277 |
+
### Source-platform terms — Projekt Gutenberg-DE
|
| 278 |
+
|
| 279 |
+
Projekt Gutenberg-DE (projekt-gutenberg.org) is an independent compilation
|
| 280 |
+
operated by Hille & Partner / *Der Spiegel*, and applies its own terms
|
| 281 |
+
to redistribution of *its own digitisations* — independent of the
|
| 282 |
+
underlying public-domain status of the works. In paraphrase: the texts
|
| 283 |
+
are made available for **personal, private, non-commercial use**;
|
| 284 |
+
**redistribution of the digitised text in unaltered form requires the
|
| 285 |
+
permission of the editor** (Editor: Gunter Hille). Schools and individuals
|
| 286 |
+
may use the texts for personal, classroom, and research purposes.
|
| 287 |
+
|
| 288 |
+
This dataset takes the conservative position that:
|
| 289 |
+
|
| 290 |
+
1. The underlying works are public domain and may be re-derived from
|
| 291 |
+
any source edition, and
|
| 292 |
+
2. As a courtesy and to honour the source-platform terms, attribution
|
| 293 |
+
to Projekt Gutenberg-DE is preserved at the per-work level
|
| 294 |
+
(`scripts/sources.yaml`), and the corpus is released for research
|
| 295 |
+
and educational use.
|
| 296 |
+
|
| 297 |
+
For full details, exact wording, and the redistribution edge cases,
|
| 298 |
+
see [`LICENSING.md`](LICENSING.md).
|
| 299 |
+
|
| 300 |
+
## Citation
|
| 301 |
+
|
| 302 |
+
```bibtex
|
| 303 |
+
@misc{schutera2023tinyschiller,
|
| 304 |
+
author = {Schutera, Mark},
|
| 305 |
+
title = {tiny\_schiller: a small German Schiller corpus for tiny language models},
|
| 306 |
+
year = {2023},
|
| 307 |
+
howpublished = {\url{https://github.com/schutera/tiny_schiller}},
|
| 308 |
+
note = {Source texts: Projekt Gutenberg-DE, public domain.}
|
| 309 |
+
}
|
| 310 |
+
```
|
| 311 |
+
|
| 312 |
+
If you use the underlying texts, please also acknowledge Projekt
|
| 313 |
+
Gutenberg-DE (<https://www.projekt-gutenberg.org/>).
|
| 314 |
+
|
| 315 |
+
## Limitations
|
| 316 |
+
|
| 317 |
+
- No critical apparatus, no editorial notes, no philological annotations.
|
| 318 |
+
- No part-of-speech, lemma, or syntactic annotations.
|
| 319 |
+
- Eleven works only at v1; Schiller's poetry, ballads, philosophical
|
| 320 |
+
essays, and historical writing are not included.
|
| 321 |
+
- Encoding artifacts from the source HTML may remain after cleaning.
|
| 322 |
+
- The 90/10 split is a contiguous-tail split; not suitable as a
|
| 323 |
+
benchmark.
|
| 324 |
+
- Not intended for production language modeling, modern-German
|
| 325 |
+
evaluation, or stylometric work.
|
| 326 |
+
|
| 327 |
+
## References
|
| 328 |
+
|
| 329 |
+
- Projekt Gutenberg-DE — Schiller author page:
|
| 330 |
+
<https://www.projekt-gutenberg.org/autoren/namen/schiller.html>
|
| 331 |
+
- Projekt Gutenberg-DE — Impressum:
|
| 332 |
+
<https://www.projekt-gutenberg.org/info/impressum/impressum.html>
|
| 333 |
+
- `tiny_shakespeare` (structural template):
|
| 334 |
+
<https://huggingface.co/datasets/tiny_shakespeare>
|
| 335 |
+
- EU Directive 2006/116/EC (term of protection of copyright):
|
| 336 |
+
<https://eur-lex.europa.eu/eli/dir/2006/116/oj>
|
README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- de
|
| 4 |
+
license:
|
| 5 |
+
- cc0-1.0
|
| 6 |
+
- mit
|
| 7 |
+
license_details: "Text content (Schiller's works) is public domain (CC0). Pipeline code is MIT licensed."
|
| 8 |
+
task_categories:
|
| 9 |
+
- text-generation
|
| 10 |
+
pretty_name: tiny_schiller
|
| 11 |
+
size_categories:
|
| 12 |
+
- 1M<n<10M
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# tiny_schiller
|
| 16 |
+
|
| 17 |
+
Inspired by tiny_shakespeare, this brings you the works from the, as a matter of course, best German poet and writer - Friedrich Schiller, to your language models.
|
| 18 |
+
|
| 19 |
+
*"Das Leben ist Nur ein Moment, der Tod ist auch nur einer!" - Friedrich Schiller*
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
|
| 23 |
+
## Description
|
| 24 |
+
- Download Size: ~1,982 KB
|
| 25 |
+
- Version 1.0.0 (no release notes)
|
| 26 |
+
|
| 27 |
+
```python
|
| 28 |
+
# Feature Structure
|
| 29 |
+
FeaturesDict({
|
| 30 |
+
'text': Text(shape=(), dtype=string),
|
| 31 |
+
})
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
55,629 lines or 327,233 words or 2,028,161 characters (including spaces) of Friedrich Schiller.
|
| 35 |
+
The document comprises of the following works, originally from [Projekt Gutenberg](https://www.projekt-gutenberg.org/autoren/namen/schiller.html).
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
## Quick Start
|
| 39 |
+
|
| 40 |
+
Pick the tokenisation that fits your use case and run the corresponding prepare script — it downloads `tiny_schiller.clean.txt` automatically if needed and writes `train.bin` / `val.bin` to the same directory.
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
# Character-level (96-char vocab — smallest, best for teaching)
|
| 44 |
+
python schiller_char/prepare.py
|
| 45 |
+
|
| 46 |
+
# GPT-2 BPE (50k vocab, uint16 ids — compatible with nanoGPT defaults)
|
| 47 |
+
python schiller_bpe/prepare.py
|
| 48 |
+
|
| 49 |
+
# cl100k BPE (100k vocab, uint32 ids — 25 % fewer tokens on German text)
|
| 50 |
+
python schiller_cl100k/prepare.py
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Then point your nanoGPT config at the generated files, e.g.:
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
# in your nanoGPT train.py or config
|
| 57 |
+
dataset = 'schiller_char' # or schiller_bpe / schiller_cl100k
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
See [`DATA_CARD.md`](DATA_CARD.md) for corpus statistics, tokenizer comparison, and licensing details.
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
## HuggingFace Datasets
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from datasets import load_dataset
|
| 67 |
+
|
| 68 |
+
# Full corpus as a single text field
|
| 69 |
+
ds = load_dataset("schutera/tiny_schiller")
|
| 70 |
+
|
| 71 |
+
# 90/10 train / test split (contiguous tail, same convention as tiny_shakespeare)
|
| 72 |
+
ds = load_dataset("schutera/tiny_schiller", "train_test")
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
## Fine-tuning small LLMs
|
| 77 |
+
|
| 78 |
+
The corpus works as a continued pre-training or domain adaptation target for any
|
| 79 |
+
causal LM. An end-to-end example using TRL `SFTTrainer` is in
|
| 80 |
+
[`examples/finetune_sft.py`](examples/finetune_sft.py):
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
pip install transformers trl datasets accelerate
|
| 84 |
+
python examples/finetune_sft.py --model TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
The default context window is **2048 tokens**. Pass `--context_length` to match your model's actual window — there is no config file, just one flag:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
python examples/finetune_sft.py --model microsoft/Phi-3-mini-4k-instruct --context_length 4096
|
| 91 |
+
python examples/finetune_sft.py --model Qwen/Qwen2.5-0.5B --context_length 4096
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
To pre-chunk the corpus to a JSONL file instead:
|
| 95 |
+
|
| 96 |
+
```bash
|
| 97 |
+
python scripts/chunk.py --size 2048 # gpt2 tokenizer, default
|
| 98 |
+
python scripts/chunk.py --size 4096 --tokenizer cl100k_base
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
Tested model targets: TinyLlama 1.1B, Phi-3 Mini 3.8B, Llama 3.2 1B/3B, Qwen2.5 0.5B–3B.
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
## Dramen und begleitende Schriften:
|
| 105 |
+
- Briefe über Don Carlos
|
| 106 |
+
- Aus dem Szenar zum »Demetrius«
|
| 107 |
+
- Demetrius
|
| 108 |
+
- Die Huldigung der Künste
|
| 109 |
+
- Die Jungfrau von Orleans
|
| 110 |
+
- Die Räuber
|
| 111 |
+
- Die Verschwörung des Fiesco zu Genua
|
| 112 |
+
- Don Carlos, Infant von Spanien
|
| 113 |
+
- Kabale und Liebe
|
| 114 |
+
- Maria Stuart
|
| 115 |
+
- Wallenstein
|
| 116 |
+
- Wilhelm Tell
|
| 117 |
+
|
| 118 |
+
## Citation
|
| 119 |
+
|
| 120 |
+
In conclusion, the works of Friedrich Schiller are a valuable contribution to literature, and this project aims to make them more accessible to language models. We hope you find this resource useful for your research and creative endeavors.
|
| 121 |
+
|
| 122 |
+
If you use this work in your research or projects, please cite it as follows:
|
| 123 |
+
|
| 124 |
+
```markdown
|
| 125 |
+
@misc{schutera2023tinyschiller,
|
| 126 |
+
author = {Schutera, Mark},
|
| 127 |
+
title = {tiny\_schiller: a small German Schiller corpus for tiny language models},
|
| 128 |
+
year = {2023},
|
| 129 |
+
howpublished = {\url{https://github.com/schutera/tiny_schiller}},
|
| 130 |
+
note = {Source texts: Projekt Gutenberg-DE, public domain.}
|
| 131 |
+
}
|
| 132 |
+
```
|
tiny_schiller.clean.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tiny_schiller.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2023 Mark Schutera. Licensed under MIT (pipeline code); text is public domain.
|
| 3 |
+
#
|
| 4 |
+
# Modelled after the tiny_shakespeare HuggingFace dataset loading script:
|
| 5 |
+
# https://huggingface.co/datasets/tiny_shakespeare
|
| 6 |
+
|
| 7 |
+
"""tiny_schiller — a small German Schiller corpus for tiny language models."""
|
| 8 |
+
|
| 9 |
+
import datasets
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
_DESCRIPTION = """\
|
| 13 |
+
A clean, concatenated plain-text corpus of Friedrich Schiller's works, assembled
|
| 14 |
+
for training tiny character-level and subword language models. The source texts
|
| 15 |
+
are in the public domain (Projekt Gutenberg-DE); the pipeline code is MIT-licensed.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
_HOMEPAGE = "https://github.com/schutera/tiny_schiller"
|
| 19 |
+
|
| 20 |
+
_LICENSE = "Public domain (text) / MIT (pipeline code)"
|
| 21 |
+
|
| 22 |
+
_CITATION = """\
|
| 23 |
+
@misc{schutera2023tinyschiller,
|
| 24 |
+
author = {Schutera, Mark},
|
| 25 |
+
title = {tiny\\_schiller: a small German Schiller corpus for tiny language models},
|
| 26 |
+
year = {2023},
|
| 27 |
+
howpublished = {\\url{https://github.com/schutera/tiny_schiller}},
|
| 28 |
+
note = {Source texts: Projekt Gutenberg-DE, public domain.}
|
| 29 |
+
}
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
_DATA_URL = (
|
| 33 |
+
"https://huggingface.co/datasets/mrkschtr/tiny_schiller/resolve/main/tiny_schiller.clean.txt"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class TinySchillerConfig(datasets.BuilderConfig):
|
| 38 |
+
"""BuilderConfig for tiny_schiller."""
|
| 39 |
+
|
| 40 |
+
def __init__(self, **kwargs):
|
| 41 |
+
super(TinySchillerConfig, self).__init__(
|
| 42 |
+
version=datasets.Version("1.0.0"),
|
| 43 |
+
**kwargs,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class TinySchiller(datasets.GeneratorBasedBuilder):
|
| 48 |
+
"""tiny_schiller: a small German Schiller corpus for tiny language models."""
|
| 49 |
+
|
| 50 |
+
BUILDER_CONFIGS = [
|
| 51 |
+
TinySchillerConfig(
|
| 52 |
+
name="default",
|
| 53 |
+
description=(
|
| 54 |
+
"Returns the entire corpus as a single example with a 'text' field "
|
| 55 |
+
"(train split only)."
|
| 56 |
+
),
|
| 57 |
+
),
|
| 58 |
+
TinySchillerConfig(
|
| 59 |
+
name="train_test",
|
| 60 |
+
description=(
|
| 61 |
+
"Splits the corpus 90 / 10 by character count (contiguous tail for test), "
|
| 62 |
+
"each split returned as a single example with a 'text' field. "
|
| 63 |
+
"Follows the same convention as tiny_shakespeare."
|
| 64 |
+
),
|
| 65 |
+
),
|
| 66 |
+
]
|
| 67 |
+
|
| 68 |
+
DEFAULT_CONFIG_NAME = "default"
|
| 69 |
+
|
| 70 |
+
def _info(self):
|
| 71 |
+
return datasets.DatasetInfo(
|
| 72 |
+
description=_DESCRIPTION,
|
| 73 |
+
features=datasets.Features({"text": datasets.Value("string")}),
|
| 74 |
+
supervised_keys=None,
|
| 75 |
+
homepage=_HOMEPAGE,
|
| 76 |
+
license=_LICENSE,
|
| 77 |
+
citation=_CITATION,
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
def _split_generators(self, dl_manager):
|
| 81 |
+
data_file = dl_manager.download_and_extract(_DATA_URL)
|
| 82 |
+
|
| 83 |
+
if self.config.name == "train_test":
|
| 84 |
+
return [
|
| 85 |
+
datasets.SplitGenerator(
|
| 86 |
+
name=datasets.Split.TRAIN,
|
| 87 |
+
gen_kwargs={"filepath": data_file, "split": "train"},
|
| 88 |
+
),
|
| 89 |
+
datasets.SplitGenerator(
|
| 90 |
+
name=datasets.Split.TEST,
|
| 91 |
+
gen_kwargs={"filepath": data_file, "split": "test"},
|
| 92 |
+
),
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
+
# "default" — single train split containing the full corpus
|
| 96 |
+
return [
|
| 97 |
+
datasets.SplitGenerator(
|
| 98 |
+
name=datasets.Split.TRAIN,
|
| 99 |
+
gen_kwargs={"filepath": data_file, "split": "all"},
|
| 100 |
+
),
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
def _generate_examples(self, filepath, split):
|
| 104 |
+
with open(filepath, encoding="utf-8") as f:
|
| 105 |
+
corpus = f.read()
|
| 106 |
+
|
| 107 |
+
if split == "all":
|
| 108 |
+
yield 0, {"text": corpus}
|
| 109 |
+
return
|
| 110 |
+
|
| 111 |
+
# 90 / 10 contiguous-tail split (same convention as tiny_shakespeare)
|
| 112 |
+
split_index = int(len(corpus) * 0.9)
|
| 113 |
+
|
| 114 |
+
if split == "train":
|
| 115 |
+
yield 0, {"text": corpus[:split_index]}
|
| 116 |
+
else: # split == "test"
|
| 117 |
+
yield 1, {"text": corpus[split_index:]}
|