GGUF
English
aashish1904 commited on
Commit
3fd7434
1 Parent(s): fd46028

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +319 -0
README.md ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ datasets:
5
+ - tiiuae/falcon-refinedweb
6
+ - HuggingFaceFW/fineweb-edu
7
+ language:
8
+ - en
9
+ license: other
10
+ license_name: falcon-mamba-7b-license
11
+ license_link: https://falconllm.tii.ae/falcon-mamba-7b-terms-and-conditions.html
12
+ base_model: tiiuae/falcon-mamba-7b
13
+
14
+ ---
15
+
16
+ ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
17
+
18
+ # QuantFactory/falcon-mamba-7b-instruct-GGUF
19
+ This is quantized version of [tiiuae/falcon-mamba-7b-instruct](https://huggingface.co/tiiuae/falcon-mamba-7b-instruct) created using llama.cpp
20
+
21
+ # Original Model Card
22
+
23
+
24
+ <img src="https://huggingface.co/datasets/tiiuae/documentation-images/resolve/main/falcon_mamba/thumbnail.png" alt="drawing" width="800"/>
25
+
26
+ **Model card for FalconMamba Instruct model**
27
+
28
+ # Table of Contents
29
+
30
+ 0. [TL;DR](#TL;DR)
31
+ 1. [Model Details](#model-details)
32
+ 2. [Usage](#usage)
33
+ 3. [Training Details](#training-details)
34
+ 4. [Evaluation](#evaluation)
35
+
36
+
37
+ # TL;DR
38
+
39
+ # Model Details
40
+
41
+ ## Model Description
42
+
43
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae)
44
+ - **Model type:** Causal decoder-only
45
+ - **Architecture:** Mamba
46
+ - **Language(s) (NLP):** Mainly English
47
+ - **License:** TII Falcon-Mamba License 2.0
48
+
49
+ <br>
50
+
51
+ # Usage
52
+
53
+ Find below some example scripts on how to use the model in `transformers` (Make sure to have the latest transformers, or the one built from source):
54
+
55
+ ## Using the Pytorch model
56
+
57
+ ### Running the model on a CPU
58
+
59
+ <details>
60
+ <summary> Click to expand </summary>
61
+
62
+ ```python
63
+ from transformers import AutoTokenizer, AutoModelForCausalLM
64
+
65
+ tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-mamba-7b-instruct")
66
+ model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-mamba-7b-instruct")
67
+
68
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
69
+ messages = [
70
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
71
+ ]
72
+
73
+ input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
74
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids
75
+
76
+ outputs = model.generate(input_ids, max_new_tokens=30)
77
+ print(tokenizer.decode(outputs[0]))
78
+ ```
79
+
80
+ </details>
81
+
82
+ ### Running the model on a GPU
83
+
84
+ <details>
85
+ <summary> Click to expand </summary>
86
+
87
+ ```python
88
+ # pip install accelerate
89
+ from transformers import AutoTokenizer, AutoModelForCausalLM
90
+
91
+ tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-mamba-7b-instruct")
92
+ model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-mamba-7b-instruct", device_map="auto")
93
+
94
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
95
+ messages = [
96
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
97
+ ]
98
+
99
+ input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
100
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
101
+
102
+ outputs = model.generate(input_ids, max_new_tokens=30)
103
+ print(tokenizer.decode(outputs[0]))
104
+ ```
105
+
106
+ </details>
107
+
108
+ ### Running the model on a GPU using `torch.compile`
109
+
110
+ <details>
111
+ <summary> Click to expand </summary>
112
+
113
+ ```python
114
+ import torch
115
+ from transformers import AutoTokenizer, AutoModelForCausalLM
116
+
117
+ tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-mamba-7b-instruct")
118
+ model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-mamba-7b-instruct", torch_dtype=torch.bfloat16).to(0)
119
+
120
+ model = torch.compile(model)
121
+
122
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
123
+ messages = [
124
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
125
+ ]
126
+ input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
127
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
128
+
129
+ outputs = model.generate(input_ids, max_new_tokens=30)
130
+ print(tokenizer.decode(outputs[0]))
131
+ ```
132
+
133
+ </details>
134
+
135
+
136
+ ### Running the model on a GPU using different precisions
137
+
138
+ #### FP16
139
+
140
+ <details>
141
+ <summary> Click to expand </summary>
142
+
143
+ ```python
144
+ # pip install accelerate
145
+ import torch
146
+ from transformers import AutoTokenizer, AutoModelForCausalLM
147
+
148
+ tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-mamba-7b-instruct")
149
+ model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-mamba-7b-instruct", device_map="auto", torch_dtype=torch.float16)
150
+
151
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
152
+ messages = [
153
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
154
+ ]
155
+ input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
156
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
157
+
158
+ outputs = model.generate(input_ids, max_new_tokens=30)
159
+ print(tokenizer.decode(outputs[0]))
160
+ ```
161
+
162
+ </details>
163
+
164
+ #### 4-bit
165
+
166
+ <details>
167
+ <summary> Click to expand </summary>
168
+
169
+ ```python
170
+ # pip install bitsandbytes accelerate
171
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
172
+
173
+ tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-mamba-7b-instruct")
174
+ model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-mamba-7b-instruct", device_map="auto", quantization_config=BitsAndBytesConfig(load_in_4bit=True))
175
+
176
+ # We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
177
+ messages = [
178
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
179
+ ]
180
+ input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
181
+ input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
182
+
183
+ outputs = model.generate(input_ids, max_new_tokens=30)
184
+ print(tokenizer.decode(outputs[0]))
185
+ ```
186
+
187
+ </details>
188
+
189
+ <br>
190
+
191
+ # Training Details
192
+
193
+ ## Training Data
194
+
195
+ Falcon-Mamba has been trained with ~ 5,500 GT mainly coming from [Refined-Web](https://huggingface.co/datasets/tiiuae/falcon-refinedweb), a large volume web-only dataset filtered and deduplicated.
196
+ Similar to the others [Falcon](https://huggingface.co/tiiuae/falcon-11B) suite models, Falcon-Mamba has been trained leveraging a multi-stage training strategy to increase the context-length from 2,048 to 8,192.
197
+ Moreover, inspired by the concept of Curriculum Learning, we carefully selected data mixtures throughout the training stages, considering both data diversity and complexity.
198
+ Note that at inference the context-length is not relevant as the Mamba architecture has no limit on long range dependency.
199
+ At the last training stage, small portion of high-quality curated data was used to further enhance performance.
200
+
201
+ Overall, the data sources included RefinedWeb-English, high quality technical data, code data and math data extracted from public sources.
202
+ In particular, we used samples coming from [Fineweb-edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) during our last training stage.
203
+
204
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7B)/[11B](https://huggingface.co/tiiuae/falcon-11B) tokenizer.
205
+
206
+ After pre-training, the model has been further fine-tuned on instruction data.
207
+
208
+ ## Training Procedure
209
+ Falcon-Mamba-7B was trained on 256 H100 80GB GPUs for the majority of the training, using a 3D parallelism strategy (TP=1, PP=1, DP=256) combined with ZeRO.
210
+
211
+ ### Training Hyperparameters
212
+
213
+ | **Hyperparameter** | **Value** | **Comment** |
214
+ |--------------------|------------|-------------------------------------------|
215
+ | Precision | `bfloat16` | |
216
+ | Optimizer | AdamW | |
217
+ | Max learning rate | 6.4e-4 | Following a WSD (warmup-stable-decay) learning rate schedule |
218
+ | Weight decay | 1e-1 | |
219
+ | Batch size | 2048 | |
220
+
221
+
222
+ The model was trained AdamW optimizer, WSD (warmup-stable-decay) learning rate schedule, and a batch size rampup from \\(b_{\mathrm{min}}=128\\) to \\(b_{\mathrm{max}}=2048\\) during first 50 GT of training.
223
+ In the stable phase we used maximal learning rate \\(\eta_{\mathrm{max}}=6.4 \times 10^{-4}\\), and decayed it to the minimal value \\(\eta_{\mathrm{min}}=\frac{\eta_{\mathrm{max}}}{256}\\) with exponential schedule over 500 GT.
224
+ Also, we applied *BatchScaling* during the rampup — rescaling learning rate \\(\eta\\) so that the Adam noise temperature \\(T_{\mathrm{noise}}\equiv\frac{\eta}{\sqrt{b}}\\) is kept constant.
225
+
226
+ ### Speeds, Sizes, Times
227
+
228
+ The model training took roughly two months.
229
+
230
+ <br>
231
+
232
+ # Evaluation
233
+
234
+ ## Benchmarks
235
+
236
+ We evaluate our model on all benchmarks of the new leaderboard's version using the `lm-evaluation-harness` package, and then normalize the evaluation results with HuggingFace score normalization.
237
+
238
+
239
+ | `model name` |`IFEval`| `BBH` |`MATH LvL5`| `GPQA`| `MUSR`|`MMLU-PRO`|`Average`|
240
+ |:--------------------------|:------:|:-----:|:---------:|:-----:|:-----:|:--------:|:-------:|
241
+ | ***Pure SSM models*** | | | | | | | |
242
+ | `FalconMamba-7B` | 33.36 | 19.88 | 3.63 |8.05 |10.86 | 14.47 |**15.04**|
243
+ | `TRI-ML/mamba-7b-rw`<sup>*</sup>| 22.46 | 6.71 | 0.45 | 1.12 | 5.51 | 1.69 | 6.25 |
244
+ |***Hybrid SSM-attention models*** | | | | | | |
245
+ |`recurrentgemma-9b` | 30.76 | 14.80 | 4.83 | 4.70 | 6.60 | 17.88 | 13.20 |
246
+ | `Zyphra/Zamba-7B-v1`<sup>*</sup> | 24.06 | 21.12 | 3.32 | 3.03 | 7.74 | 16.02 | 12.55 |
247
+ |***Transformer models*** | | | | | | | |
248
+ | `Falcon2-11B` | 32.61 | 21.94 | 2.34 | 2.80 | 7.53 | 15.44 | 13.78 |
249
+ | `Meta-Llama-3-8B` | 14.55 | 24.50 | 3.25 | 7.38 | 6.24 | 24.55 | 13.41 |
250
+ | `Meta-Llama-3.1-8B` | 12.70 | 25.29 | 4.61 | 6.15 | 8.98 | 24.95 | 13.78 |
251
+ | `Mistral-7B-v0.1` | 23.86 | 22.02 | 2.49 | 5.59 | 10.68 | 22.36 | 14.50 |
252
+ | `Mistral-Nemo-Base-2407 (12B)` | 16.83 | 29.37 | 4.98 | 5.82 | 6.52 | 27.46 | 15.08 |
253
+ | `gemma-7B` | 26.59 | 21.12 | 6.42 | 4.92 | 10.98 | 21.64 |**15.28**|
254
+
255
+
256
+ Also, we evaluate our model on the benchmarks of the first leaderboard using `lighteval`.
257
+
258
+
259
+ | `model name` |`ARC`|`HellaSwag` |`MMLU` |`Winogrande`|`TruthfulQA`|`GSM8K`|`Average` |
260
+ |:-----------------------------|:------:|:---------:|:-----:|:----------:|:----------:|:-----:|:----------------:|
261
+ | ***Pure SSM models*** | | | | | | | |
262
+ | `FalconMamba-7B`<sup>*</sup> | 62.03 | 80.82 | 62.11 | 73.64 | 53.42 | 52.54 | **64.09** |
263
+ | `TRI-ML/mamba-7b-rw`<sup>*</sup> | 51.25 | 80.85 | 33.41 | 71.11 | 32.08 | 4.70 | 45.52 |
264
+ |***Hybrid SSM-attention models***| | | | | | | |
265
+ | `recurrentgemma-9b`<sup>**</sup> |52.00 | 80.40 | 60.50 | 73.60 | 38.60 | 42.60 | 57.95 |
266
+ | `Zyphra/Zamba-7B-v1`<sup>*</sup> | 56.14 | 82.23 | 58.11 | 79.87 | 52.88 | 30.78 | 60.00 |
267
+ |***Transformer models*** | | | | | | | |
268
+ | `Falcon2-11B` | 59.73 | 82.91 | 58.37 | 78.30 | 52.56 | 53.83 | **64.28** |
269
+ | `Meta-Llama-3-8B` | 60.24 | 82.23 | 66.70 | 78.45 | 42.93 | 45.19 | 62.62 |
270
+ | `Meta-Llama-3.1-8B` | 58.53 | 82.13 | 66.43 | 74.35 | 44.29 | 47.92 | 62.28 |
271
+ | `Mistral-7B-v0.1` | 59.98 | 83.31 | 64.16 | 78.37 | 42.15 | 37.83 | 60.97 |
272
+ | `gemma-7B` | 61.09 | 82.20 | 64.56 | 79.01 | 44.79 | 50.87 | 63.75 |
273
+
274
+ Mostly, we took evaluation results from both leaderboards. For the models marked by *star* we evaluated the tasks internally, while for the models marked by two *stars* the results were taken from paper or model card.
275
+
276
+ ## Throughput
277
+
278
+ This model can achieve comparable throughput and performance compared to other transformer based models that use optimized kernels such as Flash Attention 2. Make sure to install the optimized Mamba kernels with the following commands:
279
+
280
+ ```bash
281
+ pip install "causal-conv1d>=1.4.0" mamba-ssm
282
+ ```
283
+
284
+ Refer to our [FalconMamba blogpost](https://huggingface.co/blog/falconmamba) for more details about performance evaluation.
285
+
286
+
287
+ <br>
288
+
289
+ # Technical Specifications
290
+
291
+ ## Model Architecture and Objective
292
+
293
+ Falcon-Mamba-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
294
+
295
+ The model is based on the Mamba architecture ([Gu et al., 2023](https://arxiv.org/abs/2312.00752)).
296
+
297
+ | **Hyperparameter** | **Value** | **Comment** |
298
+ |--------------------|-----------|----------------------------------------|
299
+ | Layers | 64 | Number of layers |
300
+ | `d_model` | 4096 | Hidden dimension |
301
+ | `d_state` | 16 | The SSM state dimension |
302
+ | Vocabulary | 65024 | Vocabulary Size |
303
+ | Sequence length | 8192 | During the last training stages |
304
+
305
+ ## Compute Infrastructure
306
+
307
+ ### Hardware
308
+
309
+ Falcon-Mamba-7B was trained on AWS SageMaker, using on average 256 H100 80GB GPUs in 32 p5 instances.
310
+
311
+ ### Software
312
+
313
+ Falcon-Mamba-7B was trained on an internal distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO, high-performance Triton kernels.
314
+
315
+ <br>
316
+
317
+ # Citation
318
+
319
+ *Paper coming soon* 😊.