roemmele commited on
Commit
38a1f91
โ€ข
1 Parent(s): 3d2bacf

Update README.md

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