slippylolo commited on
Commit
6e61c89
1 Parent(s): 31c2141

Update model card for public release

Browse files
Files changed (1) hide show
  1. README.md +204 -5
README.md CHANGED
@@ -1,12 +1,36 @@
 
 
 
 
 
 
 
 
 
 
1
 
2
- # Example usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  ```python
5
  from transformers import AutoTokenizer, AutoModelForCausalLM
6
  import transformers
7
  import torch
8
 
9
- model = "tiiuae/falcon-40B"
10
 
11
  tokenizer = AutoTokenizer.from_pretrained(model)
12
  pipeline = transformers.pipeline(
@@ -18,16 +42,191 @@ pipeline = transformers.pipeline(
18
  device_map="auto",
19
  )
20
  sequences = pipeline(
21
- "My favourite dad joke is",
22
  max_length=200,
23
  do_sample=True,
24
  top_k=10,
25
  num_return_sequences=1,
26
  eos_token_id=tokenizer.eos_token_id,
27
  )
28
- print("=" * 30)
29
- print("Results:")
30
  for seq in sequences:
31
  print(f"Result: {seq['generated_text']}")
32
 
33
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ - de
7
+ - es
8
+ - fr
9
+ inference: false
10
+ ---
11
 
12
+ # 🚀 Falcon-40B
13
+
14
+ **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 [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-40b/blob/main/LICENSE.txt).**
15
+
16
+ *Paper coming soon 😊.*
17
+
18
+ ## Why use Falcon-40B?
19
+
20
+ * **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).
21
+ * **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)).
22
+ * **It is made available under a license allowing commercial use**, see the details of the [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-40b/blob/main/LICENSE.txt) below.
23
+
24
+ ⚠️ **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).
25
+
26
+ 💸 **Looking for a smaller, less expensive model?** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) is Falcon-40B's small brother!
27
 
28
  ```python
29
  from transformers import AutoTokenizer, AutoModelForCausalLM
30
  import transformers
31
  import torch
32
 
33
+ model = "tiiuae/falcon-40b"
34
 
35
  tokenizer = AutoTokenizer.from_pretrained(model)
36
  pipeline = transformers.pipeline(
 
42
  device_map="auto",
43
  )
44
  sequences = pipeline(
45
+ "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:",
46
  max_length=200,
47
  do_sample=True,
48
  top_k=10,
49
  num_return_sequences=1,
50
  eos_token_id=tokenizer.eos_token_id,
51
  )
 
 
52
  for seq in sequences:
53
  print(f"Result: {seq['generated_text']}")
54
 
55
  ```
56
+
57
+ 💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
58
+
59
+
60
+ # Model Card for Falcon-40B
61
+
62
+ ## Model Details
63
+
64
+ ### Model Description
65
+
66
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
67
+ - **Model type:** Causal decoder-only;
68
+ - **Language(s) (NLP):** English, German, Spanish, French (and limited capabilities in Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish);
69
+ - **License:** [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-40b/blob/main/LICENSE.txt).
70
+
71
+ ### Model Source
72
+
73
+ - **Paper:** *coming soon*.
74
+
75
+ ## Uses
76
+
77
+ ### Direct Use
78
+
79
+ Research on large language models; as a foundation for further specialization and finetuning for specific usecases (e.g., summarization, text generation, chatbot, etc.)
80
+
81
+ ### Out-of-Scope Use
82
+
83
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
84
+
85
+ ## Bias, Risks, and Limitations
86
+
87
+ 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.
88
+
89
+ ### Recommendations
90
+
91
+ 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.
92
+
93
+ ## How to Get Started with the Model
94
+
95
+
96
+ ```python
97
+ from transformers import AutoTokenizer, AutoModelForCausalLM
98
+ import transformers
99
+ import torch
100
+
101
+ model = "tiiuae/falcon-40b"
102
+
103
+ tokenizer = AutoTokenizer.from_pretrained(model)
104
+ pipeline = transformers.pipeline(
105
+ "text-generation",
106
+ model=model,
107
+ tokenizer=tokenizer,
108
+ torch_dtype=torch.bfloat16,
109
+ trust_remote_code=True,
110
+ device_map="auto",
111
+ )
112
+ sequences = pipeline(
113
+ "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:",
114
+ max_length=200,
115
+ do_sample=True,
116
+ top_k=10,
117
+ num_return_sequences=1,
118
+ eos_token_id=tokenizer.eos_token_id,
119
+ )
120
+ for seq in sequences:
121
+ print(f"Result: {seq['generated_text']}")
122
+
123
+ ```
124
+
125
+ ## Training Details
126
+
127
+ ### Training Data
128
+
129
+ 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)).
130
+
131
+ | **Data source** | **Fraction** | **Tokens** | **Sources** |
132
+ |--------------------|--------------|------------|-----------------------------------|
133
+ | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 75% | 750B | massive web crawl |
134
+ | RefinedWeb-Europe | 7% | 70B | European massive zeb crawl |
135
+ | Books | 6% | 60B | |
136
+ | Conversations | 5% | 50B | Reddit, StackOverflow, HackerNews |
137
+ | Code | 5% | 50B | |
138
+ | Technical | 2% | 20B | arXiv, PubMed, UPSTO, etc. |
139
+
140
+ RefinedWeb-Europe is made of the following languages:
141
+
142
+ | **Language** | **Fraction of multilingual data** | **Tokens** |
143
+ |--------------|-----------------------------------|------------|
144
+ | German | 26% | 18B |
145
+ | Spanish | 24% | 17B |
146
+ | French | 23% | 16B |
147
+ | _Italian_ | 7% | 5B |
148
+ | _Portuguese_ | 4% | 3B |
149
+ | _Polish_ | 4% | 3B |
150
+ | _Dutch_ | 4% | 3B |
151
+ | _Romanian_ | 3% | 2B |
152
+ | _Czech_ | 3% | 2B |
153
+ | _Swedish_ | 2% | 1B |
154
+
155
+
156
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
157
+
158
+ ### Training Procedure
159
+
160
+ Falcon-40B was trained on 384 A100 40GB GPUs, using a 3D parallelism strategy (TP=8, PP=4, DP=12) combined with ZeRO.
161
+
162
+ #### Training Hyperparameters
163
+
164
+ | **Hyperparameter** | **Value** | **Comment** |
165
+ |--------------------|------------|-------------------------------------------|
166
+ | Precision | `bfloat16` | |
167
+ | Optimizer | AdamW | |
168
+ | Learning rate | 1.85e-4 | 4B tokens warm-up, cosine decay to 1.85e-5 |
169
+ | Weight decay | 1e-1 | |
170
+ | Z-loss | 1e-4 | |
171
+ | Batch size | 1152 | 100B tokens ramp-up |
172
+
173
+
174
+ #### Speeds, Sizes, Times
175
+
176
+ Training started in December 2022 and took two months.
177
+
178
+
179
+ ## Evaluation
180
+
181
+ *Paper coming soon.*
182
+
183
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
184
+
185
+
186
+ ## Technical Specifications
187
+
188
+ ### Model Architecture and Objective
189
+
190
+ Falcon-40B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
191
+
192
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
193
+
194
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
195
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
196
+ * **Decoder-block:** parallel attention/MLP with a two layer norms.
197
+
198
+ For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
199
+
200
+ | **Hyperparameter** | **Value** | **Comment** |
201
+ |--------------------|-----------|----------------------------------------|
202
+ | Layers | 60 | |
203
+ | `d_model` | 8192 | |
204
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
205
+ | Vocabulary | 65024 | |
206
+ | Sequence length | 2048 | |
207
+
208
+ ### Compute Infrastructure
209
+
210
+ #### Hardware
211
+
212
+ Falcon-40B was trained on AWS SageMaker, on 384 A100 40GB GPUs in P4d instances.
213
+
214
+ #### Software
215
+
216
+ 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.)
217
+
218
+
219
+ ## Citation
220
+
221
+ *Paper coming soon 😊.*
222
+
223
+ ## License
224
+
225
+ Falcon-40B is made available under the [TII Falcon LLM License](https://huggingface.co/tiiuae/falcon-40b/blob/main/LICENSE.txt). Broadly speaking,
226
+ * You can freely use our models for research and/or personal purpose;
227
+ * 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;
228
+ * 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.
229
+
230
+
231
+ ## Contact
232