maddes8cht commited on
Commit
eca1bdf
โ€ข
1 Parent(s): de554ea

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +250 -0
README.md CHANGED
@@ -1,3 +1,253 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-7b/edit/main/README.md)
25
+
26
+ # ๐Ÿš€ Falcon-7B
27
+
28
+ **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 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
+
35
+ ## Why use Falcon-7B?
36
+
37
+ * **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).
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
+ * **It is made available under a permissive Apache 2.0 license allowing for commercial use**, without any royalties or restrictions.
40
+
41
+ โš ๏ธ **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).
42
+
43
+ ๐Ÿ”ฅ **Looking for an even more powerful model?** [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b) is Falcon-7B's big brother!
44
+
45
+ ```python
46
+ from transformers import AutoTokenizer, AutoModelForCausalLM
47
+ import transformers
48
+ import torch
49
+
50
+ model = "tiiuae/falcon-7b"
51
+
52
+ tokenizer = AutoTokenizer.from_pretrained(model)
53
+ pipeline = transformers.pipeline(
54
+ "text-generation",
55
+ model=model,
56
+ tokenizer=tokenizer,
57
+ torch_dtype=torch.bfloat16,
58
+ trust_remote_code=True,
59
+ device_map="auto",
60
+ )
61
+ sequences = pipeline(
62
+ "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:",
63
+ max_length=200,
64
+ do_sample=True,
65
+ top_k=10,
66
+ num_return_sequences=1,
67
+ eos_token_id=tokenizer.eos_token_id,
68
+ )
69
+ for seq in sequences:
70
+ print(f"Result: {seq['generated_text']}")
71
+
72
+ ```
73
+
74
+ ๐Ÿ’ฅ **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
75
+
76
+ 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).
77
+
78
+ You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B.
79
+
80
+ # Model Card for Falcon-7B
81
+
82
+ ## Model Details
83
+
84
+ ### Model Description
85
+
86
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
87
+ - **Model type:** Causal decoder-only;
88
+ - **Language(s) (NLP):** English and French;
89
+ - **License:** Apache 2.0.
90
+
91
+ ### Model Source
92
+
93
+ - **Paper:** *coming soon*.
94
+
95
+ ## Uses
96
+
97
+ ### Direct Use
98
+
99
+ Research on large language models; as a foundation for further specialization and finetuning for specific usecases (e.g., summarization, text generation, chatbot, etc.)
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-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.
108
+
109
+ ### Recommendations
110
+
111
+ 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.
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-7b"
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-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)).
150
+
151
+ | **Data source** | **Fraction** | **Tokens** | **Sources** |
152
+ |--------------------|--------------|------------|-----------------------------------|
153
+ | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 79% | 1,185B | massive web crawl |
154
+ | Books | 7% | 110B | |
155
+ | Conversations | 6% | 85B | Reddit, StackOverflow, HackerNews |
156
+ | Code | 3% | 45B | |
157
+ | RefinedWeb-French | 3% | 45B | massive web crawl |
158
+ | Technical | 2% | 30B | arXiv, PubMed, USPTO, etc. |
159
+
160
+
161
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
162
+
163
+ ### Training Procedure
164
+
165
+ Falcon-7B was trained on 384 A100 40GB GPUs, using a 2D parallelism strategy (PP=2, DP=192) combined with ZeRO.
166
+
167
+ #### Training Hyperparameters
168
+
169
+ | **Hyperparameter** | **Value** | **Comment** |
170
+ |--------------------|------------|-------------------------------------------|
171
+ | Precision | `bfloat16` | |
172
+ | Optimizer | AdamW | |
173
+ | Learning rate | 6e-4 | 4B tokens warm-up, cosine decay to 1.2e-5 |
174
+ | Weight decay | 1e-1 | |
175
+ | Z-loss | 1e-4 | |
176
+ | Batch size | 2304 | 30B tokens ramp-up |
177
+
178
+
179
+ #### Speeds, Sizes, Times
180
+
181
+ Training happened in early March 2023 and took about two weeks.
182
+
183
+
184
+ ## Evaluation
185
+
186
+ *Paper coming soon*.
187
+
188
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
189
+
190
+
191
+ ## Technical Specifications
192
+
193
+ ### Model Architecture and Objective
194
+
195
+ Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
196
+
197
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
198
+
199
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
200
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
201
+ * **Decoder-block:** parallel attention/MLP with a single layer norm.
202
+
203
+ | **Hyperparameter** | **Value** | **Comment** |
204
+ |--------------------|-----------|----------------------------------------|
205
+ | Layers | 32 | |
206
+ | `d_model` | 4544 | Increased to compensate for multiquery |
207
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
208
+ | Vocabulary | 65024 | |
209
+ | Sequence length | 2048 | |
210
+
211
+ ### Compute Infrastructure
212
+
213
+ #### Hardware
214
+
215
+ Falcon-7B was trained on AWS SageMaker, on 384 A100 40GB GPUs in P4d instances.
216
+
217
+ #### Software
218
+
219
+ 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.)
220
+
221
+
222
+ ## Citation
223
+
224
+ *Paper coming soon* ๐Ÿ˜Š. In the meanwhile, you can use the following information to cite:
225
+ ```
226
+ @article{falcon40b,
227
+ title={{Falcon-40B}: an open large language model with state-of-the-art performance},
228
+ 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},
229
+ year={2023}
230
+ }
231
+ ```
232
+
233
+ To learn more about the pretraining dataset, see the ๐Ÿ““ [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
234
+
235
+ ```
236
+ @article{refinedweb,
237
+ title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
238
+ 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},
239
+ journal={arXiv preprint arXiv:2306.01116},
240
+ eprint={2306.01116},
241
+ eprinttype = {arXiv},
242
+ url={https://arxiv.org/abs/2306.01116},
243
+ year={2023}
244
+ }
245
+ ```
246
+
247
+ ## License
248
+
249
+ Falcon-7B is made available under the Apache 2.0 license.
250
+
251
+ ## Contact
252
+ falconllm@tii.ae
253
+ </details>