OxxoCodes commited on
Commit
2085d7a
1 Parent(s): 27874fd

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +167 -0
README.md ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - tn
4
+ - en
5
+ base_model: meta-llama/Meta-Llama-3.1-8B-Instruct
6
+ library_name: transformers
7
+ datasets:
8
+ - OxxoCodes/Medupe
9
+ - OxxoCodes/Marothodi
10
+ - Magpie-Align/Magpie-Pro-MT-300K-v0.1
11
+ - teknium/OpenHermes-2.5
12
+ - CohereForAI/aya_dataset
13
+ - lelapa/Inkuba-instruct
14
+ - HuggingFaceTB/everyday-conversations-llama3.1-2k
15
+ ---
16
+
17
+
18
+ <img src="https://huggingface.co/OxxoCodes/Pula-8B/resolve/main/BotsLM.png" >
19
+
20
+ # Pula-8B
21
+ ## Model Information
22
+
23
+ The largest model in the BOTS-LM suite of language models, Pula-8B is the most capable open source large langauge model built for Setswana. Based on the Llama-3.1-8B-Instruct architecture and fine-tuned on a massive copora of Setswana and English webtext, instruction following, and synthetic data, Pula-8B outperforms existing open langauge and translation models for Setswana and English while pushing reasoning capabilities to become competitive with existing models several times its size.
24
+
25
+ Based on the Llama-3.1-8B instruct architecture, the BOTS-LM suite of language models is fine-tuned on a custom-made massive corpora of Setswana and English web documents ([**Marothodi**](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct)), instruction following examples and synthetic data ([**Medupe**](https://huggingface.co/datasets/OxxoCodes/Medupe/settings)), multilingual data (Aya Dataset, Inkuba Instruct), and subsets of OpenHermes 2.5, MagPie Pro MT, and The Tome.
26
+
27
+ ### Model Description
28
+
29
+ - **Developed by:** Nathan Brown ([@OxxoCodes](https://huggingface.co/OxxoCodes)) and Vukosi Marivate ([@vukosi](https://huggingface.co/vukosi))
30
+ - **Funded by:** [More Information Needed]
31
+ - **Model type:** Meta Llama 3.1
32
+ - **Language(s) (NLP):** Setswana, English
33
+ - **License:** [More Information Needed]
34
+ - **Finetuned from model:** [Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct)
35
+
36
+ ### Model Sources
37
+
38
+ - **Repository:** https://github.com/OxxoCodes/BOTS-LM
39
+ - **Paper:** [[2408.02239] BOTS-LM: Training Large Language Models for Setswana](https://arxiv.org/abs/2408.02239)
40
+ - **Demo:** [More Information Needed]
41
+
42
+ ## Uses
43
+
44
+ ### Direct Use
45
+
46
+ BOTS-LM models and data are intended for commercial and research use in Setswana and English. All Pula models are trained on predominantly instruction data, and as such are primarily meant for assistant-like chat. However, they may still function for general langauge generation, although this is predominantly untested. The BOTS-LM suite also allows for the use of its outputs to improve other models, including synthetic data generation and distillation.
47
+
48
+ ### Downstream Use
49
+
50
+ BOTS-LM's Pula LLMs are trained on a wide variety of tasks including (but not limited to) general conversations, Setswana <--> English translation, writing, question answering, tool use/function calling, Named Entity Recognition (NER), and Part of Speech (POS) tagging.
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ The use of any model, data, or resource in the BOTS-LM suite that violates applicable laws or regulations, is intended to cause direct or indirect harm, or is otherwise generally considered immoral or unethical, is explicitly prohibited.
55
+
56
+ While every model in the BOTS-LM suite has been trained on a small amount of data covering several langauges, use of these models is only officially supported for Setswana and English.
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ As with any language model, BOTS-LM models are susceptible to generating inaccurate or biased responses to user prompts. It is recommended the user(s) of BOTS-LM models develop additional safety safeguards or perform additional safety training prior to deployment in customer- or client-facing environments.
61
+
62
+ ## How to Get Started with the Model
63
+
64
+ Use the code below to get started with the model.
65
+
66
+ ```python
67
+ import transformers
68
+ import torch
69
+
70
+ model_id = "OxxoCodes/Pula-8B"
71
+
72
+ pipeline = transformers.pipeline(
73
+ "text-generation",
74
+ model=model_id,
75
+ model_kwargs={"torch_dtype": torch.bfloat16},
76
+ device_map="auto",
77
+ )
78
+
79
+ messages = [
80
+ {"role": "system", "content": "O mothusi wa AI yo o thusang."},
81
+ {"role": "user", "content": "Dumela!"},
82
+ ]
83
+
84
+ outputs = pipeline(
85
+ messages,
86
+ max_new_tokens=256,
87
+ )
88
+ print(outputs[0]["generated_text"][-1])
89
+
90
+ ```
91
+
92
+ ## Training Details
93
+
94
+ ### Training Data
95
+
96
+ Pula-8B was fine-tuned on a corpus of 0.5 billion tokens of Setswana and English text for 3 epochs, totaling of 1.5 Billion tokens, as measured using the Llama 3.1 tokenizer.
97
+
98
+ To increase the occurances of high-quality instruction data, all non-OPUS data sources appear twice per epoch, while certain synthetic datasets appear five times per epoch.
99
+
100
+ We ensure 80% of training tokens are made up of SetsText, SetsText-Instruct, and Hugging Face's Everyday Conversations dataset. The other 20% consists of various high-quality and multilingual data sources.
101
+
102
+ Following these procedures, the final training data distribution is as follows:
103
+
104
+ - **SetsText-Instruct:** 66.43% (336M tokens)
105
+
106
+ - **SetsText:** 13.5% (68M tokens)
107
+
108
+ - **MagPie Pro MT:** 10% (50M tokens)
109
+
110
+ - **OpenHermes 2.5:** 7% (35M tokens)
111
+
112
+ - **Aya Dataset:** 2% (10M tokens)
113
+
114
+ - **Inkuba Instruct:** 1% (5M tokens)
115
+
116
+ - **Everyday Conversations:** 0.07% (0.3M tokens)
117
+
118
+ #### Preprocessing
119
+
120
+ All Pula models in the BOTS-LM series are trained on sequences up to 4096 tokens. For all sequences longer than 4096 tokens, such as large documents or long multi-turn instruction conversations, they are split into chunks of 4096 tokens. In addition, we utilize the Liger Kernel to reduce GPU memory requirements.
121
+
122
+ #### Training Hyperparameters
123
+
124
+ - **Training regime:** BF16 mixed precision
125
+ - **Epochs:** 3.0
126
+ - **Learning Rate:** 2e-5
127
+ - **Learning Rate Scheduler:** Cosine
128
+ - **Warmup Ratio:** 5%
129
+ - **LoRA Rank:** 64
130
+ - **LoRA Alpha:** 32
131
+ - **Per Device Train Batch Size:** 1
132
+ - **Gradient Accumulation Steps:** 8
133
+ - **GPUs:** 4x Nvidia H100s 80GB
134
+ - **Sequence Length:** 4096
135
+ - **Effective Batch Size:** 32 (131k tokens)
136
+
137
+ ## Technical Specifications
138
+
139
+ ### Compute Infrastructure
140
+
141
+ Compute is provided by the Clemson University Palmetto Cluster.
142
+
143
+ #### Hardware
144
+
145
+ Pula-8B is trained using a single node of four NVIDIA H100 80GBs with sixteen CPUs and 64GB RAM.
146
+
147
+ #### Software
148
+
149
+ Training is performed using Hugging Face `transformers`, `accelerate`, `peft`, and `trl` with DeepSpeed and ZeRO-3.
150
+
151
+ ## Citation
152
+
153
+ **BibTeX:**
154
+
155
+ ```bibtext
156
+ @misc{2408.02239,
157
+ Author = {Nathan Brown and Vukosi Marivate},
158
+ Title = {BOTS-LM: Training Large Language Models for Setswana},
159
+ Year = {2024},
160
+ Eprint = {arXiv:2408.02239},
161
+ Note = {Hugging Face repository: \url{https://huggingface.co/collections/OxxoCodes/bots-lm-66af1106ccc0fb38839f39da}}
162
+ }
163
+ ```
164
+
165
+ **APA:**
166
+
167
+ Brown, N., & Marivate, V. (2024). *BOTS-LM: Training Large Language Models for Setswana*. arXiv. [[2408.02239] BOTS-LM: Training Large Language Models for Setswana](https://arxiv.org/abs/2408.02239). Hugging Face repository: https://huggingface.co/collections/OxxoCodes/bots-lm-66af1106ccc0fb38839f39da