File size: 2,105 Bytes
9843c0c
38c20fb
 
9843c0c
38c20fb
518ee27
 
38c20fb
518ee27
 
38c20fb
 
 
 
 
9843c0c
 
 
 
 
38c20fb
 
 
 
9843c0c
38c20fb
9843c0c
38c20fb
 
 
9843c0c
38c20fb
9843c0c
38c20fb
 
 
 
 
9843c0c
38c20fb
 
 
 
 
 
9843c0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
language: 
- en
tags:
- gpt2
- text-generation
- story-generation
- creative-writing
- TinyStories
- ai-story
license: mit
datasets:
- roneneldan/TinyStories
metrics:
- perplexity
model-index:
- name: tiny-stories-gpt2
  results: []
---

# 🧚‍♀️ Tiny Stories GPT-2
**Author:** [Fathi7ma](https://huggingface.co/Fathi7ma)  
**Model type:** Fine-tuned GPT-2 for creative story generation  
**Dataset:** [roneneldan/TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories)

---

## 🧠 Model Overview
This model is a fine-tuned version of **GPT-2 (small)** trained on the [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories) dataset — a large collection of short, simple stories for children.  
The goal of this project is to create a lightweight, fun, and creative **story generator** that can produce short, imaginative stories from user prompts.

---

## ✨ Intended Use
Use this model for:
- Generating **short, creative stories**
- Educational or entertainment purposes  
- Quick writing inspiration or kids’ content

Example use:
```python
from transformers import pipeline
generator = pipeline("text-generation", model="Fathi7ma/tiny-stories-gpt2")
prompt = "A tiny robot who wanted to fly"
print(generator(prompt, max_length=80, num_return_sequences=1)[0]["generated_text"])


### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 3
- mixed_precision_training: Native AMP

### Training results

| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-----:|:----:|:---------------:|
| 1.9127        | 1.0   | 2375 | 1.7789          |
| 1.7876        | 2.0   | 4750 | 1.7186          |
| 1.6976        | 3.0   | 7125 | 1.6995          |


### Framework versions

- Transformers 4.57.1
- Pytorch 2.8.0+cu126
- Datasets 4.0.0
- Tokenizers 0.22.1