Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,10 +1,108 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: openrail
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: pytorch
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
tags:
|
| 8 |
+
- gpt2
|
| 9 |
+
- tinystories
|
| 10 |
+
- sft
|
| 11 |
+
- instruction-tuning
|
| 12 |
+
- story-generation
|
| 13 |
+
- from-scratch
|
| 14 |
+
- causal-lm
|
| 15 |
+
datasets:
|
| 16 |
+
- 0rn0/tinystories-instruct-balanced
|
| 17 |
+
base_model:
|
| 18 |
+
- 0rn0/gpt2-30m-tinystories
|
| 19 |
+
widget:
|
| 20 |
+
- text: "Write a story about: a little girl and her dog at the park\nWith: happy ending\n\n### Story:\n"
|
| 21 |
+
example_title: "Happy ending"
|
| 22 |
+
output:
|
| 23 |
+
text: "Once there was a little girl and her dog, Ducky. Every day, Ducky and Ducky went to the park to play. One day, Ducky met a little girl who was only three years old.\nThe little girl asked Ducky, \"Do you want to play with me?\"\nDucky was very happy. \"Yes!\" he said, \"Let's!\"\nSo they ran around the park and splashed in the water. Ducky was having so much fun! Ducky wanted to jump over the fence, but Ducky said, \"No Ducky, I can't jump over the fence!\"\nThe little girl smiled and said, \"Don't worry, I'll show you how.\"\nAnd just as Ducky jumped, Ducky jumped one last time and landed back in the park. Ducky watched and smiled. He was so happy they were able to play together!"
|
| 24 |
+
- text: "Write a story about: a boy who lost his favorite toy\nWith: sad ending\n\n### Story:\n"
|
| 25 |
+
example_title: "Sad ending"
|
| 26 |
+
output:
|
| 27 |
+
text: "Once there was a boy who loved to play with his toy. He liked to play with it every day.\nOne day he was playing with his toy and he noticed something strange. He went to his mom and asked what was wrong. His mom said he had lost his toy. The boy wanted to help and he started to search.\nHe looked in the room the closet and found his toy. He was so happy and he took it out to play with it.\nBut then he realised he had lost his toy. He looked everywhere but he couldn't find it. He was so sad.\nHe started to cry. His mom tried to comfort him and said she would try and find it. But nothing worked. The boy was sad so he went back to bed without his toy."
|
| 28 |
---
|
| 29 |
|
| 30 |
+
# GPT-2 30M — TinyStories SFT
|
| 31 |
+
|
| 32 |
+
## Model Details
|
| 33 |
+
- **Architecture**: GPT-2 (custom implementation)
|
| 34 |
+
- **Parameters**: ~30M
|
| 35 |
+
- **Context Length**: 512 tokens
|
| 36 |
+
- **Embedding Dim**: 384
|
| 37 |
+
- **Attention Heads**: 6
|
| 38 |
+
- **Transformer Layers**: 6
|
| 39 |
+
- **Tokenizer**: GPT-2 BPE (tiktoken, vocab size 50,257)
|
| 40 |
+
|
| 41 |
+
## Training
|
| 42 |
+
|
| 43 |
+
### Pre-training
|
| 44 |
+
Pre-trained from scratch on the [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories) dataset for 6 epochs. Pre-trained weights available at [0rn0/gpt2-30m-tinystories](https://huggingface.co/0rn0/gpt2-30m-tinystories).
|
| 45 |
+
|
| 46 |
+
### Supervised Fine-Tuning (SFT)
|
| 47 |
+
Fine-tuned for 5 epochs on [0rn0/tinystories-instruct-balanced](https://huggingface.co/datasets/0rn0/tinystories-instruct-balanced), a curated instruction-tuning dataset with balanced happy/sad endings (50-50 split, ~325K examples).
|
| 48 |
+
|
| 49 |
+
**SFT Hyperparameters:**
|
| 50 |
+
- Optimizer: AdamW
|
| 51 |
+
- Learning Rate: 5e-4
|
| 52 |
+
- Batch Size: 64
|
| 53 |
+
- Epochs: 5
|
| 54 |
+
|
| 55 |
+
## Usage
|
| 56 |
+
|
| 57 |
+
This is a **custom PyTorch model** (not transformers-compatible). Requires source code from the GitHub repository.
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
git clone https://github.com/aryandeore/monday-morning-moral-sft.git
|
| 61 |
+
cd monday-morning-moral-sft
|
| 62 |
+
uv sync
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### Instruction Format
|
| 66 |
+
```
|
| 67 |
+
Write a story about: {topic}
|
| 68 |
+
With: {ending} ending
|
| 69 |
+
|
| 70 |
+
### Story:
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Where `{ending}` is either `happy` or `sad`.
|
| 74 |
+
|
| 75 |
+
## Examples
|
| 76 |
+
|
| 77 |
+
### Happy ending
|
| 78 |
+
**Prompt:** `Write a story about: a little girl and her dog at the park`
|
| 79 |
+
|
| 80 |
+
> Once there was a little girl and her dog, Ducky. Every day, Ducky and Ducky went to the park to play. One day, Ducky met a little girl who was only three years old.
|
| 81 |
+
> The little girl asked Ducky, "Do you want to play with me?"
|
| 82 |
+
> Ducky was very happy. "Yes!" he said, "Let's!"
|
| 83 |
+
> So they ran around the park and splashed in the water. Ducky was having so much fun! Ducky wanted to jump over the fence, but Ducky said, "No Ducky, I can't jump over the fence!"
|
| 84 |
+
> The little girl smiled and said, "Don't worry, I'll show you how."
|
| 85 |
+
> And just as Ducky jumped, Ducky jumped one last time and landed back in the park. Ducky watched and smiled. He was so happy they were able to play together!
|
| 86 |
+
|
| 87 |
+
### Sad ending
|
| 88 |
+
**Prompt:** `Write a story about: a boy who lost his favorite toy`
|
| 89 |
+
|
| 90 |
+
> Once there was a boy who loved to play with his toy. He liked to play with it every day.
|
| 91 |
+
> One day he was playing with his toy and he noticed something strange. He went to his mom and asked what was wrong. His mom said he had lost his toy. The boy wanted to help and he started to search.
|
| 92 |
+
> He looked in the room the closet and found his toy. He was so happy and he took it out to play with it. He was so happy and he ran around it.
|
| 93 |
+
> But then he realised he had lost his toy. He looked everywhere but he couldn't find it. He was so sad.
|
| 94 |
+
> He started to cry. His mom tried to comfort him and said she would try and find it. But nothing worked. The boy was sad so he went back to bed without his toy. He was so sad that he couldn't keep it.
|
| 95 |
+
|
| 96 |
+
## Limitations
|
| 97 |
+
- Generates short stories only (~180 words)
|
| 98 |
+
- Trained on synthetic data, not human-authored stories
|
| 99 |
+
- Limited vocabulary and narrative complexity
|
| 100 |
+
- Binary ending classification (happy/sad only)
|
| 101 |
+
|
| 102 |
+
## Links
|
| 103 |
+
|
| 104 |
+
- **Pre-trained model:** [0rn0/gpt2-30m-tinystories](https://huggingface.co/0rn0/gpt2-30m-tinystories)
|
| 105 |
+
- **125M SFT variant:** [0rn0/gpt2-125m-tinystories-sft](https://huggingface.co/0rn0/gpt2-125m-tinystories-sft)
|
| 106 |
+
- **Training dataset:** [0rn0/tinystories-instruct-balanced](https://huggingface.co/datasets/0rn0/tinystories-instruct-balanced)
|
| 107 |
+
- **Demo:** [Tiny Tales GPT](https://tinytales.aryandeore.ai)
|
| 108 |
+
- **Collection:** [Tiny Stories](https://huggingface.co/collections/0rn0/tiny-stories)
|