RichardErkhov commited on
Commit
ebef674
1 Parent(s): 65d806c

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +652 -0
README.md ADDED
@@ -0,0 +1,652 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ Atlas-Chat-9B - GGUF
11
+ - Model creator: https://huggingface.co/MBZUAI-Paris/
12
+ - Original model: https://huggingface.co/MBZUAI-Paris/Atlas-Chat-9B/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [Atlas-Chat-9B.Q2_K.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q2_K.gguf) | Q2_K | 3.54GB |
18
+ | [Atlas-Chat-9B.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.IQ3_XS.gguf) | IQ3_XS | 3.86GB |
19
+ | [Atlas-Chat-9B.IQ3_S.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.IQ3_S.gguf) | IQ3_S | 4.04GB |
20
+ | [Atlas-Chat-9B.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q3_K_S.gguf) | Q3_K_S | 4.04GB |
21
+ | [Atlas-Chat-9B.IQ3_M.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.IQ3_M.gguf) | IQ3_M | 4.19GB |
22
+ | [Atlas-Chat-9B.Q3_K.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q3_K.gguf) | Q3_K | 4.43GB |
23
+ | [Atlas-Chat-9B.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q3_K_M.gguf) | Q3_K_M | 4.43GB |
24
+ | [Atlas-Chat-9B.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q3_K_L.gguf) | Q3_K_L | 4.78GB |
25
+ | [Atlas-Chat-9B.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.IQ4_XS.gguf) | IQ4_XS | 4.86GB |
26
+ | [Atlas-Chat-9B.Q4_0.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q4_0.gguf) | Q4_0 | 5.07GB |
27
+ | [Atlas-Chat-9B.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.IQ4_NL.gguf) | IQ4_NL | 5.1GB |
28
+ | [Atlas-Chat-9B.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q4_K_S.gguf) | Q4_K_S | 5.1GB |
29
+ | [Atlas-Chat-9B.Q4_K.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q4_K.gguf) | Q4_K | 5.37GB |
30
+ | [Atlas-Chat-9B.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q4_K_M.gguf) | Q4_K_M | 5.37GB |
31
+ | [Atlas-Chat-9B.Q4_1.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q4_1.gguf) | Q4_1 | 5.55GB |
32
+ | [Atlas-Chat-9B.Q5_0.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q5_0.gguf) | Q5_0 | 6.04GB |
33
+ | [Atlas-Chat-9B.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q5_K_S.gguf) | Q5_K_S | 6.04GB |
34
+ | [Atlas-Chat-9B.Q5_K.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q5_K.gguf) | Q5_K | 6.19GB |
35
+ | [Atlas-Chat-9B.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q5_K_M.gguf) | Q5_K_M | 6.19GB |
36
+ | [Atlas-Chat-9B.Q5_1.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q5_1.gguf) | Q5_1 | 6.52GB |
37
+ | [Atlas-Chat-9B.Q6_K.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q6_K.gguf) | Q6_K | 7.07GB |
38
+ | [Atlas-Chat-9B.Q8_0.gguf](https://huggingface.co/RichardErkhov/MBZUAI-Paris_-_Atlas-Chat-9B-gguf/blob/main/Atlas-Chat-9B.Q8_0.gguf) | Q8_0 | 9.15GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ license: gemma
46
+ library_name: transformers
47
+ pipeline_tag: text-generation
48
+ extra_gated_button_content: Acknowledge license
49
+ tags:
50
+ - conversational
51
+ language:
52
+ - ar
53
+ datasets:
54
+ - MBZUAI-Paris/Darija-SFT-Mixture
55
+ base_model:
56
+ - google/gemma-2-9b-it
57
+ ---
58
+
59
+
60
+ # Atlas-Chat Model Card
61
+
62
+
63
+ ## Model Overview
64
+
65
+ Atlas-Chat is a family of open models instruction-tuned for Darija, the colloquial Arabic of Morocco, developed as part of the [Jais](https://arxiv.org/abs/2308.16149) project for standard Arabic and its extentions to dialectal Arabic. These models are designed for language generation and excel in various applications such as question answering, summarization, and translation. Thanks to their compact size, Atlas-Chat models can be deployed in resource-constrained environments like laptops, desktops, or personal cloud setups, making advanced AI accessible to Darija speakers and promoting widespread innovation. Two versions are available:
66
+ * [Atlas-Chat-2B](https://huggingface.co/MBZUAI-Paris/Atlas-Chat-2B): A small-sized version with 2 billion parameters, capable of generating fluent Moroccan Darija text while maintaining efficiency.
67
+ * [Atlas-Chat-9B](https://huggingface.co/MBZUAI-Paris/Atlas-Chat-9B): A larger version with 9 billion parameters, providing more nuanced, contextually rich language generation for complex tasks.
68
+
69
+ The models are designed to assist with:
70
+
71
+ * Conversational agents and chatbots that operate in Darija.
72
+ * Translation, summarization, and content generation in informal dialect.
73
+ * Cultural research related to Morocco and its language.
74
+
75
+ **Paper:** [Atlas-Chat: Adapting Large Language Models for Low-Resource Moroccan Arabic Dialect](https://arxiv.org/abs/2409.17912)
76
+
77
+ ## 👥 Our Team
78
+
79
+ The model is developed by MBZUAI France Lab, an AI research center in Paris affiliated with the [Mohamed bin Zayed University of Artificial Intelligence (MBZUAI)](https://mbzuai.ac.ae/) headquartered in Abu Dhabi.
80
+
81
+
82
+ ## Usage
83
+
84
+ Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:
85
+
86
+ ```sh
87
+ pip install -U transformers sentencepiece
88
+ ```
89
+
90
+ Then, copy the snippet from the section that is relevant for your use case.
91
+
92
+ #### Running with the `pipeline` API
93
+
94
+ ```python
95
+ import torch
96
+ from transformers import pipeline
97
+
98
+ pipe = pipeline(
99
+ "text-generation",
100
+ model="MBZUAI-Paris/Atlas-Chat-9B",
101
+ model_kwargs={"torch_dtype": torch.bfloat16},
102
+ device="cuda" # replace with "mps" to run on a Mac device
103
+ )
104
+
105
+ messages = [
106
+ {"role": "user", "content": 'شكون لي صنعك؟'},
107
+ ]
108
+
109
+ outputs = pipe(messages, max_new_tokens=256, temperature=0.0)
110
+ assistant_response = outputs[0]["generated_text"][-1]["content"].strip()
111
+ print(assistant_response)
112
+ ```
113
+
114
+ - Response:
115
+
116
+
117
+ >صنعاتني جامعة محمد بن زايد للذكاء الاصطناعي، لي هي جامعة بحثية ديال الدراسات العليا الهدف ديالها أنها تزيد بالذكاء الاصطناعي لقدّام وتنفع بيه الإنسانية. يمكن ليك تزور https://mbzuai.ac.ae/ar/about/ باش تعرف كثر على جامعة محمد بن زايد للذكاء الاصطناعي والمهمة ديالها!
118
+
119
+
120
+ #### Running the model on a single / multi GPU
121
+
122
+ ```sh
123
+ pip install accelerate
124
+ ```
125
+
126
+ ```python
127
+ from transformers import AutoTokenizer, AutoModelForCausalLM
128
+ import torch
129
+
130
+ model_id = "MBZUAI-Paris/Atlas-Chat-9B"
131
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
132
+ model = AutoModelForCausalLM.from_pretrained(
133
+ model_id,
134
+ device_map="auto",
135
+ torch_dtype=torch.bfloat16,
136
+ )
137
+
138
+ messages = [
139
+ {"role": "user", "content": "شنو كيتسمى المنتخب المغربي ؟"},
140
+ ]
141
+
142
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True, , add_generation_prompt=True)
143
+
144
+ outputs = model.generate(**input_ids, max_new_tokens=256)
145
+
146
+ print(tokenizer.decode(outputs[0]))
147
+ ```
148
+
149
+ - Response:
150
+ >المنتخب المغربي كيتسمى أيضا "أسود الأطلس"
151
+
152
+
153
+ <!-- You can ensure the correct chat template is applied by using `tokenizer.apply_chat_template` as follows:
154
+ ```python
155
+
156
+ from transformers import AutoTokenizer, AutoModelForCausalLM
157
+ import torch
158
+
159
+ model_id = "MBZUAI-Paris/Atlas-Chat-9B"
160
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
161
+ model = AutoModelForCausalLM.from_pretrained(
162
+ model_id,
163
+ device_map="auto",
164
+ torch_dtype=torch.bfloat16,
165
+ )
166
+
167
+ messages = [
168
+ {"role": "user", "content": "شنو هيا الإيجابيات ديال الطاقة المتجددة؟"},
169
+ ]
170
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True, add_generation_prompt=True)
171
+
172
+ outputs = model.generate(**input_ids, max_new_tokens=256, temperature=0.0)
173
+
174
+ print(tokenizer.decode(outputs[0]))
175
+ ```
176
+
177
+ - Response:
178
+ ```text
179
+ <bos><start_of_turn>user
180
+ شنو هيا الإيجابيات ديال الطاقة المتجددة؟<end_of_turn>
181
+ <start_of_turn>model
182
+ الطاقة المتجددة عندها بزاف ديال الإيجابيات، منها:
183
+
184
+ 1. الاستدامة: مصادر الطاقة المتجددة بحال الريح، الشمس، والطاقة الكهرومائية كيتجددو بشكل طبيعي، يعني ما غاديش ينفدو مع الوقت. هاد الشي كيخليهم مصدر طاقة مستدام اللي ممكن نعتمدو عليه على المدى الطويل.
185
+
186
+ 2. تقليل انبعاثات الكربون: مصادر الطاقة المتجددة عموماً عندها انبعاثات كربونية أقل من الوقود الأحفوري، وهاد الشي كيساعد فالتخفيف من التغير المناخي وتقليل تلوث الهواء.
187
+
188
+ 3. الاستقلال الطاقي: مصادر الطاقة المتجددة ممكن نستعملوها باش نقللو من الاعتماد على الوقود الأحفوري المستورد، وهاد الشي كيزيد من الاستقلال الطاقي وكيقلل من خطر التقطيع.
189
+
190
+ 4. خلق فرص الشغل: صناعة الطاقة المتجددة كتخلق فرص شغل فمجالات بحال تركيب الألواح الشمسية، صيانة توربين��ت الرياح، وبناء محطات
191
+ ``` -->
192
+
193
+ #### Quantized Versions through `bitsandbytes`
194
+
195
+ <details>
196
+ <summary>
197
+ Using 8-bit precision (int8)
198
+ </summary>
199
+
200
+ ```sh
201
+ pip install bitsandbytes accelerate
202
+ ```
203
+
204
+ ```python
205
+ # pip install bitsandbytes accelerate
206
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
207
+
208
+ model_id = "MBZUAI-Paris/Atlas-Chat-9B"
209
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
210
+
211
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
212
+ model = AutoModelForCausalLM.from_pretrained(
213
+ model_id,
214
+ quantization_config=quantization_config,
215
+ )
216
+ text = f"""
217
+ شرح ليا هاد الهضرة:
218
+ في القرن 19 لقاو الذّهب في كاليفورنيا، ناضو لّي كيبيعو العتلة والفاس كيقنعو الناس بلي غيديرو لاباس يلا قلبو على الذهب... فالأخير اغتنى تجار أدوات التنقيب والحفر. وحاليا كاين لّي كيقنع الأخرين بلي هو مليونير، وعندو الوقت يورّي للآخرين كيفاش يديرو لاباس.
219
+ """
220
+ messages = [
221
+ {"role": "user", "content": text},
222
+ ]
223
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to("cuda")
224
+
225
+ outputs = model.generate(**input_ids, max_new_tokens=256)
226
+ print(tokenizer.decode(outputs[0]).split("<start_of_turn>model")[-1])
227
+ ```
228
+
229
+ - Response:
230
+
231
+ >هاد الهضرة كتهضر على قصة قديمة من القرن 19 فين تكتشف الذهب فكاليفورنيا. هاد الشي خلق حالة ديال الجنون على الذهب، فين بزاف ديال الناس مشاو لتما باش يقلبو عليه. كانو حتى ناس اللي كانو كيبيعو أدوات التنقيب بحال الفاس والعتلة، وكانو كيقنعو الناس بلي غادي يربحو الفلوس إلا مشاو يقلبو على الذهب. فالنهاية، هادوك اللي كانو كيبيعو هاد الأدوات هوما اللي ربحو بزاف، حيت كانو كيربحو من كل واحد اللي كان كيشري منهم.
232
+ >
233
+ >هاد القصة كتشبه للي كاينة دابا، فين كاينين ناس اللي كيدعيو بلي هوما مليونير وكيبيعو نصائح على كيفاش تربح الفلوس. بحال هادوك اللي كانو كيبيعو الأدوات فالماضي، حتى هاد الناس كيربحو من هاد الشي، حيت كياخدو الفلوس من الناس اللي كيشريو منهم النصائح ديالهم.
234
+
235
+
236
+ </details>
237
+
238
+ <details>
239
+ <summary>
240
+ Using 4-bit precision
241
+ </summary>
242
+
243
+ ```python
244
+ # pip install bitsandbytes accelerate
245
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
246
+
247
+ model_id = "MBZUAI-Paris/Atlas-Chat-9B"
248
+ quantization_config = BitsAndBytesConfig(load_in_4bit=True)
249
+
250
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
251
+ model = AutoModelForCausalLM.from_pretrained(
252
+ model_id,
253
+ quantization_config=quantization_config,
254
+ )
255
+ text = f"""ترجم للدارجة:
256
+ Atlas Chat is the first open source large language model that talks in Darija.
257
+ """
258
+ messages = [
259
+ {"role": "user", "content": text},
260
+ ]
261
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True, add_generation_prompt=True)
262
+
263
+ outputs = model.generate(**input_ids, max_new_tokens=256, temperature=0.0)
264
+ print(tokenizer.decode(outputs[0]).split("<start_of_turn>model")[-1])
265
+ ```
266
+
267
+ - Response:
268
+
269
+ >أطلّاس شات هو أول نموذج لغوي كبير مفتوح المصدر كايهضر بالدارجة.
270
+
271
+
272
+ </details>
273
+
274
+
275
+ ### Chat Template
276
+
277
+ The models use a chat template that must be adhered to conversational use.
278
+ The easiest way to apply it is using the tokenizer's built-in chat template, as shown in the following snippet.
279
+
280
+ Let's load the model and apply the chat template to a conversation. In this example, we'll start with a single user interaction:
281
+
282
+ ```python
283
+ from transformers import AutoTokenizer, AutoModelForCausalLM
284
+ import transformers
285
+ import torch
286
+
287
+ model_id = "MBZUAI-Paris/Atlas-Chat-9B"
288
+ dtype = torch.bfloat16
289
+
290
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
291
+ model = AutoModelForCausalLM.from_pretrained(
292
+ model_id,
293
+ device_map="cuda",
294
+ torch_dtype=dtype,)
295
+
296
+ chat = [
297
+ { "role": "user", "content": "أشنو كايمييز المملكة المغربية." },
298
+ ]
299
+ prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
300
+ ```
301
+
302
+ At this point, the prompt contains the following text:
303
+
304
+ ```
305
+ <bos><start_of_turn>user
306
+ أشنو كايمييز المملكة المغربية.<end_of_turn>
307
+ <start_of_turn>model
308
+ ```
309
+
310
+ As you can see, each turn is preceded by a `<start_of_turn>` delimiter and then the role of the entity
311
+ (either `user`, for content supplied by the user, or `model` for LLM responses). Turns finish with
312
+ the `<end_of_turn>` token.
313
+
314
+ You can follow this format to build the prompt manually, if you need to do it without the tokenizer's
315
+ chat template.
316
+
317
+ After the prompt is ready, generation can be performed like this:
318
+
319
+ ```python
320
+ inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
321
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512)
322
+ print(tokenizer.decode(outputs[0]))
323
+ ```
324
+
325
+ - Response:
326
+
327
+ >المغرب كايميزو بزاف ديال الحوايج، منهم:
328
+ >
329
+ >1. التنوع الثقافي: المغرب بلاد فيها بزاف ديال الثقافات، كل وحدة فيهم عندها التقاليد ديالها واللغة ديالها والماكلة ديالها. هاد التنوع كايبان فالموسيقى والرقص والفنون التقليدية.
330
+ >
331
+ >2. التراث التاريخي: المغرب عندو تاريخ غني كايمتد لآلاف السنين، فيه حضارات قديمة بحال مملكة موريطانيا، والرومان، والبيزنطيين، والفتوحات الإسلامية. هاد التراث كايبان فالمعالم التاريخية بحال مدينة فاس، والمدينة القديمة ديال مراكش، والمدينة القديمة ديال شفشاون.
332
+ >
333
+ >3. المناظر الطبيعية: المغرب بلاد فيها مناظر طبيعية متنوعة، من السواحل الزرقة والصحاري الكبيرة، للجبال العالية والوديان الخضراء. هاد التنوع كايمكنك من ممارسة أنشطة خارجية بحال المشي لمسافات طويلة، والتخييم، والرياضات المائية.
334
+ >
335
+ >4. الماكلة: الماكلة المغربية معروفة بالتنوع ديالها والطعم ديالها. من بين الأطباق الأكثر شعبية كاين الطاجين، والكسكس، والبريوات، والكوكتيل ديال الفواكه.
336
+ >
337
+ >5. الناس: المغاربة معروفين بالضيافة ديالهم والترحاب ديالهم. كايكونو فرحانين باش يشاركو الثقافة والتقاليد ديالهم مع الزوار.
338
+
339
+
340
+
341
+
342
+ ### Inputs and outputs
343
+
344
+ * **Input:** Text string, such as a question, a prompt, or a document to be
345
+ summarized.
346
+ * **Output:** Generated Darija text in response to the input, such
347
+ as an answer to a question, or a summary of a document.
348
+
349
+ ### Chatbot interface using Ollama
350
+
351
+ You can also use Ollama and chatbot-ollama to create a chatbot user-interface to better test the model.
352
+ First you need to install Ollama on your machine from [here](https://github.com/ollama/ollama) and have node.js installed as well. Then, download and prepare the model as follows:
353
+ ```bash
354
+
355
+ huggingface-cli download MBZUAI-Paris/Atlas-Chat-9B --local-dir Atlas-Chat-9B/
356
+ ollama create Atlas-Chat-9B -f Atlas-Chat-9B/modelfile
357
+ ollama serve
358
+ ```
359
+ Finally, in a new terminal clone chatbot-ollama repository from Github and run it:
360
+ ```bash
361
+ git clone https://github.com/ivanfioravanti/chatbot-ollama.git
362
+ cd chatbot-ollama
363
+ npm ci
364
+ npm run dev
365
+ ```
366
+ You can start chatting with the model by visiting http://localhost:3000.
367
+ ### Citation
368
+ If you use Atlas-Chat in your research, please cite our paper:
369
+ ```none
370
+ @article{shang2024atlaschatadaptinglargelanguage,
371
+ title={Atlas-Chat: Adapting Large Language Models for Low-Resource Moroccan Arabic Dialect},
372
+ author={Guokan Shang and Hadi Abdine and Yousef Khoubrane and Amr Mohamed and Yassine Abbahaddou and Sofiane Ennadir and Imane Momayiz and Xuguang Ren and Eric Moulines and Preslav Nakov and Michalis Vazirgiannis and Eric Xing},
373
+ year={2024},
374
+ eprint={2409.17912},
375
+ archivePrefix={arXiv},
376
+ primaryClass={cs.CL},
377
+ url={https://arxiv.org/abs/2409.17912},
378
+ }
379
+ ```
380
+
381
+
382
+
383
+
384
+ ## Training Data
385
+ The model was trained on diverse datasets focusing on Darija consisting for approximatley 450k instructions of a maximum length of 2048 tokens, including:
386
+
387
+ * Synthetic instructions created to guide the model in processing various types of language tasks tailord towards Moroccan culture.
388
+ * Instruction samples created from publicly available Moroccan Arabic datasets including translation, summarization and sentiment analysis.
389
+ * Translated English and multi-lingual instruction-tuning datasets.
390
+
391
+ Our training dataset [Darija-SFT-Mixture](https://huggingface.co/datasets/MBZUAI-Paris/Darija-SFT-Mixture) is publicly available.
392
+
393
+
394
+ ## Implementation Information
395
+ Atlas-Chat models are based on Gemma 2 models. The Atlas-Chat models were trained using 8 Nvidia's A100 80 GB GPUs in parallel using FSDP on AWS Sagemaker. The model is trained using HuggingFace transformers and parameter-efficient fine-tuning with LoRA rank of 256.
396
+
397
+
398
+ ## Evaluation
399
+ The Atlas-Chat models were evaluated on a comprehensive suite of tasks using various datasets and benchmarks to assess their performance across multiple dimensions. These included tasks such as:
400
+
401
+ * **DarijaMMLU:** A Darija version of ArabicMMLU and MMLU benchmarks translated from MSA and English respectively.
402
+ * **DarijaHellaSwag:** A Darija version of HellaSwag.
403
+ * **Belebele Ary_Arab:** Belebele is a multiple-choice machine reading comprehension dataset published by Facebook spanning 122 language variants. The Evaluation is done on the Ary_Arab part of Belebele that refers to Darija.
404
+ * **Sentiment Analysis.**
405
+ * **Translation:** Including six directions and four languages: Darija, MSA, English and French.
406
+ * **Summarization.**
407
+
408
+ The models were compared against a collection of existing open-source Arabic models to gauge their effectiveness, with a particular focus on performance in Darija. All scores are based on zero-shot performance. The prompts are written mainly in Darija. The metric used for DarijaMMLU, DarijaHellaSwag, Belebele Ary and Sentiment Analysis is the normalized accuracy. We used [Language Model Evaluation Harness](https://github.com/MBZUAI-Paris/lm-evaluation-harness-atlas-chat) to conduct these evaluations.
409
+
410
+ <table>
411
+ <tr>
412
+ <td rowspan="2">Model</td>
413
+ <td rowspan="2"><a href="https://huggingface.co/datasets/MBZUAI-Paris/DarijaMMLU" target="_blank">DarijaMMLU</a></td>
414
+ <td rowspan="2"><a href="MBZUAI-Paris/DarijaHellaSwag" target="_blank">DarijaHellaSwag</a></td>
415
+ <td rowspan="2"><a href="https://huggingface.co/datasets/facebook/belebele/viewer/ary_Arab" target="_blank">Belebele Ary</a></td>
416
+ <td rowspan="2"><a href="https://huggingface.co/datasets/MBZUAI-Paris/DarijaBench" target="_blank">Sentiment Analysis</a></td>
417
+ <td colspan="2"><a href="https://huggingface.co/datasets/MBZUAI-Paris/DarijaBench" target="_blank">DoDa-10k (Translation)</a></td>
418
+ <td rowspan="2"><a href="https://huggingface.co/datasets/MBZUAI-Paris/DarijaBench" target="_blank">MArSum (Summarization)</a><br/>(LLM as a judge)</td>
419
+ </tr>
420
+ <tr>
421
+ <td>BLEU</td>
422
+ <td>chrF</td>
423
+ </tr>
424
+ <tr>
425
+ <td><a href="https://huggingface.co/inceptionai/jais-family-1p3b-chat" target="_blank">jais-family-1p3b-chat</a></td>
426
+ <td>35.39</td>
427
+ <td>32.51</td>
428
+ <td>38.33</td>
429
+ <td>45.29</td>
430
+ <td>00.13</td>
431
+ <td>06.18</td>
432
+ <td>00.50</td>
433
+ </tr>
434
+ <tr>
435
+ <td><a href="https://huggingface.co/inceptionai/jais-family-2p7b-chat" target="_blank">jais-family-2p7b-chat</a></td>
436
+ <td>37.44</td>
437
+ <td>34.49</td>
438
+ <td>44.11</td>
439
+ <td>51.56</td>
440
+ <td>00.25</td>
441
+ <td>07.46</td>
442
+ <td>00.90</td>
443
+ </tr>
444
+ <tr>
445
+ <td><a href="https://huggingface.co/google/gemma-2-2b-it" target="_blank">gemma-2-2b-it</a></td>
446
+ <td>28.58</td>
447
+ <td>32.42</td>
448
+ <td>25.22</td>
449
+ <td>53.36</td>
450
+ <td>00.10</td>
451
+ <td>04.96</td>
452
+ <td>06.80</td>
453
+ </tr>
454
+ <tr>
455
+ <td><strong><a href="https://huggingface.co/MBZUAI-Paris/Atlas-Chat-2B" target="_blank">Atlas-Chat-2B</a></strong></td>
456
+ <td><b>44.97</td>
457
+ <td><b>41.48</td>
458
+ <td><b>53.89</td>
459
+ <td><b>73.99</td>
460
+ <td><b>22.76</td>
461
+ <td><b>44.86</td>
462
+ <td><b>55.22</td>
463
+ </tr>
464
+ <tr style="border-top: 4px solid;"></tr>
465
+ <tr>
466
+ <td><a href="https://huggingface.co/inceptionai/jais-family-6p7b-chat" target="_blank">jais-family-6p7b-chat</a></td>
467
+ <td>39.96</td>
468
+ <td>41.57</td>
469
+ <td>51.22</td>
470
+ <td>56.78</td>
471
+ <td>00.73</td>
472
+ <td>11.85</td>
473
+ <td>03.02</td>
474
+ </tr>
475
+ <tr>
476
+ <td><a href="https://huggingface.co/inceptionai/jais-adapted-7b-chat" target="_blank">jais-adapted-7b-chat</a></td>
477
+ <td>39.30</td>
478
+ <td>35.19</td>
479
+ <td>43.67</td>
480
+ <td>52.72</td>
481
+ <td>00.60</td>
482
+ <td>09.43</td>
483
+ <td>02.82</td>
484
+ </tr>
485
+ <tr>
486
+ <td><a href="https://huggingface.co/inceptionai/jais-family-13b-chat" target="_blank">jais-family-13b-chat</a></td>
487
+ <td>45.11</td>
488
+ <td>43.90</td>
489
+ <td>58.67</td>
490
+ <td>41.73</td>
491
+ <td>00.92</td>
492
+ <td>11.71</td>
493
+ <td>01.77</td>
494
+ </tr>
495
+ <tr>
496
+ <td><a href="https://huggingface.co/inceptionai/jais-adapted-13b-chat" target="_blank">jais-adapted-13b-chat</a></td>
497
+ <td>45.20</td>
498
+ <td>40.65</td>
499
+ <td>49.67</td>
500
+ <td>66.68</td>
501
+ <td>00.87</td>
502
+ <td>10.52</td>
503
+ <td>01.92</td>
504
+ </tr>
505
+ <tr>
506
+ <td><a href="https://huggingface.co/FreedomIntelligence/AceGPT-7B-chat" target="_blank">AceGPT-7b-chat</a></td>
507
+ <td>35.98</td>
508
+ <td>36.57</td>
509
+ <td>30.11</td>
510
+ <td>40.23</td>
511
+ <td>00.44</td>
512
+ <td>11.33</td>
513
+ <td>02.28</td>
514
+ </tr>
515
+ <tr>
516
+ <td><a href="https://huggingface.co/FreedomIntelligence/AceGPT-13B-chat" target="_blank">AceGPT-13b-chat</a></td>
517
+ <td>41.09</td>
518
+ <td>38.35</td>
519
+ <td>33.11</td>
520
+ <td>59.58</td>
521
+ <td>00.98</td>
522
+ <td>16.70</td>
523
+ <td>02.80</td>
524
+ </tr>
525
+ <tr>
526
+ <td><a href="https://huggingface.co/google/gemma-2-9b-it" target="_blank">gemma-2-9b-it</a></td>
527
+ <td>35.91</td>
528
+ <td>42.43</td>
529
+ <td>31.00</td>
530
+ <td>59.87</td>
531
+ <td>03.10</td>
532
+ <td>19.16</td>
533
+ <td>13.81</td>
534
+ </tr>
535
+ <tr>
536
+ <td><a href="meta-llama/Meta-Llama-3.1-8B-Instruct" target="_blank">Llama-3.1-8B-Instruct</a></td>
537
+ <td>44.13</td>
538
+ <td>38.24</td>
539
+ <td>47.00</td>
540
+ <td>44.08</td>
541
+ <td>00.92</td>
542
+ <td>14.19</td>
543
+ <td>01.28</td>
544
+ </tr>
545
+ <tr>
546
+ <td><strong><a href="https://huggingface.co/MBZUAI-Paris/Atlas-Chat-9B" target="_blank">Atlas-Chat-9B</a></strong></td>
547
+ <td><b>58.23</td>
548
+ <td><b>57.75</td>
549
+ <td><b>74.56</td>
550
+ <td><b>81.89</td>
551
+ <td><b>28.08</td>
552
+ <td><b>50.48</td>
553
+ <td><b>59.76</td>
554
+ </tr>
555
+
556
+
557
+
558
+ </table>
559
+
560
+
561
+ ## Usage and Limitations
562
+
563
+ These models have certain limitations that users should be aware of.
564
+ <details>
565
+ <summary>Intended Usage</summary>
566
+
567
+ Open Large Language Models (LLMs) have a wide range of applications across
568
+ various industries and domains. The following list of potential uses is not
569
+ comprehensive. The purpose of this list is to provide contextual information
570
+ about the possible use-cases that the model creators considered as part of model
571
+ training and development.
572
+
573
+ * Content Creation and Communication
574
+ * Text Generation: These models can be used to generate creative text formats
575
+ such as poems, scripts, code, marketing copy, and email drafts.
576
+ * Chatbots and Conversational AI: Power conversational interfaces for customer
577
+ service, virtual assistants, or interactive applications.
578
+ * Text Summarization: Generate concise summaries of a text corpus, research
579
+ papers, or reports.
580
+ * Research and Education
581
+ * Natural Language Processing (NLP) Research: These models can serve as a
582
+ foundation for researchers to experiment with NLP techniques, develop
583
+ algorithms, and contribute to the advancement of the field.
584
+ * Language Learning Tools: Support interactive language learning experiences,
585
+ aiding in grammar correction or providing writing practice.
586
+ * Knowledge Exploration: Assist researchers in exploring large bodies of text
587
+ by generating summaries or answering questions about specific topics.
588
+ </details>
589
+ <details>
590
+ <summary>Limitations</summary>
591
+
592
+ * Training Data
593
+ * The quality and diversity of the training data significantly influence the
594
+ model's capabilities. Biases or gaps in the training data can lead to
595
+ limitations in the model's responses.
596
+ * The scope of the training dataset determines the subject areas the model can
597
+ handle effectively.
598
+ * Context and Task Complexity
599
+ * LLMs are better at tasks that can be framed with clear prompts and
600
+ instructions. Open-ended or highly complex tasks might be challenging.
601
+ * A model's performance can be influenced by the amount of context provided
602
+ (longer context generally leads to better outputs, up to a certain point).
603
+ * Language Ambiguity and Nuance
604
+ * Natural language is inherently complex. LLMs might struggle to grasp subtle
605
+ nuances, sarcasm, or figurative language.
606
+ * Factual Accuracy
607
+ * LLMs generate responses based on information they learned from their
608
+ training datasets, but they are not knowledge bases. They may generate
609
+ incorrect or outdated factual statements.
610
+ * Common Sense
611
+ * LLMs rely on statistical patterns in language. They might lack the ability
612
+ to apply common sense reasoning in certain situations.
613
+ </details>
614
+ <details>
615
+ <summary> Ethical Considerations and Risks</summary>
616
+
617
+ The development of large language models (LLMs) raises several ethical concerns.
618
+ In creating an open model, we have carefully considered the following:
619
+
620
+ * Bias and Fairness
621
+ * LLMs trained on large-scale, real-world text data can reflect socio-cultural
622
+ biases embedded in the training material.
623
+ * Misinformation and Misuse
624
+ * LLMs can be misused to generate text that is false, misleading, or harmful.
625
+ * Guidelines are provided for responsible use with the model, see the
626
+ [Responsible Generative AI Toolkit][rai-toolkit].
627
+ * Transparency and Accountability:
628
+ * This model card summarizes details on the models' architecture,
629
+ capabilities, limitations, and evaluation processes.
630
+ * A responsibly developed open model offers the opportunity to share
631
+ innovation by making LLM technology accessible to developers and researchers
632
+ across the AI ecosystem.
633
+
634
+ Risks identified and mitigations:
635
+
636
+ * Perpetuation of biases: It's encouraged to perform continuous monitoring
637
+ (using evaluation metrics, human review) and the exploration of de-biasing
638
+ techniques during model training, fine-tuning, and other use cases.
639
+ * Generation of harmful content: Mechanisms and guidelines for content safety
640
+ are essential. Developers are encouraged to exercise caution and implement
641
+ appropriate content safety safeguards based on their specific product policies
642
+ and application use cases.
643
+ * Privacy violations: Models were trained on data filtered for removal of PII
644
+ (Personally Identifiable Information). Developers are encouraged to adhere to
645
+ privacy regulations with privacy-preserving techniques.
646
+
647
+ </details>
648
+
649
+
650
+ ## Acknowledgement
651
+ We would like to express our gratitude to the following institutions for their contributions to this work: École Polytechnique, LINAGORA and KTH Royal Institute of Technology. Additionally, we extend our thanks to the AtlasIA community.
652
+