vilsonrodrigues commited on
Commit
77d29a9
β€’
1 Parent(s): 14a2ab2

Create README.md

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