Transformers
English
falcon
TheBloke commited on
Commit
40290f3
โ€ข
1 Parent(s): 9111cd3

Initial GGML model commit

Browse files
Files changed (1) hide show
  1. README.md +336 -0
README.md ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ inference: false
3
+ license: other
4
+ ---
5
+
6
+ <!-- header start -->
7
+ <div style="width: 100%;">
8
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
9
+ </div>
10
+ <div style="display: flex; justify-content: space-between; width: 100%;">
11
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
12
+ <p><a href="https://discord.gg/Jq4vkcDakD">Chat & support: my new Discord server</a></p>
13
+ </div>
14
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
15
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
16
+ </div>
17
+ </div>
18
+ <!-- header end -->
19
+
20
+ # Falcon 40B-Instruct GGML GGML
21
+
22
+ These files are GGML format model files for [Falcon 40B-Instruct GGML](https://huggingface.co/tiiuae/falcon-40b-instruct).
23
+
24
+ GGML files are for CPU + GPU inference using [llama.cpp](https://github.com/ggerganov/llama.cpp) and libraries and UIs which support this format, such as:
25
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
26
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp)
27
+ * [ParisNeo/GPT4All-UI](https://github.com/ParisNeo/gpt4all-ui)
28
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)
29
+ * [ctransformers](https://github.com/marella/ctransformers)
30
+
31
+ ## Repositories available
32
+
33
+ * [4-bit GPTQ models for GPU inference](https://huggingface.co/TheBloke/falcon-40b-instruct-GPTQ)
34
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/falcon-40b-instruct-GGML)
35
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/tiiuae/falcon-40b-instruct)
36
+
37
+ <!-- compatibility_ggml start -->
38
+ ## Compatibility
39
+
40
+ ### Original llama.cpp quant methods: `q4_0, q4_1, q5_0, q5_1, q8_0`
41
+
42
+ I have quantized these 'original' quantisation methods using an older version of llama.cpp so that they remain compatible with llama.cpp as of May 19th, commit `2d5db48`.
43
+
44
+ They should be compatible with all current UIs and libraries that use llama.cpp, such as those listed at the top of this README.
45
+
46
+ ### New k-quant methods: `q2_K, q3_K_S, q3_K_M, q3_K_L, q4_K_S, q4_K_M, q5_K_S, q6_K`
47
+
48
+ These new quantisation methods are only compatible with llama.cpp as of June 6th, commit `2d43387`.
49
+
50
+ They will NOT be compatible with koboldcpp, text-generation-ui, and other UIs and libraries yet. Support is expected to come over the next few days.
51
+
52
+ ## Explanation of the new k-quant methods
53
+
54
+ The new methods available are:
55
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
56
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
57
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
58
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
59
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
60
+ * GGML_TYPE_Q8_K - "type-0" 8-bit quantization. Only used for quantizing intermediate results. The difference to the existing Q8_0 is that the block size is 256. All 2-6 bit dot products are implemented for this quantization type.
61
+
62
+ Refer to the Provided Files table below to see what files use which methods, and how.
63
+ <!-- compatibility_ggml end -->
64
+
65
+ ## Provided files
66
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
67
+ | ---- | ---- | ---- | ---- | ---- | ----- |
68
+ | Falcon-40b-Instruct.ggmlv3.q4_0.bin | q4_0 | 4 | 23.54 GB | 26.04 GB | Original llama.cpp quant method, 4-bit. |
69
+ | Falcon-40b-Instruct.ggmlv3.q4_1.bin | q4_1 | 4 | 26.15 GB | 28.65 GB | Original llama.cpp quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
70
+ | Falcon-40b-Instruct.ggmlv3.q5_0.bin | q5_0 | 5 | 28.77 GB | 31.27 GB | Original llama.cpp quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. |
71
+ | Falcon-40b-Instruct.ggmlv3.q5_1.bin | q5_1 | 5 | 31.38 GB | 33.88 GB | Original llama.cpp quant method, 5-bit. Even higher accuracy, resource usage and slower inference. |
72
+
73
+
74
+ **Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
75
+
76
+ ## How to run in `llama.cpp`
77
+
78
+ I use the following command line; adjust for your tastes and needs:
79
+
80
+ ```
81
+ ./main -t 10 -ngl 32 -m wizardcoder-15b.ggmlv3.q5_0.bin --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "### Instruction: Write a story about llamas\n### Response:"
82
+ ```
83
+ Change `-t 10` to the number of physical CPU cores you have. For example if your system has 8 cores/16 threads, use `-t 8`.
84
+
85
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
86
+
87
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
88
+
89
+ ## How to run in `text-generation-webui`
90
+
91
+ Further instructions here: [text-generation-webui/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md).
92
+
93
+ <!-- footer start -->
94
+ ## Discord
95
+
96
+ For further support, and discussions on these models and AI in general, join us at:
97
+
98
+ [TheBloke AI's Discord server](https://discord.gg/Jq4vkcDakD)
99
+
100
+ ## Thanks, and how to contribute.
101
+
102
+ Thanks to the [chirper.ai](https://chirper.ai) team!
103
+
104
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
105
+
106
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
107
+
108
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
109
+
110
+ * Patreon: https://patreon.com/TheBlokeAI
111
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
112
+
113
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz, Dmitriy Samsonov.
114
+
115
+ **Patreon special mentions**: Oscar Rangel, Eugene Pentland, Talal Aujan, Cory Kujawski, Luke, Asp the Wyvern, Ai Maven, Pyrater, Alps Aficionado, senxiiz, Willem Michiel, Junyu Yang, trip7s trip, Sebastain Graf, Joseph William Delisle, Lone Striker, Jonathan Leane, Johann-Peter Hartmann, David Flickinger, Spiking Neurons AB, Kevin Schuppel, Mano Prime, Dmitriy Samsonov, Sean Connelly, Nathan LeClaire, Alain Rossmann, Fen Risland, Derek Yates, Luke Pendergrass, Nikolai Manek, Khalefa Al-Ahmad, Artur Olbinski, John Detwiler, Ajan Kanaga, Imad Khwaja, Trenton Dambrowitz, Kalila, vamX, webtim, Illia Dulskyi.
116
+
117
+ Thank you to all my generous patrons and donaters!
118
+
119
+ <!-- footer end -->
120
+
121
+ # Original model card: Falcon 40B-Instruct GGML
122
+
123
+
124
+ # โœจ Falcon-40B-Instruct
125
+
126
+ **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.**
127
+
128
+ *Paper coming soon ๐Ÿ˜Š.*
129
+
130
+ ๐Ÿค— To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
131
+
132
+ ## Why use Falcon-40B-Instruct?
133
+
134
+ * **You are looking for a ready-to-use chat/instruct model based on [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).**
135
+ * **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).
136
+ * **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)).
137
+
138
+ ๐Ÿ’ฌ **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).
139
+
140
+ ๐Ÿ’ธ **Looking for a smaller, less expensive model?** [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) is Falcon-40B-Instruct's little brother!
141
+
142
+ ```python
143
+ from transformers import AutoTokenizer, AutoModelForCausalLM
144
+ import transformers
145
+ import torch
146
+
147
+ model = "tiiuae/falcon-40b-instruct"
148
+
149
+ tokenizer = AutoTokenizer.from_pretrained(model)
150
+ pipeline = transformers.pipeline(
151
+ "text-generation",
152
+ model=model,
153
+ tokenizer=tokenizer,
154
+ torch_dtype=torch.bfloat16,
155
+ trust_remote_code=True,
156
+ device_map="auto",
157
+ )
158
+ sequences = pipeline(
159
+ "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:",
160
+ max_length=200,
161
+ do_sample=True,
162
+ top_k=10,
163
+ num_return_sequences=1,
164
+ eos_token_id=tokenizer.eos_token_id,
165
+ )
166
+ for seq in sequences:
167
+ print(f"Result: {seq['generated_text']}")
168
+
169
+ ```
170
+
171
+ 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).
172
+
173
+ You will need **at least 85-100GB of memory** to swiftly run inference with Falcon-40B.
174
+
175
+
176
+
177
+ # Model Card for Falcon-40B-Instruct
178
+
179
+ ## Model Details
180
+
181
+ ### Model Description
182
+
183
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
184
+ - **Model type:** Causal decoder-only;
185
+ - **Language(s) (NLP):** English and French;
186
+ - **License:** Apache 2.0;
187
+ - **Finetuned from model:** [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
188
+
189
+ ### Model Source
190
+
191
+ - **Paper:** *coming soon*.
192
+
193
+ ## Uses
194
+
195
+ ### Direct Use
196
+
197
+ Falcon-40B-Instruct has been finetuned on a chat dataset.
198
+
199
+ ### Out-of-Scope Use
200
+
201
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
202
+
203
+ ## Bias, Risks, and Limitations
204
+
205
+ 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.
206
+
207
+ ### Recommendations
208
+
209
+ We recommend users of Falcon-40B-Instruct to develop guardrails and to take appropriate precautions for any production use.
210
+
211
+ ## How to Get Started with the Model
212
+
213
+
214
+ ```python
215
+ from transformers import AutoTokenizer, AutoModelForCausalLM
216
+ import transformers
217
+ import torch
218
+
219
+ model = "tiiuae/falcon-40b-instruct"
220
+
221
+ tokenizer = AutoTokenizer.from_pretrained(model)
222
+ pipeline = transformers.pipeline(
223
+ "text-generation",
224
+ model=model,
225
+ tokenizer=tokenizer,
226
+ torch_dtype=torch.bfloat16,
227
+ trust_remote_code=True,
228
+ device_map="auto",
229
+ )
230
+ sequences = pipeline(
231
+ "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:",
232
+ max_length=200,
233
+ do_sample=True,
234
+ top_k=10,
235
+ num_return_sequences=1,
236
+ eos_token_id=tokenizer.eos_token_id,
237
+ )
238
+ for seq in sequences:
239
+ print(f"Result: {seq['generated_text']}")
240
+
241
+ ```
242
+
243
+ ## Training Details
244
+
245
+ ### Training Data
246
+
247
+ 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.
248
+
249
+
250
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
251
+
252
+
253
+ ## Evaluation
254
+
255
+ *Paper coming soon.*
256
+
257
+ See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
258
+
259
+
260
+ ## Technical Specifications
261
+
262
+ For more information about pretraining, see [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b).
263
+
264
+ ### Model Architecture and Objective
265
+
266
+ Falcon-40B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
267
+
268
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
269
+
270
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
271
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
272
+ * **Decoder-block:** parallel attention/MLP with a single layer norm.
273
+
274
+ For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
275
+
276
+ | **Hyperparameter** | **Value** | **Comment** |
277
+ |--------------------|-----------|----------------------------------------|
278
+ | Layers | 60 | |
279
+ | `d_model` | 8192 | |
280
+ | `head_dim` | 64 | Reduced to optimise for FlashAttention |
281
+ | Vocabulary | 65024 | |
282
+ | Sequence length | 2048 | |
283
+
284
+ ### Compute Infrastructure
285
+
286
+ #### Hardware
287
+
288
+ Falcon-40B-Instruct was trained on AWS SageMaker, on 64 A100 40GB GPUs in P4d instances.
289
+
290
+ #### Software
291
+
292
+ 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.)
293
+
294
+
295
+ ## Citation
296
+
297
+ *Paper coming soon* ๐Ÿ˜Š. In the meanwhile, you can use the following information to cite:
298
+ ```
299
+ @article{falcon40b,
300
+ title={{Falcon-40B}: an open large language model with state-of-the-art performance},
301
+ 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},
302
+ year={2023}
303
+ }
304
+ ```
305
+
306
+ To learn more about the pretraining dataset, see the ๐Ÿ““ [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
307
+
308
+ ```
309
+ @article{refinedweb,
310
+ title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
311
+ 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},
312
+ journal={arXiv preprint arXiv:2306.01116},
313
+ eprint={2306.01116},
314
+ eprinttype = {arXiv},
315
+ url={https://arxiv.org/abs/2306.01116},
316
+ year={2023}
317
+ }
318
+ ```
319
+
320
+ To cite the [Baize](https://github.com/project-baize/baize-chatbot) instruction dataset used for this model:
321
+ ```
322
+ @article{xu2023baize,
323
+ title={Baize: An Open-Source Chat Model with Parameter-Efficient Tuning on Self-Chat Data},
324
+ author={Xu, Canwen and Guo, Daya and Duan, Nan and McAuley, Julian},
325
+ journal={arXiv preprint arXiv:2304.01196},
326
+ year={2023}
327
+ }
328
+ ```
329
+
330
+
331
+ ## License
332
+
333
+ Falcon-40B-Instruct is made available under the Apache 2.0 license.
334
+
335
+ ## Contact
336
+ falconllm@tii.ae