| --- |
| license: mit |
| language: en |
| tags: |
| - gpt2 |
| - nietzsche |
| - philosophy |
| - fine-tuned |
| datasets: |
| - project-gutenberg |
| --- |
| |
| # NietzscheGPT — GPT-2 Medium Fine-Tuned on Nietzsche |
|
|
| A **GPT-2 Medium** (355M parameters) model fine-tuned exclusively on the complete English works of Friedrich Wilhelm Nietzsche from Project Gutenberg. |
|
|
| Built on a MacBook Pro M3 Pro in ~4 hours. |
|
|
| ## Training Data |
|
|
| 25 English books by Nietzsche from Project Gutenberg: |
| - Thus Spake Zarathustra |
| - Beyond Good and Evil |
| - The Genealogy of Morals |
| - Ecce Homo |
| - The Birth of Tragedy |
| - The Antichrist |
| - Human, All Too Human |
| - The Dawn of Day |
| - The Gay Science |
| - Twilight of the Idols |
| - The Case of Wagner |
| - The Will to Power |
| - Thoughts Out of Season |
| - Early Greek Philosophy & Other Essays |
| - We Philologists |
| - Homer and Classical Philology |
| - and more |
|
|
| **Total corpus**: ~9 million characters | ~2.2 million tokens |
|
|
| ## Training Details |
|
|
| | Hyperparameter | Value | |
| |---------------|-------| |
| | Base model | GPT-2 Medium (355M) | |
| | Epochs | 3 | |
| | Batch size | 4 (2 per device × 2 grad accum) | |
| | Learning rate | 5e-5 | |
| | Warmup steps | 500 | |
| | Sequence length | 512 | |
| | Precision | FP32 | |
| | Hardware | Apple M3 Pro (18GB) via MPS | |
| | Training time | ~4 hours | |
|
|
| ## Usage |
|
|
| ```python |
| from transformers import GPT2LMHeadModel, GPT2Tokenizer |
| |
| model = GPT2LMHeadModel.from_pretrained("MrArnav69/nietzschegpt-medium") |
| tokenizer = GPT2Tokenizer.from_pretrained("MrArnav69/nietzschegpt-medium") |
| |
| prompt = "Thus Spake Zarathustra:" |
| inputs = tokenizer(prompt, return_tensors="pt") |
| outputs = model.generate( |
| **inputs, |
| max_length=200, |
| temperature=0.8, |
| top_p=0.9, |
| do_sample=True, |
| ) |
| print(tokenizer.decode(outputs[0], skip_special_tokens=True)) |
| ``` |
|
|
| ## Example Outputs |
|
|
| ``` |
| >>> God is dead. |
| "But the world is eternal."—that is the last thought of the soul. |
| |
| >>> The will to power is |
| The will to power is something very different from |
| an intellectual faculty which would have to be developed in order to wield |
| its power. |
| |
| >>> Thus Spake Zarathustra: |
| "The great thing is to be free, but not to be free at all. |
| I have to be free to all things, but not free to myself." |
| ``` |
|
|
| ## Intended Use |
|
|
| This model is intended for research, creative writing, and educational purposes. It generates text in Nietzsche's philosophical style. |
|
|
| ## License |
|
|
| MIT |
|
|