File size: 1,977 Bytes
c514928
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: TinyStories Story Generator
emoji: πŸ“š
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
tags:
  - text-generation
  - llama
  - tinystories
  - storytelling
---

# TinyStories Story Generator

An interactive Gradio Space for generating simple children's stories using a small Llama-architecture model trained on the TinyStories dataset.

## About

This Space provides a chat-style interface to interact with a ~15M parameter language model that generates simple, coherent children's stories. The model uses vocabulary and concepts that a typical 3-4 year old would understand.

## Features

- Interactive story generation
- Adjustable generation parameters (temperature, top-k, top-p, max length)
- Example prompts to get started
- Real-time generation
- Clean, user-friendly interface

## Model Details

- **Architecture:** Llama 2
- **Parameters:** ~15M
- **Layers:** 6
- **Attention Heads:** 6
- **Max Context Length:** 256 tokens
- **Training Dataset:** [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories)

## Usage

1. Enter a story prompt (e.g., "Once upon a time, there was a...")
2. Optionally adjust generation settings
3. Click "Generate Story"
4. Enjoy your AI-generated children's story!

## Setup Instructions

To run this Space:

1. Upload your trained model to HuggingFace Hub
2. Update the `MODEL_REPO` variable in `app.py` with your model repository (format: `username/model-name`)
3. Or set the `MODEL_REPO` environment variable in the Space settings

## Local Development

```bash
pip install -r requirements.txt
python app.py
```

## License

MIT License

## Acknowledgments

- Model architecture and training code adapted from [llama2.c](https://github.com/karpathy/llama2.c) by Andrej Karpathy
- Trained on the [TinyStories dataset](https://huggingface.co/datasets/roneneldan/TinyStories) by Ronen Eldan and Yuanzhi Li
- Based on the Llama 2 architecture by Meta AI