mrkschtr commited on
Commit
d905067
·
verified ·
1 Parent(s): 5572c69

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +100 -132
  2. data/test.parquet +3 -0
  3. data/train.parquet +3 -0
README.md CHANGED
@@ -1,132 +1,100 @@
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
- ![Friedrich Schiller](schiller_thug.gif)
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
- ```
 
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
+ A small (~2 MB) German-language analogue to Karpathy's [tiny_shakespeare](https://huggingface.co/datasets/tiny_shakespeare) 12 of Friedrich Schiller's dramatic works, cleaned and tokenised for tutorial-scale language models.
18
+
19
+ *"Das Leben ist nur ein Moment, der Tod ist auch nur einer."* Friedrich Schiller
20
+
21
+ ![Friedrich Schiller](schiller_thug.gif)
22
+
23
+ ## Corpus
24
+
25
+ ~2.2 MB · 12 works · 2,168,278 characters · sourced from [Projekt Gutenberg](https://www.projekt-gutenberg.org/autoren/namen/schiller.html)
26
+
27
+ | Tokenizer | Tokens | chars/token |
28
+ |---|---|---|
29
+ | character-level | 2,168,278 | 1.00 |
30
+ | GPT-2 BPE | 913,675 | 2.37 |
31
+ | `cl100k_base` | 681,548 | 3.18 |
32
+
33
+ Use **character-level** for teaching-scale models (96-token vocab, no tokenizer needed). Use **cl100k** over GPT-2 when sequence length matters — German umlauts and compounds tokenise 25% more efficiently.
34
+
35
+ ## Works
36
+
37
+ - Die Räuber
38
+ - Die Verschwörung des Fiesco zu Genua
39
+ - Kabale und Liebe
40
+ - Don Carlos, Infant von Spanien
41
+ - Wallenstein (trilogy)
42
+ - Maria Stuart
43
+ - Die Jungfrau von Orleans
44
+ - Die Braut von Messina
45
+ - Wilhelm Tell
46
+ - Die Huldigung der Künste
47
+ - Briefe über Don Carlos
48
+ - Aus dem Szenar zum »Demetrius«
49
+
50
+ ## Quick Start — nanoGPT
51
+
52
+ ```bash
53
+ python schiller_char/prepare.py # char-level, 96-vocab
54
+ python schiller_bpe/prepare.py # GPT-2 BPE, 50k vocab
55
+ python schiller_cl100k/prepare.py # cl100k, 100k vocab
56
+ ```
57
+
58
+ ## HuggingFace Datasets
59
+
60
+ ```python
61
+ from datasets import load_dataset
62
+
63
+ ds = load_dataset("mrkschtr/tiny_schiller")
64
+ print(ds["train"][0]["title"])
65
+ print(ds["train"][0]["text"][:200])
66
+ ```
67
+
68
+ 10 works in train, 2 in test (Wilhelm Tell, Die Braut von Messina). Each row is one complete work with `title` and `text` fields.
69
+
70
+ ## Fine-tuning small LLMs
71
+
72
+ ```bash
73
+ pip install transformers trl datasets accelerate
74
+ python examples/finetune_sft.py --model TinyLlama/TinyLlama-1.1B-Chat-v1.0
75
+ ```
76
+
77
+ Default context window is 2048 tokens. Match your model with `--context_length`:
78
+
79
+ ```bash
80
+ python examples/finetune_sft.py --model microsoft/Phi-3-mini-4k-instruct --context_length 4096
81
+ python examples/finetune_sft.py --model Qwen/Qwen2.5-0.5B --context_length 4096
82
+ ```
83
+
84
+ Tested: TinyLlama 1.1B · Phi-3 Mini 3.8B · Llama 3.2 1B/3B · Qwen2.5 0.5B–3B.
85
+
86
+ ## License
87
+
88
+ Text: public domain (Schiller died 1805). Pipeline code: MIT. See [LICENSING.md](LICENSING.md) for details.
89
+
90
+ ## Citation
91
+
92
+ ```bibtex
93
+ @misc{schutera2023tinyschiller,
94
+ author = {Schutera, Mark},
95
+ title = {tiny\_schiller: a small German Schiller corpus for tiny language models},
96
+ year = {2023},
97
+ howpublished = {\url{https://github.com/schutera/tiny_schiller}},
98
+ note = {Source texts: Projekt Gutenberg-DE, public domain.}
99
+ }
100
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df3a282947b6945634e8a59d219fdf462630f122b67b7b2dffb9e079bb5ed5dd
3
+ size 195490
data/train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ce07f28c9ef59634adc6fa066b604223bf83a7a551c3421716b671a02072c42
3
+ size 1171949