Coding-With-Bashir commited on
Commit
95820c7
Β·
verified Β·
1 Parent(s): d1c2a1e

Upload .\README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. .//README.md +145 -0
.//README.md ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BwengeAi - Rwandan AI that knows Kinyarwanda
2
+
3
+ BwengeAi is a large-scale Kinyarwanda language model trained on 200 verified datasets from HuggingFace, Wikipedia, Rwandan news sources, and parallel corpora.
4
+
5
+ ## Current Stats
6
+
7
+ | Metric | Value |
8
+ |--------|-------|
9
+ | Datasets | 200 |
10
+ | Estimated Rows | 11.7B |
11
+ | Estimated Tokens | 64.9B |
12
+
13
+ ## Project Structure
14
+
15
+ ```
16
+ BwengeAi/
17
+ β”œβ”€β”€ configs/
18
+ β”‚ └── default.yaml # All 200 dataset configs + model/training params
19
+ β”œβ”€β”€ src/
20
+ β”‚ β”œβ”€β”€ data_collection/ # 12 collection modules
21
+ β”‚ β”‚ β”œβ”€β”€ huggingface_collector.py
22
+ β”‚ β”‚ β”œβ”€β”€ parallel_corpus_collector.py
23
+ β”‚ β”‚ β”œβ”€β”€ cc100_oscar_collector.py
24
+ β”‚ β”‚ β”œβ”€β”€ masakhane_collector.py
25
+ β”‚ β”‚ β”œβ”€β”€ wikipedia_collector.py
26
+ β”‚ β”‚ β”œβ”€β”€ igihe_scraper.py
27
+ β”‚ β”‚ β”œβ”€β”€ kigalitoday_scraper.py
28
+ β”‚ β”‚ β”œβ”€β”€ rss_collector.py
29
+ β”‚ β”‚ β”œβ”€β”€ wikimedia_collector.py
30
+ β”‚ β”‚ β”œβ”€β”€ rbc_collector.py
31
+ β”‚ β”‚ β”œβ”€β”€ web_utils.py # robots.txt compliance
32
+ β”‚ β”‚ └── data_processor.py # Clean + deduplicate + language filter
33
+ β”‚ β”œβ”€β”€ models/
34
+ β”‚ β”‚ └── bwenge_model.py
35
+ β”‚ β”œβ”€β”€ training/
36
+ β”‚ β”‚ └── trainer.py
37
+ β”‚ └── evaluation/
38
+ β”‚ └── metrics.py
39
+ β”œβ”€β”€ scripts/
40
+ β”‚ β”œβ”€β”€ collect_all.py # Main pipeline (12 steps)
41
+ β”‚ └── train.py
42
+ β”œβ”€β”€ data/
43
+ β”‚ β”œβ”€β”€ raw/ # Collected JSONL files
44
+ β”‚ └── processed/ # Cleaned training data
45
+ β”œβ”€β”€ docs/
46
+ β”‚ β”œβ”€β”€ data-collection.md
47
+ β”‚ β”œβ”€β”€ training.md
48
+ β”‚ └── evaluation.md
49
+ β”œβ”€β”€ tests/
50
+ β”‚ └── test_basic.py
51
+ └── pyproject.toml
52
+ ```
53
+
54
+ ## Data Sources (200 datasets)
55
+
56
+ | Category | Count | Description |
57
+ |----------|-------|-------------|
58
+ | Monolingual Kinyarwanda | 3 | CircuitNotion, mbazaNLP |
59
+ | Massive Web Crawl | 5 | fineweb-2, HPLT, CCMatrix, NLLB |
60
+ | Parallel Corpus | 109 | michsethowusu sentence pairs |
61
+ | Helsinki-NLP OPUS | 1 | 178K en-rw pairs |
62
+ | AllenAI NLLB | 1 | NLLB-200 mined bitext |
63
+ | CCAligned | 1 | Web-document pairs |
64
+ | Instruction Tuning | 12 | Alpaca, African-Translated-Alpaca |
65
+ | Chat/Conversation | 2 | Kinyarwanda chat, roleplay |
66
+ | Wikipedia | 4 | rw wiki, wikidata, wikisource |
67
+ | NER/POS | 3 | masakhaner, masakhapos |
68
+ | QA Benchmarks | 13 | afriqa, uhura suite, tydiqa |
69
+ | Sentiment | 3 | afrisenti, AfriSenti, safri |
70
+ | NLI | 3 | afrixnli, afro-xnli, xnli |
71
+ | Math/Logic | 2 | afrimgsm, uhura-gsm8k |
72
+ | Dialogue | 1 | AfriADR |
73
+ | Translation MT | 6 | flores, flores+, mafand, fleurs |
74
+ | Code | 16 | Code-170k (multiple languages) |
75
+ | Emotion | 7 | emotion-corpus (multiple languages) |
76
+ | Speech-Text | 7 | speech-text (multiple languages) |
77
+ | African Multilingual | 6 | NaolBM, afrolm, xlsum, LughaGen |
78
+ | Health | 1 | DigitalUmuganda health |
79
+ | News | 3 | KINNEWS, KIRNEWS, swahili_news |
80
+ | Hate Speech | 1 | afri-hate-speech |
81
+ | Common Voice | 2 | Kinyarwanda ASR transcripts |
82
+
83
+ ## Installation
84
+
85
+ ```bash
86
+ git clone <repository-url>
87
+ cd BwengeAi
88
+ python -m venv venv
89
+ source venv/bin/activate # Windows: venv\Scripts\activate
90
+ pip install -e ".[dev]"
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ ### 1. Collect Data
96
+
97
+ ```bash
98
+ python scripts/collect_all.py
99
+ ```
100
+
101
+ Pipeline stages:
102
+ 1. HuggingFace datasets (streaming, with max_rows limits)
103
+ 2. Parallel corpora (michsethowusu, read from config)
104
+ 3. CC-100/OSCAR (with language validation)
105
+ 4. Masakhane benchmarks (filtered to Kinyarwanda)
106
+ 5. Wikipedia (API + XML dump with iterparse)
107
+ 6. Igihe news (with robots.txt)
108
+ 7. Kigali Today (with robots.txt)
109
+ 8. New Times RSS
110
+ 9. Wikisource
111
+ 10. Wiktionary
112
+ 11. RBC health content (with robots.txt)
113
+ 12. Process + deduplicate + language filter
114
+
115
+ ### 2. Train Model
116
+
117
+ ```bash
118
+ python scripts/train.py
119
+ ```
120
+
121
+ ### 3. Evaluate
122
+
123
+ Evaluation runs automatically after training.
124
+
125
+ ## Pipeline Fixes Applied
126
+
127
+ | Issue | Fix |
128
+ |-------|-----|
129
+ | CC-100/OSCAR crash on `rw` | Language validation before loading, graceful skip |
130
+ | HuggingFace OOM on large datasets | Streaming mode + per-dataset max_rows limits |
131
+ | Parallel collector ignored 90+ datasets | Reads from config instead of hardcoded list |
132
+ | Masakhane collected all languages | Added `kin_Latn` language filter |
133
+ | No language detection | Added heuristic Kinyarwanda detection |
134
+ | 20-char minimum dropped short texts | Reduced to 5 chars |
135
+ | File copy name collisions | Prefixed with collector directory name |
136
+ | No token counting | Added token counting at every stage |
137
+ | No per-file processing stats | Added detailed per-file logging |
138
+ | No streaming error recovery | Added .done marker files for resume |
139
+ | Wikipedia XML parser fragile | Switched to ET.iterparse |
140
+ | No robots.txt compliance | Added robots.txt checking to all scrapers |
141
+ | Empty data/docs folders | Added .gitkeep, .gitignore, docs |
142
+
143
+ ## License
144
+
145
+ MIT License