blackmount8 commited on
Commit
cf86dd7
•
1 Parent(s): 7c2378a

Update model and tokenizer.

Browse files
README.md CHANGED
@@ -1,3 +1,220 @@
1
  ---
 
 
 
 
 
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ inference: false
7
  license: apache-2.0
8
  ---
9
+
10
+ # ✨ Falcon-7B-Instruct
11
+
12
+ **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.**
13
+
14
+ *Paper coming soon 😊.*
15
+
16
+ 🤗 To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
17
+
18
+ ## Why use Falcon-7B-Instruct?
19
+
20
+ * **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
21
+ * **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).
22
+ * **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)).
23
+
24
+ 💬 **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).
25
+
26
+ 🔥 **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
27
+
28
+ ```python
29
+ from transformers import AutoTokenizer, AutoModelForCausalLM
30
+ import transformers
31
+ import torch
32
+
33
+ model = "tiiuae/falcon-7b-instruct"
34
+
35
+ tokenizer = AutoTokenizer.from_pretrained(model)
36
+ pipeline = transformers.pipeline(
37
+ "text-generation",
38
+ model=model,
39
+ tokenizer=tokenizer,
40
+ torch_dtype=torch.bfloat16,
41
+ trust_remote_code=True,
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
+ 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).
60
+
61
+ You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B-Instruct.
62
+
63
+
64
+ # Model Card for Falcon-7B-Instruct
65
+
66
+ ## Model Details
67
+
68
+ ### Model Description
69
+
70
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
71
+ - **Model type:** Causal decoder-only;
72
+ - **Language(s) (NLP):** English and French;
73
+ - **License:** Apache 2.0;
74
+ - **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
75
+
76
+ ### Model Source
77
+
78
+ - **Paper:** *coming soon*.
79
+
80
+ ## Uses
81
+
82
+ ### Direct Use
83
+
84
+ Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
85
+
86
+ ### Out-of-Scope Use
87
+
88
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
89
+
90
+ ## Bias, Risks, and Limitations
91
+
92
+ 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.
93
+
94
+ ### Recommendations
95
+
96
+ We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
97
+
98
+ ## How to Get Started with the Model
99
+
100
+
101
+ ```python
102
+ from transformers import AutoTokenizer, AutoModelForCausalLM
103
+ import transformers
104
+ import torch
105
+
106
+ model = "tiiuae/falcon-7b-instruct"
107
+
108
+ tokenizer = AutoTokenizer.from_pretrained(model)
109
+ pipeline = transformers.pipeline(
110
+ "text-generation",
111
+ model=model,
112
+ tokenizer=tokenizer,
113
+ torch_dtype=torch.bfloat16,
114
+ trust_remote_code=True,
115
+ device_map="auto",
116
+ )
117
+ sequences = pipeline(
118
+ "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:",
119
+ max_length=200,
120
+ do_sample=True,
121
+ top_k=10,
122
+ num_return_sequences=1,
123
+ eos_token_id=tokenizer.eos_token_id,
124
+ )
125
+ for seq in sequences:
126
+ print(f"Result: {seq['generated_text']}")
127
+
128
+ ```
129
+
130
+ ## Training Details
131
+
132
+ ### Training Data
133
+
134
+ Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
135
+
136
+ | **Data source** | **Fraction** | **Tokens** | **Description** |
137
+ |--------------------|--------------|------------|-----------------------------------|
138
+ | [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
139
+ | [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
140
+ | [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
141
+ | [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
142
+
143
+
144
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
145
+
146
+
147
+ ## Evaluation
148
+
149
+ *Paper coming soon.*
150
+
151
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
152
+
153
+ Note that this model variant is not optimized for NLP benchmarks.
154
+
155
+
156
+ ## Technical Specifications
157
+
158
+ For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
159
+
160
+ ### Model Architecture and Objective
161
+
162
+ Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
163
+
164
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
165
+
166
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
167
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
168
+ * **Decoder-block:** parallel attention/MLP with a single layer norm.
169
+
170
+ | **Hyperparameter** | **Value** | **Comment** |
171
+ |--------------------|-----------|----------------------------------------|
172
+ | Layers | 32 | |
173
+ | `d_model` | 4544 | Increased to compensate for multiquery |
174
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
175
+ | Vocabulary | 65024 | |
176
+ | Sequence length | 2048 | |
177
+
178
+ ### Compute Infrastructure
179
+
180
+ #### Hardware
181
+
182
+ Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
183
+
184
+ #### Software
185
+
186
+ 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.)
187
+
188
+
189
+ ## Citation
190
+
191
+ *Paper coming soon* 😊. In the meanwhile, you can use the following information to cite:
192
+ ```
193
+ @article{falcon40b,
194
+ title={{Falcon-40B}: an open large language model with state-of-the-art performance},
195
+ 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},
196
+ year={2023}
197
+ }
198
+ ```
199
+
200
+ To learn more about the pretraining dataset, see the 📓 [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
201
+
202
+ ```
203
+ @article{refinedweb,
204
+ title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
205
+ 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},
206
+ journal={arXiv preprint arXiv:2306.01116},
207
+ eprint={2306.01116},
208
+ eprinttype = {arXiv},
209
+ url={https://arxiv.org/abs/2306.01116},
210
+ year={2023}
211
+ }
212
+ ```
213
+
214
+
215
+ ## License
216
+
217
+ Falcon-7B-Instruct is made available under the Apache 2.0 license.
218
+
219
+ ## Contact
220
+ falconllm@tii.ae
config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "layer_norm_epsilon": null,
5
+ "unk_token": "<|endoftext|>"
6
+ }
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11b3eabbe4ef36432809d4604fb7303bc5cfe54d0d286fc40c6ac70f7132376e
3
+ size 6926392998
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
+ }
vocabulary.json ADDED
The diff for this file is too large to render. See raw diff