SaiedAlshahrani commited on
Commit
a00f4f8
1 Parent(s): 86b9b47

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +220 -0
README.md ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ar
4
+ - en
5
+ thumbnail: null
6
+ tags:
7
+ - Arabic
8
+ - English
9
+ - LLM
10
+ - Decoder
11
+ - causal-lm
12
+ license: apache-2.0
13
+ pipeline_tag: text-generation
14
+ ---
15
+
16
+ # Jais-13b
17
+
18
+ <!-- Provide a quick summary of what the model is/does. -->
19
+
20
+ This is a 13 billion parameter pre-trained bilingual large language model for both Arabic and English,
21
+ trained on a dataset containing 72 billion Arabic tokens and 279 billion English/code tokens.
22
+ The Arabic data is iterated over for 1.6 epochs (as opposed to 1 epoch for English/code), for a total of 395 billion tokens of training.
23
+
24
+
25
+ The model is based on transformer-based decoder-only (GPT-3) architecture and uses SwiGLU
26
+ non-linearity. It implements ALiBi position embeddings, enabling the model to extrapolate
27
+ to long sequence lengths, providing improved context handling and model precision.
28
+
29
+
30
+ ## Getting started
31
+
32
+ Below is sample code to use the model. Note that the model requires a custom model class, so users must
33
+ enable `trust_remote_code=True` while loading the model.
34
+ Also, note that this code is tested on `transformers==4.28.0`.
35
+
36
+ ```python
37
+ # -*- coding: utf-8 -*-
38
+
39
+ import torch
40
+ from transformers import AutoTokenizer, AutoModelForCausalLM
41
+ model_path = "inception-mbzuai/jais-13b"
42
+
43
+ device = "cuda" if torch.cuda.is_available() else "cpu"
44
+
45
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
46
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto", trust_remote_code=True)
47
+
48
+
49
+ def get_response(text,tokenizer=tokenizer,model=model):
50
+ input_ids = tokenizer(text, return_tensors="pt").input_ids
51
+ inputs = input_ids.to(device)
52
+ input_len = inputs.shape[-1]
53
+ generate_ids = model.generate(
54
+ inputs,
55
+ top_p=0.9,
56
+ temperature=0.3,
57
+ max_length=200-input_len,
58
+ min_length=input_len + 4,
59
+ repetition_penalty=1.2,
60
+ do_sample=True,
61
+ )
62
+ response = tokenizer.batch_decode(
63
+ generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True
64
+ )[0]
65
+ return response
66
+
67
+
68
+ text= "عاصمة دولة الإمارات العربية المتحدة ه"
69
+ print(get_response(text))
70
+
71
+ text = "The capital of UAE is"
72
+ print(get_response(text))
73
+
74
+ ```
75
+
76
+
77
+ ## Model Details
78
+
79
+ - **Developed by:** [Inception](https://www.inceptioniai.org/en/), [Mohamed bin Zayed University of Artificial Intelligence (MBZUAI)](https://mbzuai.ac.ae/), and [Cerebras Systems](https://www.cerebras.net/).
80
+ - **Language(s) (NLP):** Arabic and English
81
+ - **License:** Apache 2.0
82
+ - **Input:** Text only data.
83
+ - **Output:** Model generates text.
84
+ - **Paper :** [Jais and Jais-chat: Arabic-Centric Foundation and Instruction-Tuned Open Generative Large Language Models](https://arxiv.org/abs/2308.16149)
85
+ - **Demo :** [Access here](https://arabic-gpt.ai)
86
+
87
+
88
+ ## Intended Use
89
+
90
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
91
+ We release the Jais 13B model under a full open source license. We welcome all feedback and opportunities to collaborate.
92
+
93
+ This model is the first release from the Inception - MBZUAI - Cerebras parternship, and at the time of release,
94
+ achieved state of the art across a comprehensive Arabic test suite as described in the accompanying technical report.
95
+ Some potential downstream uses include:
96
+
97
+ - *Research*: This model can be used by researchers and developers.
98
+ - *Commercial Use*: It can be used as a base model to further fine-tune for specific use cases (similar to [jais-13b-chat](https://huggingface.co/inception-mbzuai/jais-13b-chat)).
99
+ Some potential use cases include:
100
+ - Chat-assistants.
101
+ - Customer service.
102
+
103
+ Audiences that we hope will benefit from our model:
104
+ - *Academics*: For those researching Arabic natural language processing.
105
+ - *Businesses*: Companies targeting Arabic-speaking audiences.
106
+ - *Developers*: Those integrating Arabic language capabilities in apps.
107
+
108
+
109
+ ### Out-of-Scope Use
110
+
111
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
112
+
113
+ While Jais-13b is a powerful Arabic and English bilingual model, it's essential to understand its limitations and the potential of misuse.
114
+ It is prohibited to use the model in any manner that violates applicable laws or regulations.
115
+ The following are some example scenarios where the model should not be used.
116
+
117
+ - *Malicious Use*: The model should not be used for generating harmful, misleading, or inappropriate content. This includes but is not limited to:
118
+ - Generating or promoting hate speech, violence, or discrimination.
119
+ - Spreading misinformation or fake news.
120
+ - Engaging in or promoting illegal activities.
121
+
122
+ - *Sensitive Information*: The model should not be used to handle or generate personal, confidential, or sensitive information.
123
+
124
+ - *Generalization Across All Languages*: Jais-13b is bilingual and optimized for Arabic and English, it should not be assumed to have equal proficiency in other languages or dialects.
125
+
126
+ - *High-Stakes Decisions*: The model should not be used to make high-stakes decisions without human oversight. This includes medical, legal, financial, or safety-critical decisions.
127
+
128
+
129
+
130
+ ## Bias, Risks, and Limitations
131
+
132
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
133
+
134
+ The model is trained on publicly available data which was in part curated by Inception. We have employed different
135
+ techniqes to reduce bias in the model. While efforts have been made to minimize biases, it is likely that the model, as with all LLM models, will exhibit some bias.
136
+
137
+ The model is trained as an AI assistant for Arabic and English speakers. The model is limited to produce responses for queries in these two languages
138
+ and may not produce appropriate responses to other language queries.
139
+
140
+ By using Jais, you acknowledge and accept that, as with any large language model, it may generate incorrect, misleading and/or offensive information or content.
141
+ The information is not intended as advice and should not be relied upon in any way, nor are we responsible for any of the content or consequences resulting from its use.
142
+ We are continuously working to develop models with greater capabilities, and as such, welcome any feedback on the model
143
+
144
+ ## Training Details
145
+
146
+ ### Training Data
147
+
148
+ <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
149
+
150
+ For the pre-training of Jais-13b, we used a diverse bilingual corpus sourced from the Web and other sources. We also used publicly available English and code datasets.
151
+ To collect Arabic data, we use multiple sources including web pages, wikipedia articles, news articles, Arabic books,
152
+ and social network content. We augment the volume of Arabic data by translating English to Arabic using an in-house machine translation system.
153
+ We restrict this to high quality English resources such as English Wikipedia and English books. Further details about the training data can be found in the technical report.
154
+
155
+
156
+ ### Training Procedure
157
+
158
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
159
+
160
+
161
+ Training was performed on the Condor Galaxy 1 (CG-1) supercomputer platform.
162
+
163
+ #### Training Hyperparameters
164
+
165
+ | Hyperparameter | Value |
166
+ |----------------------------|------------------------------|
167
+ | Precision | fp32 |
168
+ | Optimizer | AdamW |
169
+ | Learning rate | 0 to 0.012 (<= 95 steps) |
170
+ | | 0.012 to 0.0012 (> 95 steps) |
171
+ | Weight decay | 0.1 |
172
+ | Batch size | 1920 |
173
+ | Steps | 100551 |
174
+
175
+
176
+
177
+
178
+ ## Evaluation
179
+
180
+ <!-- This section describes the evaluation protocols and provides the results. -->
181
+
182
+ We conducted a comprehensive evaluation of Jais and benchmarked it other leading base language models, focusing on both English and Arabic. The evaluation criteria spanned various dimensions, including:
183
+
184
+ - **Knowledge:** How well the model answers factual questions.
185
+ - **Reasoning:** The model's ability to answer questions requiring reasoning.
186
+ - **Misinformation/Bias:** Assessment of the model's susceptibility to generating false or misleading information, and its neutrality.
187
+
188
+ Arabic evaluation results:
189
+
190
+ | Models | Avg | EXAMS | MMLU (M) | LitQA | Hellaswag | PIQA | BoolQA | SituatedQA | ARC-C | OpenBookQA | TruthfulQA | CrowS-Pairs |
191
+ |-------------|-------|-------|----------|-------|-----------|------|--------|------------|-------|------------|------------|-------------|
192
+ | Jais (13B) | **46.5** | 40.4 | 30.0 | 58.3 | 57.7 | 67.6 | 62.6 | 42.5 | 35.8 | 32.4 | 41.1 | 58.4 |
193
+ | BLOOM (7.1B) | 40.9 |34.0 | 28.2 | 37.1 | 40.9 | 58.4 | 59.9 | 39.1 | 27.3 | 28.0 | 44.4 | 53.5 |
194
+ | LLaMA2 (13B) | 38.1 | 29.2 | 28.4 | 32.0 | 34.3 | 52.9 | 63.8 | 36.4 | 24.3 | 30.0 | 45.5 | 49.9 |
195
+ | AraT5 (220M) | 32.0 | 24.7 | 23.8 | 26.3 | 25.5 | 50.4 | 58.2 | 33.9 | 24.7 | 25.4 | 20.9 | 47.2 |
196
+ | AraBART (550M) | 36.7 | 26.5 | 27.5 | 34.3 | 28.1 | 52.6 | 57.1 | 34.6 | 25.1 | 28.6 | 49.8 | 48.8 |
197
+
198
+
199
+ All tasks above report accuracy or F1 scores (the higher the better). For the sake of brevity, we do not include results over English tasks.
200
+ Detailed comparisons in both languages and evaluation dataset details can be found in the technical report.
201
+
202
+
203
+
204
+
205
+ ## Citation
206
+
207
+ ```
208
+ @misc{sengupta2023jais,
209
+ title={Jais and Jais-chat: Arabic-Centric Foundation and Instruction-Tuned Open Generative Large Language Models},
210
+ author={Neha Sengupta and Sunil Kumar Sahu and Bokang Jia and Satheesh Katipomu and Haonan Li and Fajri Koto and Osama Mohammed Afzal and Samta Kamboj and Onkar Pandit and Rahul Pal and Lalit Pradhan and Zain Muhammad Mujahid and Massa Baali and Alham Fikri Aji and Zhengzhong Liu and Andy Hock and Andrew Feldman and Jonathan Lee and Andrew Jackson and Preslav Nakov and Timothy Baldwin and Eric Xing},
211
+ year={2023},
212
+ eprint={2308.16149},
213
+ archivePrefix={arXiv},
214
+ primaryClass={cs.CL}
215
+ }
216
+
217
+ ```
218
+
219
+
220
+ Copyright Inception Institute of Artificial Intelligence Ltd.