muzammil-eds commited on
Commit
1a53e98
โ€ข
1 Parent(s): 27d6dd5

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +229 -0
README.md ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ inference: false
7
+ license: apache-2.0
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 Apache 2.0 license.**
12
+
13
+ *Paper coming soon* ๐Ÿ˜Š.
14
+
15
+ ๐Ÿค— To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
16
+
17
+
18
+ ## Why use Falcon-7B?
19
+
20
+ * **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).
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 permissive Apache 2.0 license allowing for commercial use**, without any royalties or restrictions.
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-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct).
25
+
26
+ ๐Ÿ”ฅ **Looking for an even more powerful model?** [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b) is Falcon-7B's big brother!
27
+
28
+ ```python
29
+ from transformers import AutoTokenizer, AutoModelForCausalLM
30
+ import transformers
31
+ import torch
32
+ model = "tiiuae/falcon-7b"
33
+ tokenizer = AutoTokenizer.from_pretrained(model)
34
+ pipeline = transformers.pipeline(
35
+ "text-generation",
36
+ model=model,
37
+ tokenizer=tokenizer,
38
+ torch_dtype=torch.bfloat16,
39
+ trust_remote_code=True,
40
+ device_map="auto",
41
+ )
42
+ sequences = pipeline(
43
+ "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:",
44
+ max_length=200,
45
+ do_sample=True,
46
+ top_k=10,
47
+ num_return_sequences=1,
48
+ eos_token_id=tokenizer.eos_token_id,
49
+ )
50
+ for seq in sequences:
51
+ print(f"Result: {seq['generated_text']}")
52
+ ```
53
+
54
+ ๐Ÿ’ฅ **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
55
+
56
+ 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).
57
+
58
+ You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B.
59
+
60
+ # Model Card for Falcon-7B
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 and French;
69
+ - **License:** Apache 2.0.
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-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.
88
+
89
+ ### Recommendations
90
+
91
+ 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.
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
+ model = "tiiuae/falcon-7b"
101
+ tokenizer = AutoTokenizer.from_pretrained(model)
102
+ pipeline = transformers.pipeline(
103
+ "text-generation",
104
+ model=model,
105
+ tokenizer=tokenizer,
106
+ torch_dtype=torch.bfloat16,
107
+ trust_remote_code=True,
108
+ device_map="auto",
109
+ )
110
+ sequences = pipeline(
111
+ "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:",
112
+ max_length=200,
113
+ do_sample=True,
114
+ top_k=10,
115
+ num_return_sequences=1,
116
+ eos_token_id=tokenizer.eos_token_id,
117
+ )
118
+ for seq in sequences:
119
+ print(f"Result: {seq['generated_text']}")
120
+ ```
121
+
122
+ ## Training Details
123
+
124
+ ### Training Data
125
+
126
+ 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)).
127
+
128
+ | **Data source** | **Fraction** | **Tokens** | **Sources** |
129
+ |--------------------|--------------|------------|-----------------------------------|
130
+ | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 79% | 1,185B | massive web crawl |
131
+ | Books | 7% | 110B | |
132
+ | Conversations | 6% | 85B | Reddit, StackOverflow, HackerNews |
133
+ | Code | 3% | 45B | |
134
+ | RefinedWeb-French | 3% | 45B | massive web crawl |
135
+ | Technical | 2% | 30B | arXiv, PubMed, USPTO, etc. |
136
+
137
+
138
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
139
+
140
+ ### Training Procedure
141
+
142
+ Falcon-7B was trained on 384 A100 40GB GPUs, using a 2D parallelism strategy (PP=2, DP=192) combined with ZeRO.
143
+
144
+ #### Training Hyperparameters
145
+
146
+ | **Hyperparameter** | **Value** | **Comment** |
147
+ |--------------------|------------|-------------------------------------------|
148
+ | Precision | `bfloat16` | |
149
+ | Optimizer | AdamW | |
150
+ | Learning rate | 6e-4 | 4B tokens warm-up, cosine decay to 1.2e-5 |
151
+ | Weight decay | 1e-1 | |
152
+ | Z-loss | 1e-4 | |
153
+ | Batch size | 2304 | 30B tokens ramp-up |
154
+
155
+
156
+ #### Speeds, Sizes, Times
157
+
158
+ Training happened in early March 2023 and took about two weeks.
159
+
160
+
161
+ ## Evaluation
162
+
163
+ *Paper coming soon*.
164
+
165
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
166
+
167
+
168
+ ## Technical Specifications
169
+
170
+ ### Model Architecture and Objective
171
+
172
+ Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
173
+
174
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
175
+
176
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
177
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
178
+ * **Decoder-block:** parallel attention/MLP with a single layer norm.
179
+
180
+ | **Hyperparameter** | **Value** | **Comment** |
181
+ |--------------------|-----------|----------------------------------------|
182
+ | Layers | 32 | |
183
+ | `d_model` | 4544 | Increased to compensate for multiquery |
184
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
185
+ | Vocabulary | 65024 | |
186
+ | Sequence length | 2048 | |
187
+
188
+ ### Compute Infrastructure
189
+
190
+ #### Hardware
191
+
192
+ Falcon-7B was trained on AWS SageMaker, on 384 A100 40GB GPUs in P4d instances.
193
+
194
+ #### Software
195
+
196
+ 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.)
197
+
198
+
199
+ ## Citation
200
+
201
+ *Paper coming soon* ๐Ÿ˜Š. In the meanwhile, you can use the following information to cite:
202
+ ```
203
+ @article{falcon40b,
204
+ title={{Falcon-40B}: an open large language model with state-of-the-art performance},
205
+ 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},
206
+ year={2023}
207
+ }
208
+ ```
209
+
210
+ To learn more about the pretraining dataset, see the ๐Ÿ““ [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
211
+
212
+ ```
213
+ @article{refinedweb,
214
+ title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
215
+ 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},
216
+ journal={arXiv preprint arXiv:2306.01116},
217
+ eprint={2306.01116},
218
+ eprinttype = {arXiv},
219
+ url={https://arxiv.org/abs/2306.01116},
220
+ year={2023}
221
+ }
222
+ ```
223
+
224
+ ## License
225
+
226
+ Falcon-7B is made available under the Apache 2.0 license.
227
+
228
+ ## Contact
229