Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- fish
|
| 7 |
+
- character
|
| 8 |
+
- tiny-llm
|
| 9 |
+
- text-generation
|
| 10 |
+
- from-scratch
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# GuppyLM — 9M Parameter Fish Chat Model
|
| 15 |
+
|
| 16 |
+
A ~9M parameter LLM trained from scratch that talks like a small fish named Guppy.
|
| 17 |
+
|
| 18 |
+
This project exists to show that training your own language model is not magic. One Colab notebook, 5 minutes, and you have a working LLM built from scratch.
|
| 19 |
+
|
| 20 |
+
## Example
|
| 21 |
+
|
| 22 |
+
```
|
| 23 |
+
You> hi guppy
|
| 24 |
+
Guppy> hi there. i just found a nice spot near the rock. the temperature feels nice.
|
| 25 |
+
|
| 26 |
+
You> are you hungry
|
| 27 |
+
Guppy> yes. always yes. i will swim to the top right now. i promise to eat all of it.
|
| 28 |
+
|
| 29 |
+
You> what is the meaning of life
|
| 30 |
+
Guppy> food. the answer is always food.
|
| 31 |
+
|
| 32 |
+
You> tell me a joke
|
| 33 |
+
Guppy> what did the fish say when it hit the wall. dam.
|
| 34 |
+
|
| 35 |
+
You> goodnight guppy
|
| 36 |
+
Guppy> ok sleep time. i was following a bubble but now i'll stop. goodnight tank. goodnight water.
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Architecture
|
| 40 |
+
|
| 41 |
+
| | |
|
| 42 |
+
|---|---|
|
| 43 |
+
| **Parameters** | 8.7M |
|
| 44 |
+
| **Type** | Vanilla transformer (from scratch) |
|
| 45 |
+
| **Layers** | 6 |
|
| 46 |
+
| **Hidden dim** | 384 |
|
| 47 |
+
| **Heads** | 6 |
|
| 48 |
+
| **FFN** | 768 (ReLU) |
|
| 49 |
+
| **Vocab** | 4,096 (BPE) |
|
| 50 |
+
| **Max sequence** | 128 tokens |
|
| 51 |
+
| **Norm** | LayerNorm |
|
| 52 |
+
| **Position** | Learned embeddings |
|
| 53 |
+
| **LM head** | Weight-tied with embeddings |
|
| 54 |
+
|
| 55 |
+
No GQA, no RoPE, no SwiGLU, no early exit. As simple as it gets.
|
| 56 |
+
|
| 57 |
+
## Training
|
| 58 |
+
|
| 59 |
+
- **Data:** 60K single-turn synthetic conversations across 60 topics
|
| 60 |
+
- **Steps:** 10,000
|
| 61 |
+
- **Optimizer:** AdamW (cosine LR schedule)
|
| 62 |
+
- **Hardware:** T4 GPU (~5 min)
|
| 63 |
+
- **No system prompt** — personality is baked into the weights
|
| 64 |
+
|
| 65 |
+
## Usage
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from inference import GuppyInference
|
| 69 |
+
|
| 70 |
+
engine = GuppyInference('checkpoints/best_model.pt', 'data/tokenizer.json')
|
| 71 |
+
r = engine.chat_completion([{'role': 'user', 'content': 'hi guppy'}])
|
| 72 |
+
print(r['choices'][0]['message']['content'])
|
| 73 |
+
# hi there. i just found a nice spot near the rock.
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
## Links
|
| 77 |
+
|
| 78 |
+
- **Repo:** [github.com/arman-bd/guppylm](https://github.com/arman-bd/guppylm)
|
| 79 |
+
- **Dataset:** [huggingface.co/datasets/arman-bd/guppylm-60k-generic](https://huggingface.co/datasets/arman-bd/guppylm-60k-generic)
|
| 80 |
+
|
| 81 |
+
## License
|
| 82 |
+
|
| 83 |
+
MIT
|