Zangs3011 commited on
Commit
ceb7fec
·
verified ·
1 Parent(s): 9e9ec6a

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +176 -118
README.md CHANGED
@@ -1,199 +1,257 @@
1
  ---
2
- library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
11
 
12
- ## Model Details
13
 
14
- ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
 
 
 
 
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
 
30
- <!-- Provide the basic links for the model. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
- ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
40
- ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
45
 
46
- ### Downstream Use [optional]
47
 
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
 
49
 
50
- [More Information Needed]
51
 
52
- ### Out-of-Scope Use
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
63
 
64
- ### Recommendations
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
 
69
 
70
  ## How to Get Started with the Model
71
 
72
- Use the code below to get started with the model.
73
 
74
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  ## Training Details
77
 
78
  ### Training Data
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
 
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
 
 
 
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- ### Testing Data, Factors & Metrics
108
 
109
- #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
 
113
- [More Information Needed]
114
 
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
 
125
- [More Information Needed]
 
 
 
 
 
 
 
126
 
127
- ### Results
128
 
129
- [More Information Needed]
130
 
131
- #### Summary
132
 
133
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
 
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
 
 
154
 
155
- ### Model Architecture and Objective
156
 
157
- [More Information Needed]
 
 
 
 
 
 
158
 
159
  ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
-
163
  #### Hardware
164
 
165
- [More Information Needed]
166
 
167
  #### Software
168
 
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
 
 
 
 
 
 
 
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
1
  ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ - de
7
+ - es
8
+ - fr
9
+ inference: false
10
+ license: apache-2.0
11
  ---
12
 
13
+ # 🚀 Falcon-40B
14
 
15
+ **Falcon-40B is a 40B parameters causal decoder-only model built by [TII](https://www.tii.ae) and trained on 1,000B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. It is made available under the Apache 2.0 license.**
16
 
17
+ *Paper coming soon 😊.*
18
 
19
 
20
+ 🤗 To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
21
 
22
+ ## Why use Falcon-40B?
23
 
24
+ * **It is the best open-source model currently available.** Falcon-40B 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).
25
+ * **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)).
26
+ * **It is made available under a permissive Apache 2.0 license allowing for commercial use**, without any royalties or restrictions.
27
+ *
28
+ ⚠️ **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-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct).
29
 
30
+ 💸 **Looking for a smaller, less expensive model?** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) is Falcon-40B's little brother!
31
 
32
+ ```python
33
+ from transformers import AutoTokenizer, AutoModelForCausalLM
34
+ import transformers
35
+ import torch
 
 
 
36
 
37
+ model = "tiiuae/falcon-40b"
38
 
39
+ tokenizer = AutoTokenizer.from_pretrained(model)
40
+ pipeline = transformers.pipeline(
41
+ "text-generation",
42
+ model=model,
43
+ tokenizer=tokenizer,
44
+ torch_dtype=torch.bfloat16,
45
+ trust_remote_code=True,
46
+ device_map="auto",
47
+ )
48
+ sequences = pipeline(
49
+ "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:",
50
+ max_length=200,
51
+ do_sample=True,
52
+ top_k=10,
53
+ num_return_sequences=1,
54
+ eos_token_id=tokenizer.eos_token_id,
55
+ )
56
+ for seq in sequences:
57
+ print(f"Result: {seq['generated_text']}")
58
 
59
+ ```
 
 
60
 
61
+ 💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
62
 
63
+ 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).
64
 
65
+ You will need **at least 85-100GB of memory** to swiftly run inference with Falcon-40B.
66
 
67
+ # Model Card for Falcon-40B
68
 
69
+ ## Model Details
70
 
71
+ ### Model Description
72
 
73
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
74
+ - **Model type:** Causal decoder-only;
75
+ - **Language(s) (NLP):** English, German, Spanish, French (and limited capabilities in Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish);
76
+ - **License:** Apache 2.0 license.
77
 
78
+ ### Model Source
79
 
80
+ - **Paper:** *coming soon*.
81
 
82
+ ## Uses
83
 
84
+ ### Direct Use
85
 
86
+ Research on large language models; as a foundation for further specialization and finetuning for specific usecases (e.g., summarization, text generation, chatbot, etc.)
87
 
88
+ ### Out-of-Scope Use
89
 
90
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
91
 
92
+ ## Bias, Risks, and Limitations
93
 
94
+ Falcon-40B is trained mostly on English, German, Spanish, French, with limited capabilities also in in Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish. It 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.
95
 
96
+ ### Recommendations
97
+
98
+ We recommend users of Falcon-40B 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.
99
 
100
  ## How to Get Started with the Model
101
 
 
102
 
103
+ ```python
104
+ from transformers import AutoTokenizer, AutoModelForCausalLM
105
+ import transformers
106
+ import torch
107
+
108
+ model = "tiiuae/falcon-40b"
109
+
110
+ tokenizer = AutoTokenizer.from_pretrained(model)
111
+ pipeline = transformers.pipeline(
112
+ "text-generation",
113
+ model=model,
114
+ tokenizer=tokenizer,
115
+ torch_dtype=torch.bfloat16,
116
+ trust_remote_code=True,
117
+ device_map="auto",
118
+ )
119
+ sequences = pipeline(
120
+ "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:",
121
+ max_length=200,
122
+ do_sample=True,
123
+ top_k=10,
124
+ num_return_sequences=1,
125
+ eos_token_id=tokenizer.eos_token_id,
126
+ )
127
+ for seq in sequences:
128
+ print(f"Result: {seq['generated_text']}")
129
+
130
+ ```
131
 
132
  ## Training Details
133
 
134
  ### Training Data
135
 
136
+ Falcon-40B was trained on 1,000B 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)).
 
 
 
 
 
 
 
 
 
 
 
137
 
138
+ | **Data source** | **Fraction** | **Tokens** | **Sources** |
139
+ |--------------------|--------------|------------|-----------------------------------|
140
+ | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 75% | 750B | massive web crawl |
141
+ | RefinedWeb-Europe | 7% | 70B | European massive web crawl |
142
+ | Books | 6% | 60B | |
143
+ | Conversations | 5% | 50B | Reddit, StackOverflow, HackerNews |
144
+ | Code | 5% | 50B | |
145
+ | Technical | 2% | 20B | arXiv, PubMed, USPTO, etc. |
146
 
147
+ RefinedWeb-Europe is made of the following languages:
 
 
 
 
148
 
149
+ | **Language** | **Fraction of multilingual data** | **Tokens** |
150
+ |--------------|-----------------------------------|------------|
151
+ | German | 26% | 18B |
152
+ | Spanish | 24% | 17B |
153
+ | French | 23% | 16B |
154
+ | _Italian_ | 7% | 5B |
155
+ | _Portuguese_ | 4% | 3B |
156
+ | _Polish_ | 4% | 3B |
157
+ | _Dutch_ | 4% | 3B |
158
+ | _Romanian_ | 3% | 2B |
159
+ | _Czech_ | 3% | 2B |
160
+ | _Swedish_ | 2% | 1B |
161
 
 
162
 
163
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
164
 
165
+ ### Training Procedure
166
 
167
+ Falcon-40B was trained on 384 A100 40GB GPUs, using a 3D parallelism strategy (TP=8, PP=4, DP=12) combined with ZeRO.
168
 
169
+ #### Training Hyperparameters
 
 
 
 
 
 
 
 
170
 
171
+ | **Hyperparameter** | **Value** | **Comment** |
172
+ |--------------------|------------|-------------------------------------------|
173
+ | Precision | `bfloat16` | |
174
+ | Optimizer | AdamW | |
175
+ | Learning rate | 1.85e-4 | 4B tokens warm-up, cosine decay to 1.85e-5 |
176
+ | Weight decay | 1e-1 | |
177
+ | Z-loss | 1e-4 | |
178
+ | Batch size | 1152 | 100B tokens ramp-up |
179
 
 
180
 
181
+ #### Speeds, Sizes, Times
182
 
183
+ Training started in December 2022 and took two months.
184
 
185
 
186
+ ## Evaluation
187
 
188
+ *Paper coming soon.*
189
 
190
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
191
 
 
192
 
193
+ ## Technical Specifications
194
 
195
+ ### Model Architecture and Objective
196
 
197
+ Falcon-40B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
198
 
199
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
 
 
 
 
200
 
201
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
202
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
203
+ * **Decoder-block:** parallel attention/MLP with a two layer norms.
204
 
205
+ For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
206
 
207
+ | **Hyperparameter** | **Value** | **Comment** |
208
+ |--------------------|-----------|----------------------------------------|
209
+ | Layers | 60 | |
210
+ | `d_model` | 8192 | |
211
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
212
+ | Vocabulary | 65024 | |
213
+ | Sequence length | 2048 | |
214
 
215
  ### Compute Infrastructure
216
 
 
 
217
  #### Hardware
218
 
219
+ Falcon-40B was trained on AWS SageMaker, on 384 A100 40GB GPUs in P4d instances.
220
 
221
  #### Software
222
 
223
+ Falcon-40B was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention, etc.)
 
 
 
 
 
 
 
 
 
 
 
 
224
 
 
225
 
226
+ ## Citation
227
 
228
+ *Paper coming soon* 😊. In the meanwhile, you can use the following information to cite:
229
+ ```
230
+ @article{falcon40b,
231
+ title={{Falcon-40B}: an open large language model with state-of-the-art performance},
232
+ 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},
233
+ year={2023}
234
+ }
235
+ ```
236
 
237
+ To learn more about the pretraining dataset, see the 📓 [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
238
 
239
+ ```
240
+ @article{refinedweb,
241
+ title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
242
+ 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},
243
+ journal={arXiv preprint arXiv:2306.01116},
244
+ eprint={2306.01116},
245
+ eprinttype = {arXiv},
246
+ url={https://arxiv.org/abs/2306.01116},
247
+ year={2023}
248
+ }
249
+ ```
250
 
 
251
 
252
+ ## License
253
 
254
+ Falcon-40B is made available under the Apache 2.0 license.
255
 
256
+ ## Contact
257
+ falconllm@tii.ae