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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
falcon-7b-instruct - bnb 8bits
|
11 |
+
- Model creator: https://huggingface.co/tiiuae/
|
12 |
+
- Original model: https://huggingface.co/tiiuae/falcon-7b-instruct/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
datasets:
|
20 |
+
- tiiuae/falcon-refinedweb
|
21 |
+
language:
|
22 |
+
- en
|
23 |
+
inference: true
|
24 |
+
new_version: tiiuae/falcon-11B
|
25 |
+
widget:
|
26 |
+
- text: "Hey Falcon! Any recommendations for my holidays in Abu Dhabi?"
|
27 |
+
example_title: "Abu Dhabi Trip"
|
28 |
+
- text: "What's the Everett interpretation of quantum mechanics?"
|
29 |
+
example_title: "Q/A: Quantum & Answers"
|
30 |
+
- text: "Give me a list of the top 10 dive sites you would recommend around the world."
|
31 |
+
example_title: "Diving Top 10"
|
32 |
+
- text: "Can you tell me more about deep-water soloing?"
|
33 |
+
example_title: "Extreme sports"
|
34 |
+
- text: "Can you write a short tweet about the Apache 2.0 release of our latest AI model, Falcon LLM?"
|
35 |
+
example_title: "Twitter Helper"
|
36 |
+
- text: "What are the responsabilities of a Chief Llama Officer?"
|
37 |
+
example_title: "Trendy Jobs"
|
38 |
+
license: apache-2.0
|
39 |
+
---
|
40 |
+
|
41 |
+
# β¨ Falcon-7B-Instruct
|
42 |
+
|
43 |
+
**Falcon-7B-Instruct is a 7B parameters causal decoder-only model built by [TII](https://www.tii.ae) based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and finetuned on a mixture of chat/instruct datasets. It is made available under the Apache 2.0 license.**
|
44 |
+
|
45 |
+
*Paper coming soon π.*
|
46 |
+
|
47 |
+
π€ To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
|
48 |
+
|
49 |
+
## Why use Falcon-7B-Instruct?
|
50 |
+
|
51 |
+
* **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
|
52 |
+
* **Falcon-7B is a strong base model, outperforming comparable open-source models** (e.g., [MPT-7B](https://huggingface.co/mosaicml/mpt-7b), [StableLM](https://github.com/Stability-AI/StableLM), [RedPajama](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-7B-v0.1) etc.), thanks to being trained on 1,500B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
|
53 |
+
* **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)).
|
54 |
+
|
55 |
+
π¬ **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-7B](https://huggingface.co/tiiuae/falcon-7b).
|
56 |
+
|
57 |
+
π₯ **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
|
58 |
+
|
59 |
+
```python
|
60 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
61 |
+
import transformers
|
62 |
+
import torch
|
63 |
+
|
64 |
+
model = "tiiuae/falcon-7b-instruct"
|
65 |
+
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
67 |
+
pipeline = transformers.pipeline(
|
68 |
+
"text-generation",
|
69 |
+
model=model,
|
70 |
+
tokenizer=tokenizer,
|
71 |
+
torch_dtype=torch.bfloat16,
|
72 |
+
trust_remote_code=True,
|
73 |
+
device_map="auto",
|
74 |
+
)
|
75 |
+
sequences = pipeline(
|
76 |
+
"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:",
|
77 |
+
max_length=200,
|
78 |
+
do_sample=True,
|
79 |
+
top_k=10,
|
80 |
+
num_return_sequences=1,
|
81 |
+
eos_token_id=tokenizer.eos_token_id,
|
82 |
+
)
|
83 |
+
for seq in sequences:
|
84 |
+
print(f"Result: {seq['generated_text']}")
|
85 |
+
|
86 |
+
```
|
87 |
+
|
88 |
+
π₯ **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
|
89 |
+
|
90 |
+
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).
|
91 |
+
|
92 |
+
You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B-Instruct.
|
93 |
+
|
94 |
+
|
95 |
+
# Model Card for Falcon-7B-Instruct
|
96 |
+
|
97 |
+
## Model Details
|
98 |
+
|
99 |
+
### Model Description
|
100 |
+
|
101 |
+
- **Developed by:** [https://www.tii.ae](https://www.tii.ae);
|
102 |
+
- **Model type:** Causal decoder-only;
|
103 |
+
- **Language(s) (NLP):** English and French;
|
104 |
+
- **License:** Apache 2.0;
|
105 |
+
- **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
106 |
+
|
107 |
+
### Model Source
|
108 |
+
|
109 |
+
- **Paper:** *coming soon*.
|
110 |
+
|
111 |
+
## Uses
|
112 |
+
|
113 |
+
### Direct Use
|
114 |
+
|
115 |
+
Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
|
116 |
+
|
117 |
+
### Out-of-Scope Use
|
118 |
+
|
119 |
+
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
|
120 |
+
|
121 |
+
## Bias, Risks, and Limitations
|
122 |
+
|
123 |
+
Falcon-7B-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.
|
124 |
+
|
125 |
+
### Recommendations
|
126 |
+
|
127 |
+
We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
|
128 |
+
|
129 |
+
## How to Get Started with the Model
|
130 |
+
|
131 |
+
|
132 |
+
```python
|
133 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
134 |
+
import transformers
|
135 |
+
import torch
|
136 |
+
|
137 |
+
model = "tiiuae/falcon-7b-instruct"
|
138 |
+
|
139 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
140 |
+
pipeline = transformers.pipeline(
|
141 |
+
"text-generation",
|
142 |
+
model=model,
|
143 |
+
tokenizer=tokenizer,
|
144 |
+
torch_dtype=torch.bfloat16,
|
145 |
+
trust_remote_code=True,
|
146 |
+
device_map="auto",
|
147 |
+
)
|
148 |
+
sequences = pipeline(
|
149 |
+
"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:",
|
150 |
+
max_length=200,
|
151 |
+
do_sample=True,
|
152 |
+
top_k=10,
|
153 |
+
num_return_sequences=1,
|
154 |
+
eos_token_id=tokenizer.eos_token_id,
|
155 |
+
)
|
156 |
+
for seq in sequences:
|
157 |
+
print(f"Result: {seq['generated_text']}")
|
158 |
+
|
159 |
+
```
|
160 |
+
|
161 |
+
## Training Details
|
162 |
+
|
163 |
+
### Training Data
|
164 |
+
|
165 |
+
Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
|
166 |
+
|
167 |
+
| **Data source** | **Fraction** | **Tokens** | **Description** |
|
168 |
+
|--------------------|--------------|------------|-----------------------------------|
|
169 |
+
| [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
|
170 |
+
| [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
|
171 |
+
| [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
|
172 |
+
| [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
|
173 |
+
|
174 |
+
|
175 |
+
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
|
176 |
+
|
177 |
+
|
178 |
+
## Evaluation
|
179 |
+
|
180 |
+
*Paper coming soon.*
|
181 |
+
|
182 |
+
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
|
183 |
+
|
184 |
+
Note that this model variant is not optimized for NLP benchmarks.
|
185 |
+
|
186 |
+
|
187 |
+
## Technical Specifications
|
188 |
+
|
189 |
+
For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
190 |
+
|
191 |
+
### Model Architecture and Objective
|
192 |
+
|
193 |
+
Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
194 |
+
|
195 |
+
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
|
196 |
+
|
197 |
+
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
|
198 |
+
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
|
199 |
+
* **Decoder-block:** parallel attention/MLP with a single layer norm.
|
200 |
+
|
201 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
202 |
+
|--------------------|-----------|----------------------------------------|
|
203 |
+
| Layers | 32 | |
|
204 |
+
| `d_model` | 4544 | Increased to compensate for multiquery |
|
205 |
+
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
|
206 |
+
| Vocabulary | 65024 | |
|
207 |
+
| Sequence length | 2048 | |
|
208 |
+
|
209 |
+
### Compute Infrastructure
|
210 |
+
|
211 |
+
#### Hardware
|
212 |
+
|
213 |
+
Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
|
214 |
+
|
215 |
+
#### Software
|
216 |
+
|
217 |
+
Falcon-7B-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.)
|
218 |
+
|
219 |
+
|
220 |
+
## Citation
|
221 |
+
|
222 |
+
*Paper coming soon* π. In the meanwhile, you can use the following information to cite:
|
223 |
+
```
|
224 |
+
@article{falcon40b,
|
225 |
+
title={{Falcon-40B}: an open large language model with state-of-the-art performance},
|
226 |
+
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},
|
227 |
+
year={2023}
|
228 |
+
}
|
229 |
+
```
|
230 |
+
|
231 |
+
To learn more about the pretraining dataset, see the π [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
|
232 |
+
|
233 |
+
```
|
234 |
+
@article{refinedweb,
|
235 |
+
title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
|
236 |
+
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},
|
237 |
+
journal={arXiv preprint arXiv:2306.01116},
|
238 |
+
eprint={2306.01116},
|
239 |
+
eprinttype = {arXiv},
|
240 |
+
url={https://arxiv.org/abs/2306.01116},
|
241 |
+
year={2023}
|
242 |
+
}
|
243 |
+
```
|
244 |
+
|
245 |
+
|
246 |
+
## License
|
247 |
+
|
248 |
+
Falcon-7B-Instruct is made available under the Apache 2.0 license.
|
249 |
+
|
250 |
+
## Contact
|
251 |
+
falconllm@tii.ae
|
252 |
+
|