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|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- tiiuae/falcon-refinedweb
|
5 |
+
language:
|
6 |
+
- en
|
7 |
---
|
8 |
+
<details>
|
9 |
+
<summary> Table of contents
|
10 |
+
|
11 |
+
</summary>
|
12 |
+
|
13 |
+
# Table of contents
|
14 |
+
|
15 |
+
[Original Model Card](#original-model-card-by-tiiuae)
|
16 |
+
|
17 |
+
</details>
|
18 |
+
|
19 |
+
<details>
|
20 |
+
<summary> Original Model Card by tiiuae
|
21 |
+
</summary>
|
22 |
+
|
23 |
+
# Original Model Card by tiiuae
|
24 |
+
[***Link to original model card***](https://huggingface.co/tiiuae/falcon-40b-instruct)
|
25 |
+
|
26 |
+
# โจ Falcon-40B-Instruct
|
27 |
+
|
28 |
+
**Falcon-40B-Instruct is a 40B parameters causal decoder-only model built by [TII](https://www.tii.ae) based on [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b) and finetuned on a mixture of [Baize](https://github.com/project-baize/baize-chatbot). It is made available under the Apache 2.0 license.**
|
29 |
+
|
30 |
+
*Paper coming soon ๐.*
|
31 |
+
|
32 |
+
๐ค To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
|
33 |
+
|
34 |
+
## Why use Falcon-40B-Instruct?
|
35 |
+
|
36 |
+
* **You are looking for a ready-to-use chat/instruct model based on [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).**
|
37 |
+
* **Falcon-40B is the best open-source model available.** It outperforms [LLaMA](https://github.com/facebookresearch/llama), [StableLM](https://github.com/Stability-AI/StableLM), [RedPajama](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-7B-v0.1), [MPT](https://huggingface.co/mosaicml/mpt-7b), etc. See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
|
38 |
+
* **It features an architecture optimized for inference**, with FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135)) and multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)).
|
39 |
+
|
40 |
+
๐ฌ **This is an instruct model, which may not be ideal for further finetuning.** If you are interested in building your own instruct/chat model, we recommend starting from [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
|
41 |
+
|
42 |
+
๐ธ **Looking for a smaller, less expensive model?** [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) is Falcon-40B-Instruct's little brother!
|
43 |
+
|
44 |
+
```python
|
45 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
46 |
+
import transformers
|
47 |
+
import torch
|
48 |
+
|
49 |
+
model = "tiiuae/falcon-40b-instruct"
|
50 |
+
|
51 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
52 |
+
pipeline = transformers.pipeline(
|
53 |
+
"text-generation",
|
54 |
+
model=model,
|
55 |
+
tokenizer=tokenizer,
|
56 |
+
torch_dtype=torch.bfloat16,
|
57 |
+
trust_remote_code=True,
|
58 |
+
device_map="auto",
|
59 |
+
)
|
60 |
+
sequences = pipeline(
|
61 |
+
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
|
62 |
+
max_length=200,
|
63 |
+
do_sample=True,
|
64 |
+
top_k=10,
|
65 |
+
num_return_sequences=1,
|
66 |
+
eos_token_id=tokenizer.eos_token_id,
|
67 |
+
)
|
68 |
+
for seq in sequences:
|
69 |
+
print(f"Result: {seq['generated_text']}")
|
70 |
+
|
71 |
+
```
|
72 |
+
|
73 |
+
For fast inference with Falcon, check-out [Text Generation Inference](https://github.com/huggingface/text-generation-inference)! Read more in this [blogpost]((https://huggingface.co/blog/falcon).
|
74 |
+
|
75 |
+
You will need **at least 85-100GB of memory** to swiftly run inference with Falcon-40B.
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
# Model Card for Falcon-40B-Instruct
|
80 |
+
|
81 |
+
## Model Details
|
82 |
+
|
83 |
+
### Model Description
|
84 |
+
|
85 |
+
- **Developed by:** [https://www.tii.ae](https://www.tii.ae);
|
86 |
+
- **Model type:** Causal decoder-only;
|
87 |
+
- **Language(s) (NLP):** English and French;
|
88 |
+
- **License:** Apache 2.0;
|
89 |
+
- **Finetuned from model:** [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
|
90 |
+
|
91 |
+
### Model Source
|
92 |
+
|
93 |
+
- **Paper:** *coming soon*.
|
94 |
+
|
95 |
+
## Uses
|
96 |
+
|
97 |
+
### Direct Use
|
98 |
+
|
99 |
+
Falcon-40B-Instruct has been finetuned on a chat dataset.
|
100 |
+
|
101 |
+
### Out-of-Scope Use
|
102 |
+
|
103 |
+
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
|
104 |
+
|
105 |
+
## Bias, Risks, and Limitations
|
106 |
+
|
107 |
+
Falcon-40B-Instruct is mostly trained on English data, and will not generalize appropriately to other languages. Furthermore, as it is trained on a large-scale corpora representative of the web, it will carry the stereotypes and biases commonly encountered online.
|
108 |
+
|
109 |
+
### Recommendations
|
110 |
+
|
111 |
+
We recommend users of Falcon-40B-Instruct to develop guardrails and to take appropriate precautions for any production use.
|
112 |
+
|
113 |
+
## How to Get Started with the Model
|
114 |
+
|
115 |
+
|
116 |
+
```python
|
117 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
118 |
+
import transformers
|
119 |
+
import torch
|
120 |
+
|
121 |
+
model = "tiiuae/falcon-40b-instruct"
|
122 |
+
|
123 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
124 |
+
pipeline = transformers.pipeline(
|
125 |
+
"text-generation",
|
126 |
+
model=model,
|
127 |
+
tokenizer=tokenizer,
|
128 |
+
torch_dtype=torch.bfloat16,
|
129 |
+
trust_remote_code=True,
|
130 |
+
device_map="auto",
|
131 |
+
)
|
132 |
+
sequences = pipeline(
|
133 |
+
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
|
134 |
+
max_length=200,
|
135 |
+
do_sample=True,
|
136 |
+
top_k=10,
|
137 |
+
num_return_sequences=1,
|
138 |
+
eos_token_id=tokenizer.eos_token_id,
|
139 |
+
)
|
140 |
+
for seq in sequences:
|
141 |
+
print(f"Result: {seq['generated_text']}")
|
142 |
+
|
143 |
+
```
|
144 |
+
|
145 |
+
## Training Details
|
146 |
+
|
147 |
+
### Training Data
|
148 |
+
|
149 |
+
Falcon-40B-Instruct was finetuned on a 150M tokens from [Bai ze](https://github.com/project-baize/baize-chatbot) mixed with 5% of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) data.
|
150 |
+
|
151 |
+
|
152 |
+
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
|
153 |
+
|
154 |
+
|
155 |
+
## Evaluation
|
156 |
+
|
157 |
+
*Paper coming soon.*
|
158 |
+
|
159 |
+
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
|
160 |
+
|
161 |
+
|
162 |
+
## Technical Specifications
|
163 |
+
|
164 |
+
For more information about pretraining, see [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
|
165 |
+
|
166 |
+
### Model Architecture and Objective
|
167 |
+
|
168 |
+
Falcon-40B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
169 |
+
|
170 |
+
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
|
171 |
+
|
172 |
+
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
|
173 |
+
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
|
174 |
+
* **Decoder-block:** parallel attention/MLP with a single layer norm.
|
175 |
+
|
176 |
+
For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
|
177 |
+
|
178 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
179 |
+
|--------------------|-----------|----------------------------------------|
|
180 |
+
| Layers | 60 | |
|
181 |
+
| `d_model` | 8192 | |
|
182 |
+
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
|
183 |
+
| Vocabulary | 65024 | |
|
184 |
+
| Sequence length | 2048 | |
|
185 |
+
|
186 |
+
### Compute Infrastructure
|
187 |
+
|
188 |
+
#### Hardware
|
189 |
+
|
190 |
+
Falcon-40B-Instruct was trained on AWS SageMaker, on 64 A100 40GB GPUs in P4d instances.
|
191 |
+
|
192 |
+
#### Software
|
193 |
+
|
194 |
+
Falcon-40B-Instruct was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention, etc.)
|
195 |
+
|
196 |
+
|
197 |
+
## Citation
|
198 |
+
|
199 |
+
*Paper coming soon* ๐. In the meanwhile, you can use the following information to cite:
|
200 |
+
```
|
201 |
+
@article{falcon40b,
|
202 |
+
title={{Falcon-40B}: an open large language model with state-of-the-art performance},
|
203 |
+
author={Almazrouei, Ebtesam and Alobeidli, Hamza and Alshamsi, Abdulaziz and Cappelli, Alessandro and Cojocaru, Ruxandra and Debbah, Merouane and Goffinet, Etienne and Heslow, Daniel and Launay, Julien and Malartic, Quentin and Noune, Badreddine and Pannier, Baptiste and Penedo, Guilherme},
|
204 |
+
year={2023}
|
205 |
+
}
|
206 |
+
```
|
207 |
+
|
208 |
+
To learn more about the pretraining dataset, see the ๐ [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
|
209 |
+
|
210 |
+
```
|
211 |
+
@article{refinedweb,
|
212 |
+
title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
|
213 |
+
author={Guilherme Penedo and Quentin Malartic and Daniel Hesslow and Ruxandra Cojocaru and Alessandro Cappelli and Hamza Alobeidli and Baptiste Pannier and Ebtesam Almazrouei and Julien Launay},
|
214 |
+
journal={arXiv preprint arXiv:2306.01116},
|
215 |
+
eprint={2306.01116},
|
216 |
+
eprinttype = {arXiv},
|
217 |
+
url={https://arxiv.org/abs/2306.01116},
|
218 |
+
year={2023}
|
219 |
+
}
|
220 |
+
```
|
221 |
+
|
222 |
+
To cite the [Baize](https://github.com/project-baize/baize-chatbot) instruction dataset used for this model:
|
223 |
+
```
|
224 |
+
@article{xu2023baize,
|
225 |
+
title={Baize: An Open-Source Chat Model with Parameter-Efficient Tuning on Self-Chat Data},
|
226 |
+
author={Xu, Canwen and Guo, Daya and Duan, Nan and McAuley, Julian},
|
227 |
+
journal={arXiv preprint arXiv:2304.01196},
|
228 |
+
year={2023}
|
229 |
+
}
|
230 |
+
```
|
231 |
+
|
232 |
+
|
233 |
+
## License
|
234 |
+
|
235 |
+
Falcon-40B-Instruct is made available under the Apache 2.0 license.
|
236 |
+
|
237 |
+
## Contact
|
238 |
+
falconllm@tii.ae
|