slippylolo
commited on
Commit
•
591607b
1
Parent(s):
555b780
Update model card
Browse files
README.md
CHANGED
@@ -3,43 +3,210 @@ datasets:
|
|
3 |
- tiiuae/falcon-refinedweb
|
4 |
language:
|
5 |
- en
|
|
|
6 |
---
|
7 |
|
8 |
-
# Falcon-7B
|
9 |
|
10 |
-
**Falcon-7B is a 7B parameters causal decoder-only model built by [TII](https://www.tii.ae) and trained on
|
11 |
|
12 |
-
|
13 |
|
|
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
|
|
|
|
|
|
|
18 |
## Model Details
|
19 |
|
20 |
### Model Description
|
21 |
|
22 |
-
- **Developed by:** [https://www.tii.ae](https://www.tii.ae)
|
23 |
-
- **Model type:** Causal decoder-only
|
24 |
-
- **Language(s) (NLP):** English
|
25 |
-
- **License:** TII Falcon LLM License
|
26 |
|
27 |
### Model Source
|
28 |
|
29 |
-
- **Paper:** coming soon
|
30 |
-
- **Demo:** coming soon
|
31 |
|
32 |
## Uses
|
33 |
|
|
|
|
|
|
|
|
|
34 |
### Out-of-Scope Use
|
35 |
|
36 |
-
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful
|
37 |
|
38 |
## Bias, Risks, and Limitations
|
39 |
|
40 |
-
Falcon-7B is trained on English and French data only, 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
|
43 |
-
##
|
|
|
44 |
|
45 |
-
More details coming soon in the paper.
|
|
|
3 |
- tiiuae/falcon-refinedweb
|
4 |
language:
|
5 |
- en
|
6 |
+
inference: false
|
7 |
---
|
8 |
|
9 |
+
# 🚀 Falcon-7B
|
10 |
|
11 |
+
**Falcon-7B is a 7B parameters causal decoder-only model built by [TII](https://www.tii.ae) and trained on 1,500B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. It is made available under the [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-7b/blob/main/LICENSE.txt).**
|
12 |
|
13 |
+
*Paper coming soon 😊.*
|
14 |
|
15 |
+
## Why use Falcon-7B?
|
16 |
|
17 |
+
* **It outperforms 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).
|
18 |
+
* **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)).
|
19 |
+
* **It is made available under a license allowing commercial use**, see the details of the [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-7b/blob/main/LICENSE.txt) below.
|
20 |
+
|
21 |
+
⚠️ **This is a raw, pretrained model, which should be further finetuned for most usecases.** If you are looking for a version better suited to taking generic instructions in a chat format, we recommend taking a look at [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct).
|
22 |
+
|
23 |
+
🔥 **Looking for an even more powerful model?** [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b) is Falcon-7B's big brother!
|
24 |
+
|
25 |
+
```python
|
26 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
27 |
+
import transformers
|
28 |
+
import torch
|
29 |
+
|
30 |
+
model = "tiiuae/falcon-7b"
|
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-7B
|
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/blob/main/LICENSE.txt).
|
66 |
|
67 |
### Model Source
|
68 |
|
69 |
+
- **Paper:** *coming soon*.
|
|
|
70 |
|
71 |
## Uses
|
72 |
|
73 |
+
### Direct Use
|
74 |
+
|
75 |
+
Research on large language models; as a foundation for further specialization and finetuning for specific usecases (e.g., summarization, text generation, chatbot, etc.)
|
76 |
+
|
77 |
### Out-of-Scope Use
|
78 |
|
79 |
+
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
|
80 |
|
81 |
## Bias, Risks, and Limitations
|
82 |
|
83 |
+
Falcon-7B is trained on English and French data only, 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.
|
84 |
+
|
85 |
+
### Recommendations
|
86 |
+
|
87 |
+
We recommend users of Falcon-7B to consider finetuning it for the specific set of tasks of interest, and for guardrails and appropriate precautions to be taken for any production use.
|
88 |
+
|
89 |
+
## How to Get Started with the Model
|
90 |
+
|
91 |
+
|
92 |
+
```python
|
93 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
94 |
+
import transformers
|
95 |
+
import torch
|
96 |
+
|
97 |
+
model = "tiiuae/falcon-7b"
|
98 |
+
|
99 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
100 |
+
pipeline = transformers.pipeline(
|
101 |
+
"text-generation",
|
102 |
+
model=model,
|
103 |
+
tokenizer=tokenizer,
|
104 |
+
torch_dtype=torch.bfloat16,
|
105 |
+
trust_remote_code=True,
|
106 |
+
device_map="auto",
|
107 |
+
)
|
108 |
+
sequences = pipeline(
|
109 |
+
"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:",
|
110 |
+
max_length=200,
|
111 |
+
do_sample=True,
|
112 |
+
top_k=10,
|
113 |
+
num_return_sequences=1,
|
114 |
+
eos_token_id=tokenizer.eos_token_id,
|
115 |
+
)
|
116 |
+
for seq in sequences:
|
117 |
+
print(f"Result: {seq['generated_text']}")
|
118 |
+
|
119 |
+
```
|
120 |
+
|
121 |
+
## Training Details
|
122 |
+
|
123 |
+
### Training Data
|
124 |
+
|
125 |
+
Falcon-RW-7B was trained on 1,500B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb), a high-quality filtered and deduplicated web dataset which we enhanced with curated corpora. Significant components from our curated copora were inspired by The Pile ([Gao et al., 2020](https://arxiv.org/abs/2101.00027)).
|
126 |
+
|
127 |
+
| **Data source** | **Fraction** | **Tokens** | **Sources** |
|
128 |
+
|--------------------|--------------|------------|-----------------------------------|
|
129 |
+
| RefinedWeb-English | 79% | 1,185B | massive web crawl |
|
130 |
+
| Books | 7% | 110B | |
|
131 |
+
| Conversations | 6% | 85B | Reddit, StackOverflow, HackerNews |
|
132 |
+
| Code | 3% | 45B | |
|
133 |
+
| RefinedWeb-French | 3% | 45B | massive web crawl |
|
134 |
+
| Technical | 2% | 30B | arXiv, PubMed, UPSTO, etc. |
|
135 |
+
|
136 |
+
|
137 |
+
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
|
138 |
+
|
139 |
+
### Training Procedure
|
140 |
+
|
141 |
+
Falcon-7B was trained on 384 A100 40GB GPUs, using a 2D parallelism strategy (PP=2, DP=192) combined with ZeRO.
|
142 |
+
|
143 |
+
#### Training Hyperparameters
|
144 |
+
|
145 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
146 |
+
|--------------------|------------|-------------------------------------------|
|
147 |
+
| Precision | `bfloat16` | |
|
148 |
+
| Optimizer | AdamW | |
|
149 |
+
| Learning rate | 6e-4 | 4B tokens warm-up, cosine decay to 1.2e-5 |
|
150 |
+
| Weight decay | 1e-1 | |
|
151 |
+
| Z-loss | 1e-4 | |
|
152 |
+
| Batch size | 2304 | 30B tokens ramp-up |
|
153 |
+
|
154 |
+
|
155 |
+
#### Speeds, Sizes, Times
|
156 |
+
|
157 |
+
Training happened in early March 2023 and took about two weeks.
|
158 |
+
|
159 |
+
|
160 |
+
## Evaluation
|
161 |
+
|
162 |
+
*Paper coming soon.*
|
163 |
+
|
164 |
+
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
|
165 |
+
|
166 |
+
|
167 |
+
## Technical Specifications
|
168 |
+
|
169 |
+
### Model Architecture and Objective
|
170 |
+
|
171 |
+
Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
|
172 |
+
|
173 |
+
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
|
174 |
+
|
175 |
+
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
|
176 |
+
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
|
177 |
+
* **Decoder-block:** parallel attention/MLP with a single layer norm.
|
178 |
+
|
179 |
+
| **Hyperparameter** | **Value** | **Comment** |
|
180 |
+
|--------------------|-----------|----------------------------------------|
|
181 |
+
| Layers | 32 | |
|
182 |
+
| `d_model` | 4544 | Increased to compensate for multiquery |
|
183 |
+
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
|
184 |
+
| Vocabulary | 65024 | |
|
185 |
+
| Sequence length | 2048 | |
|
186 |
+
|
187 |
+
### Compute Infrastructure
|
188 |
+
|
189 |
+
#### Hardware
|
190 |
+
|
191 |
+
Falcon-7B was trained on AWS SageMaker, on 384 A100 40GB GPUs in P4d instances.
|
192 |
+
|
193 |
+
#### Software
|
194 |
+
|
195 |
+
Falcon-7B was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention, etc.)
|
196 |
+
|
197 |
+
|
198 |
+
## Citation
|
199 |
+
|
200 |
+
*Paper coming soon 😊.*
|
201 |
+
|
202 |
+
## License
|
203 |
+
|
204 |
+
Falcon-7B is made available under the [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-7b/blob/main/LICENSE.txt). Broadly speaking,
|
205 |
+
* You can freely use our models for research and/or personal purpose;
|
206 |
+
* 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;
|
207 |
+
* 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.
|
208 |
|
209 |
|
210 |
+
## Contact
|
211 |
+
falconllm@tii.ae
|
212 |
|
|