map-boy commited on
Commit
8df8846
·
verified ·
1 Parent(s): 24fd730

project README

Browse files
Files changed (1) hide show
  1. README.md +50 -0
README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: [rw]
3
+ tags: [kinyarwanda, gpt, from-scratch, pytorch, text-generation]
4
+ ---
5
+ # wandaa-kin-gpt: a Kinyarwanda language model trained from scratch
6
+
7
+ A small GPT trained from scratch on Kinyarwanda text (not a fine-tune of another model). It is a research project of VAF Ubwenge Tech, built step by step: start small, measure, fix the data, repeat. It continues text. It is not a chatbot yet.
8
+
9
+ ## Where we are now (honest status)
10
+ | version | what changed | held-out score | EVAL bits/char |
11
+ |---|---|---|---|
12
+ | model.pt | first run, step 5000, textbook corpus | not comparable | 2.382 |
13
+ | checkpoint.pt | epoch 299 | not comparable | 1.981 |
14
+ | v2 | resumed from checkpoint.pt, fixed validation split | val 2.757 | 1.768 |
15
+ | v3 | corpus v3: 6.6M tokens (news, web, textbook), one apostrophe style | val 3.745 (new val set) | **1.379** |
16
+ | v4 | v3 recipe without the textbook source | news/web val 3.941 | 1.423 |
17
+
18
+ Notes: val sets differ between versions, so compare columns only within the same row group. EVAL bits/char is measured on 10 fixed everyday Kinyarwanda sentences that are not in the training data. Lower is better.
19
+
20
+ Best model today: **v3** (v3/best.pt). v4 is slightly better on news-style text and worse on textbook text.
21
+
22
+ Known limits: 9.7M parameters, 128-token context, 8000-token vocabulary, about 6.6M training tokens. Output is fluent in grammar and style but drifts in meaning. It does not answer questions.
23
+
24
+ ## Files
25
+ - v2/, v3/, v4/ : weights (best.pt) and, for v3, model.py (standalone loader) and README
26
+ - model.pt, checkpoint.pt : the original from-scratch runs
27
+ - tokenizer: map-boy/wandaa-kin-tokenizer (GPT-2 style BPE, vocab 8000)
28
+ - corpus: map-boy/wandaa-kin-traindata
29
+
30
+ ## Architecture
31
+ token + position embeddings (256-dim, 128 positions), 6 pre-norm transformer blocks, 8 heads of 32 dims, feed-forward 256-1024-256 with GELU, final LayerNorm, linear head to 8000 tokens.
32
+
33
+ ## Usage
34
+ from huggingface_hub import hf_hub_download as d
35
+ from transformers import GPT2Tokenizer
36
+ import torch, importlib.util
37
+ R = "map-boy/wandaa-kin-gpt"
38
+ spec = importlib.util.spec_from_file_location("model", d(R, "v3/model.py")); mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod)
39
+ tk = GPT2Tokenizer(d("map-boy/wandaa-kin-tokenizer", "vocab.json"), d("map-boy/wandaa-kin-tokenizer", "merges.txt"))
40
+ m = mod.GPT(); m.load_state_dict(torch.load(d(R, "v3/best.pt"), map_location="cpu")["model"]); m.eval()
41
+ print(mod.generate(m, tk, "Kigali ni umujyi"))
42
+
43
+ ## Roadmap (what comes next, in order)
44
+ 1. More data: find and clean free public Kinyarwanda text; target 50M+ tokens. Data is the main limit right now.
45
+ 2. New tokenizer: train a 16k-32k BPE on the full corpus.
46
+ 3. Scale the model: about 30-50M parameters, 256-token context, same fixed validation set and best-checkpoint saving.
47
+ 4. Make it useful: fine-tune on question-answer and dialogue data (wandaa-kin-qa, kinyarwanda-dialogue-dataset) so it can answer.
48
+ 5. Demo: publish in the Wandaa Demo Space with honest labels.
49
+
50
+ Every version keeps a fixed held-out set so progress is measured, not guessed.