ichitaka commited on
Commit
11b95d5
โ€ข
1 Parent(s): 13e27e0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +186 -0
README.md ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ inference: false
7
+ license: apache-2.0
8
+ ---
9
+
10
+ # โœจ Falcon-40B-Instruct 8Bit
11
+
12
+ **INFO: This model is the Falcon-40B-Instruct model quantized using bitsandbytes. This saves you around 40 GB of downloads, if you plan to quantize the model anyways.**
13
+
14
+ **Falcon-40B-Instruct is a 40B parameters causal decoder-only model built by [TII](https://www.tii.ae) based on [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b) and finetuned on a mixture of [Baize](https://github.com/project-baize/baize-chatbot). It is made available under the Apache 2.0 license.**
15
+
16
+ *Paper coming soon ๐Ÿ˜Š.*
17
+
18
+ ## Why use Falcon-40B-Instruct?
19
+
20
+ * **You are looking for a ready-to-use chat/instruct model based on [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).**
21
+ * **Falcon-40B is the best open-source model available.** It outperforms [LLaMA](https://github.com/facebookresearch/llama), [StableLM](https://github.com/Stability-AI/StableLM), [RedPajama](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-7B-v0.1), [MPT](https://huggingface.co/mosaicml/mpt-7b), etc. 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-40B](https://huggingface.co/tiiuae/falcon-40b).
25
+
26
+ ๐Ÿ’ธ **Looking for a smaller, less expensive model?** [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) is Falcon-40B-Instruct's little brother!
27
+
28
+ ```python
29
+ from transformers import AutoTokenizer, AutoModelForCausalLM
30
+ import transformers
31
+ import torch
32
+
33
+ model = "tiiuae/falcon-40b-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
+
58
+
59
+ # Model Card for Falcon-40B-Instruct
60
+
61
+ ## Model Details
62
+
63
+ ### Model Description
64
+
65
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
66
+ - **Model type:** Causal decoder-only;
67
+ - **Language(s) (NLP):** English and French;
68
+ - **License:** Apache 2.0;
69
+ - **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
70
+
71
+ ### Model Source
72
+
73
+ - **Paper:** *coming soon*.
74
+
75
+ ## Uses
76
+
77
+ ### Direct Use
78
+
79
+ Falcon-40B-Instruct has been finetuned on a chat dataset.
80
+
81
+ ### Out-of-Scope Use
82
+
83
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
84
+
85
+ ## Bias, Risks, and Limitations
86
+
87
+ Falcon-40B-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.
88
+
89
+ ### Recommendations
90
+
91
+ We recommend users of Falcon-40B-Instruct to develop guardrails and to take appropriate precautions for any production use.
92
+
93
+ ## How to Get Started with the Model
94
+
95
+
96
+ ```python
97
+ from transformers import AutoTokenizer, AutoModelForCausalLM
98
+ import transformers
99
+ import torch
100
+
101
+ model = "tiiuae/falcon-40b-instruct"
102
+
103
+ tokenizer = AutoTokenizer.from_pretrained(model)
104
+ pipeline = transformers.pipeline(
105
+ "text-generation",
106
+ model=model,
107
+ tokenizer=tokenizer,
108
+ torch_dtype=torch.bfloat16,
109
+ trust_remote_code=True,
110
+ device_map="auto",
111
+ )
112
+ sequences = pipeline(
113
+ "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:",
114
+ max_length=200,
115
+ do_sample=True,
116
+ top_k=10,
117
+ num_return_sequences=1,
118
+ eos_token_id=tokenizer.eos_token_id,
119
+ )
120
+ for seq in sequences:
121
+ print(f"Result: {seq['generated_text']}")
122
+
123
+ ```
124
+
125
+ ## Training Details
126
+
127
+ ### Training Data
128
+
129
+ Falcon-40B-Instruct was finetuned on a 150M tokens from [Bai ze](https://github.com/project-baize/baize-chatbot) mixed with 5% of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) data.
130
+
131
+
132
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
133
+
134
+
135
+ ## Evaluation
136
+
137
+ *Paper coming soon.*
138
+
139
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
140
+
141
+
142
+ ## Technical Specifications
143
+
144
+ For more information about pretraining, see [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
145
+
146
+ ### Model Architecture and Objective
147
+
148
+ Falcon-40B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
149
+
150
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
151
+
152
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
153
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
154
+ * **Decoder-block:** parallel attention/MLP with a single layer norm.
155
+
156
+ For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
157
+
158
+ | **Hyperparameter** | **Value** | **Comment** |
159
+ |--------------------|-----------|----------------------------------------|
160
+ | Layers | 60 | |
161
+ | `d_model` | 8192 | |
162
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
163
+ | Vocabulary | 65024 | |
164
+ | Sequence length | 2048 | |
165
+
166
+ ### Compute Infrastructure
167
+
168
+ #### Hardware
169
+
170
+ Falcon-40B-Instruct was trained on AWS SageMaker, on 64 A100 40GB GPUs in P4d instances.
171
+
172
+ #### Software
173
+
174
+ Falcon-40B-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.)
175
+
176
+
177
+ ## Citation
178
+
179
+ *Paper coming soon ๐Ÿ˜Š.*
180
+
181
+ ## License
182
+
183
+ Falcon-40B-Instruct is made available under the Apache 2.0 license.
184
+
185
+ ## Contact
186
+ falconllm@tii.ae