slippylolo
commited on
Commit
โข
38377d0
1
Parent(s):
74aef5b
Add model card
Browse files
README.md
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- tiiuae/falcon-refinedweb
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
inference: false
|
7 |
+
---
|
8 |
+
|
9 |
+
# โจ Falcon-40B-Instruct
|
10 |
+
|
11 |
+
**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 [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-40b-instruct/blob/main/LICENSE.txt).**
|
12 |
+
|
13 |
+
*Paper coming soon ๐.*
|
14 |
+
|
15 |
+
## Why use Falcon-40B-Instruct?
|
16 |
+
|
17 |
+
* **You are looking for a ready-to-use chat/instruct model based on [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).**
|
18 |
+
* **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).
|
19 |
+
* **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)).
|
20 |
+
|
21 |
+
๐ฌ **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).
|
22 |
+
|
23 |
+
๐ธ **Looking for a smaller, less expensive model?** [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) is Falcon-40B-Instruct's small brother!
|
24 |
+
|
25 |
+
```python
|
26 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
27 |
+
import transformers
|
28 |
+
import torch
|
29 |
+
|
30 |
+
model = "tiiuae/falcon-40b-instruct"
|
31 |
+
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
33 |
+
pipeline = transformers.pipeline(
|
34 |
+
"text-generation",
|
35 |
+
model=model,
|
36 |
+
tokenizer=tokenizer,
|
37 |
+
torch_dtype=torch.bfloat16,
|
38 |
+
trust_remote_code=True,
|
39 |
+
device_map="auto",
|
40 |
+
)
|
41 |
+
sequences = pipeline(
|
42 |
+
"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:",
|
43 |
+
max_length=200,
|
44 |
+
do_sample=True,
|
45 |
+
top_k=10,
|
46 |
+
num_return_sequences=1,
|
47 |
+
eos_token_id=tokenizer.eos_token_id,
|
48 |
+
)
|
49 |
+
for seq in sequences:
|
50 |
+
print(f"Result: {seq['generated_text']}")
|
51 |
+
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
# Model Card for Falcon-40B-Instruct
|
57 |
+
|
58 |
+
## Model Details
|
59 |
+
|
60 |
+
### Model Description
|
61 |
+
|
62 |
+
- **Developed by:** [https://www.tii.ae](https://www.tii.ae);
|
63 |
+
- **Model type:** Causal decoder-only;
|
64 |
+
- **Language(s) (NLP):** English and French;
|
65 |
+
- **License:** [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-7b-instruct/blob/main/LICENSE.txt);
|
66 |
+
- **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
|
67 |
+
|
68 |
+
### Model Source
|
69 |
+
|
70 |
+
- **Paper:** *coming soon*.
|
71 |
+
|
72 |
+
## Uses
|
73 |
+
|
74 |
+
### Direct Use
|
75 |
+
|
76 |
+
Falcon-40B-Instruct has been finetuned on a chat dataset.
|
77 |
+
|
78 |
+
### Out-of-Scope Use
|
79 |
+
|
80 |
+
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
|
81 |
+
|
82 |
+
## Bias, Risks, and Limitations
|
83 |
+
|
84 |
+
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.
|
85 |
+
|
86 |
+
### Recommendations
|
87 |
+
|
88 |
+
We recommend users of Falcon-40B-Instruct to develop guardrails and to take appropriate precautions for any production use.
|
89 |
+
|
90 |
+
## How to Get Started with the Model
|
91 |
+
|
92 |
+
|
93 |
+
```python
|
94 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
95 |
+
import transformers
|
96 |
+
import torch
|
97 |
+
|
98 |
+
model = "tiiuae/falcon-40b-instruct"
|
99 |
+
|
100 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
101 |
+
pipeline = transformers.pipeline(
|
102 |
+
"text-generation",
|
103 |
+
model=model,
|
104 |
+
tokenizer=tokenizer,
|
105 |
+
torch_dtype=torch.bfloat16,
|
106 |
+
trust_remote_code=True,
|
107 |
+
device_map="auto",
|
108 |
+
)
|
109 |
+
sequences = pipeline(
|
110 |
+
"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:",
|
111 |
+
max_length=200,
|
112 |
+
do_sample=True,
|
113 |
+
top_k=10,
|
114 |
+
num_return_sequences=1,
|
115 |
+
eos_token_id=tokenizer.eos_token_id,
|
116 |
+
)
|
117 |
+
for seq in sequences:
|
118 |
+
print(f"Result: {seq['generated_text']}")
|
119 |
+
|
120 |
+
```
|
121 |
+
|
122 |
+
## Training Details
|
123 |
+
|
124 |
+
### Training Data
|
125 |
+
|
126 |
+
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.
|
127 |
+
|
128 |
+
|
129 |
+
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
|
130 |
+
|
131 |
+
|
132 |
+
## Evaluation
|
133 |
+
|
134 |
+
*Paper coming soon.*
|
135 |
+
|
136 |
+
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
|
137 |
+
|
138 |
+
|
139 |
+
## Technical Specifications
|
140 |
+
|
141 |
+
For more information about pretraining, see [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
|
142 |
+
|
143 |
+
### Model Architecture and Objective
|
144 |
+
|
145 |
+
Falcon-40B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
146 |
+
|
147 |
+
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
|
148 |
+
|
149 |
+
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
|
150 |
+
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
|
151 |
+
* **Decoder-block:** parallel attention/MLP with a single layer norm.
|
152 |
+
|
153 |
+
For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
|
154 |
+
|
155 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
156 |
+
|--------------------|-----------|----------------------------------------|
|
157 |
+
| Layers | 60 | |
|
158 |
+
| `d_model` | 8192 | |
|
159 |
+
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
|
160 |
+
| Vocabulary | 65024 | |
|
161 |
+
| Sequence length | 2048 | |
|
162 |
+
|
163 |
+
### Compute Infrastructure
|
164 |
+
|
165 |
+
#### Hardware
|
166 |
+
|
167 |
+
Falcon-40B-Instruct was trained on AWS SageMaker, on 64 A100 40GB GPUs in P4d instances.
|
168 |
+
|
169 |
+
#### Software
|
170 |
+
|
171 |
+
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.)
|
172 |
+
|
173 |
+
|
174 |
+
## Citation
|
175 |
+
|
176 |
+
*Paper coming soon ๐.*
|
177 |
+
|
178 |
+
## License
|
179 |
+
|
180 |
+
Falcon-40B-Instruct is made available under the [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-40b-instruct/blob/main/LICENSE.txt). Broadly speaking,
|
181 |
+
* You can freely use our models for research and/or personal purpose;
|
182 |
+
* You are allowed to share and build derivatives of these models, but you are required to give attribution and to share-alike with the same license;
|
183 |
+
* For commercial use, you are exempt from royalties payment if the attributable revenues are inferior to $1M/year, otherwise you should enter in a commercial agreement with TII.
|
184 |
+
|
185 |
+
|
186 |
+
## Contact
|
187 | |
188 |
+
|