harshil10 commited on
Commit
c62908d
•
1 Parent(s): c3f93e6

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +230 -0
  2. special_tokens_map.json +16 -0
  3. tokenizer.json +0 -0
  4. tokenizer_config.json +8 -0
README.md CHANGED
@@ -1,3 +1,233 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ inference: true
7
+ widget:
8
+ - text: "Hey Falcon! Any recommendations for my holidays in Abu Dhabi?"
9
+ example_title: "Abu Dhabi Trip"
10
+ - text: "What's the Everett interpretation of quantum mechanics?"
11
+ example_title: "Q/A: Quantum & Answers"
12
+ - text: "Give me a list of the top 10 dive sites you would recommend around the world."
13
+ example_title: "Diving Top 10"
14
+ - text: "Can you tell me more about deep-water soloing?"
15
+ example_title: "Extreme sports"
16
+ - text: "Can you write a short tweet about the Apache 2.0 release of our latest AI model, Falcon LLM?"
17
+ example_title: "Twitter Helper"
18
+ - text: "What are the responsabilities of a Chief Llama Officer?"
19
+ example_title: "Trendy Jobs"
20
  license: apache-2.0
21
  ---
22
+
23
+ # ✨ Falcon-7B-Instruct
24
+
25
+ **Falcon-7B-Instruct is a 7B parameters causal decoder-only model built by [TII](https://www.tii.ae) based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and finetuned on a mixture of chat/instruct datasets. It is made available under the Apache 2.0 license.**
26
+
27
+ *Paper coming soon 😊.*
28
+
29
+ 🤗 To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
30
+
31
+ ## Why use Falcon-7B-Instruct?
32
+
33
+ * **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
34
+ * **Falcon-7B is a strong base model, outperforming 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).
35
+ * **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)).
36
+
37
+ 💬 **This is an instruct model, which may not be ideal for further finetuning.** If you are interested in building your own instruct/chat model, we recommend starting from [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
38
+
39
+ 🔥 **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
40
+
41
+ ```python
42
+ from transformers import AutoTokenizer, AutoModelForCausalLM
43
+ import transformers
44
+ import torch
45
+
46
+ model = "tiiuae/falcon-7b-instruct"
47
+
48
+ tokenizer = AutoTokenizer.from_pretrained(model)
49
+ pipeline = transformers.pipeline(
50
+ "text-generation",
51
+ model=model,
52
+ tokenizer=tokenizer,
53
+ torch_dtype=torch.bfloat16,
54
+ trust_remote_code=True,
55
+ device_map="auto",
56
+ )
57
+ sequences = pipeline(
58
+ "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:",
59
+ max_length=200,
60
+ do_sample=True,
61
+ top_k=10,
62
+ num_return_sequences=1,
63
+ eos_token_id=tokenizer.eos_token_id,
64
+ )
65
+ for seq in sequences:
66
+ print(f"Result: {seq['generated_text']}")
67
+
68
+ ```
69
+
70
+ 💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
71
+
72
+ 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).
73
+
74
+ You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B-Instruct.
75
+
76
+
77
+ # Model Card for Falcon-7B-Instruct
78
+
79
+ ## Model Details
80
+
81
+ ### Model Description
82
+
83
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
84
+ - **Model type:** Causal decoder-only;
85
+ - **Language(s) (NLP):** English and French;
86
+ - **License:** Apache 2.0;
87
+ - **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
88
+
89
+ ### Model Source
90
+
91
+ - **Paper:** *coming soon*.
92
+
93
+ ## Uses
94
+
95
+ ### Direct Use
96
+
97
+ Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
98
+
99
+ ### Out-of-Scope Use
100
+
101
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
102
+
103
+ ## Bias, Risks, and Limitations
104
+
105
+ Falcon-7B-Instruct is mostly trained on English data, 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.
106
+
107
+ ### Recommendations
108
+
109
+ We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
110
+
111
+ ## How to Get Started with the Model
112
+
113
+
114
+ ```python
115
+ from transformers import AutoTokenizer, AutoModelForCausalLM
116
+ import transformers
117
+ import torch
118
+
119
+ model = "tiiuae/falcon-7b-instruct"
120
+
121
+ tokenizer = AutoTokenizer.from_pretrained(model)
122
+ pipeline = transformers.pipeline(
123
+ "text-generation",
124
+ model=model,
125
+ tokenizer=tokenizer,
126
+ torch_dtype=torch.bfloat16,
127
+ trust_remote_code=True,
128
+ device_map="auto",
129
+ )
130
+ sequences = pipeline(
131
+ "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:",
132
+ max_length=200,
133
+ do_sample=True,
134
+ top_k=10,
135
+ num_return_sequences=1,
136
+ eos_token_id=tokenizer.eos_token_id,
137
+ )
138
+ for seq in sequences:
139
+ print(f"Result: {seq['generated_text']}")
140
+
141
+ ```
142
+
143
+ ## Training Details
144
+
145
+ ### Training Data
146
+
147
+ Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
148
+
149
+ | **Data source** | **Fraction** | **Tokens** | **Description** |
150
+ |--------------------|--------------|------------|-----------------------------------|
151
+ | [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
152
+ | [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
153
+ | [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
154
+ | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
155
+
156
+
157
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
158
+
159
+
160
+ ## Evaluation
161
+
162
+ *Paper coming soon.*
163
+
164
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
165
+
166
+ Note that this model variant is not optimized for NLP benchmarks.
167
+
168
+
169
+ ## Technical Specifications
170
+
171
+ For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
172
+
173
+ ### Model Architecture and Objective
174
+
175
+ Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
176
+
177
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
178
+
179
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
180
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
181
+ * **Decoder-block:** parallel attention/MLP with a single layer norm.
182
+
183
+ | **Hyperparameter** | **Value** | **Comment** |
184
+ |--------------------|-----------|----------------------------------------|
185
+ | Layers | 32 | |
186
+ | `d_model` | 4544 | Increased to compensate for multiquery |
187
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
188
+ | Vocabulary | 65024 | |
189
+ | Sequence length | 2048 | |
190
+
191
+ ### Compute Infrastructure
192
+
193
+ #### Hardware
194
+
195
+ Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
196
+
197
+ #### Software
198
+
199
+ Falcon-7B-Instruct was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention, etc.)
200
+
201
+
202
+ ## Citation
203
+
204
+ *Paper coming soon* 😊. In the meanwhile, you can use the following information to cite:
205
+ ```
206
+ @article{falcon40b,
207
+ title={{Falcon-40B}: an open large language model with state-of-the-art performance},
208
+ 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},
209
+ year={2023}
210
+ }
211
+ ```
212
+
213
+ To learn more about the pretraining dataset, see the 📓 [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
214
+
215
+ ```
216
+ @article{refinedweb,
217
+ title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
218
+ 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},
219
+ journal={arXiv preprint arXiv:2306.01116},
220
+ eprint={2306.01116},
221
+ eprinttype = {arXiv},
222
+ url={https://arxiv.org/abs/2306.01116},
223
+ year={2023}
224
+ }
225
+ ```
226
+
227
+
228
+ ## License
229
+
230
+ Falcon-7B-Instruct is made available under the Apache 2.0 license.
231
+
232
+ ## Contact
233
special_tokens_map.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ ">>TITLE<<",
4
+ ">>ABSTRACT<<",
5
+ ">>INTRODUCTION<<",
6
+ ">>SUMMARY<<",
7
+ ">>COMMENT<<",
8
+ ">>ANSWER<<",
9
+ ">>QUESTION<<",
10
+ ">>DOMAIN<<",
11
+ ">>PREFIX<<",
12
+ ">>SUFFIX<<",
13
+ ">>MIDDLE<<"
14
+ ],
15
+ "eos_token": "<|endoftext|>"
16
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "eos_token": "<|endoftext|>",
4
+ "model_max_length": 2048,
5
+ "name_or_path": "tiiuae/falcon_tokenizer",
6
+ "special_tokens_map_file": null,
7
+ "tokenizer_class": "PreTrainedTokenizerFast"
8
+ }