vilsonrodrigues commited on
Commit
9d2bef0
โ€ข
1 Parent(s): 52ec2bf

Create README.md

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