wincode commited on
Commit
2741fc9
·
verified ·
1 Parent(s): 431d613

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +83 -0
README.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ library_name: custom
6
+ tags:
7
+ - from-scratch
8
+ - storytelling
9
+ - creative-writing
10
+ - cpu-trained
11
+ - transformer
12
+ - pytorch
13
+ base_model: []
14
+ pipeline_tag: text-generation
15
+ ---
16
+
17
+ # AetherStory
18
+
19
+ > A from-scratch, CPU-trained storyteller transformer. ~863,492 parameters.
20
+
21
+ AetherStory is a tiny decoder-only transformer (GPT-style) trained **entirely
22
+ on CPU** on the procedurally generated [AetherStory dataset](wincode/aetherstory-data).
23
+ It writes short fantasy fables given an opening prompt.
24
+
25
+ This is **not** a fine-tune of a larger model and **not** a wrapper around
26
+ `transformers` — every layer is implemented by hand in plain PyTorch.
27
+
28
+ ## Architecture
29
+
30
+ ```
31
+ token + position embeddings
32
+ |
33
+ +----------------+
34
+ | Transformer x4 |
35
+ | causal MHA |
36
+ | GELU FFN |
37
+ +----------------+
38
+ |
39
+ LayerNorm
40
+ |
41
+ tied output head
42
+ ```
43
+
44
+ | hyperparameter | value |
45
+ |---|---|
46
+ | vocab size | 10000 |
47
+ | d_model | 128 |
48
+ | layers | 4 |
49
+ | heads | 4 |
50
+ | ffn dim | 512 |
51
+ | max seq len | 64 |
52
+ | parameters | 863,492 |
53
+ | tied embeddings| True |
54
+
55
+ ## Training
56
+
57
+ Trained with AdamW (lr 3e-4, cosine schedule, warmup 200) for 4 epochs on a
58
+ 4-core CPU. Best validation loss: **0.3103**, trained in unknown (recovered) on CPU.
59
+
60
+ ![loss curve](loss_chart.png)
61
+
62
+ ## Usage
63
+
64
+ ```python
65
+ # files needed next to this script:
66
+ # model.safetensors, config.json, tokenizer.json, modeling_aetherstory.py
67
+ from modeling_aetherstory import StoryTeller
68
+
69
+ teller = StoryTeller.from_dir(".")
70
+ print(teller("In the Glasslands there lived", max_tokens=100, temperature=0.9))
71
+ ```
72
+
73
+ ## Limitations
74
+
75
+ A ~2M-parameter model trained on synthetic fables will **not** produce
76
+ literature. It will produce charming, sometimes incoherent, fairy-tale-flavoured
77
+ text — which is the point. It is a demonstration that a small, fully
78
+ custom model can be trained, evaluated, and shipped end-to-end on commodity
79
+ hardware.
80
+
81
+ ## License
82
+
83
+ MIT.