GGUF
10 languages
GGUF
andrijdavid commited on
Commit
8f710a0
β€’
1 Parent(s): 9ca5cfb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +380 -0
README.md ADDED
@@ -0,0 +1,380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ---
4
+ language:
5
+ - en
6
+ - de
7
+ - es
8
+ - fr
9
+ - it
10
+ - nl
11
+ - pl
12
+ - pt
13
+ - ro
14
+ - cs
15
+ license: unknown
16
+ tags:
17
+ - GGUF
18
+ datasets:
19
+ - tiiuae/falcon-refinedweb
20
+ inference: false
21
+ quantized_by: andrijdavid
22
+ ---
23
+ # falcon-11B-GGUF
24
+ - Original model: [falcon-11B](https://huggingface.co/tiiuae/falcon-11B)
25
+
26
+ <!-- description start -->
27
+ ## Description
28
+
29
+ This repo contains GGUF format model files for [falcon-11B](https://huggingface.co/tiiuae/falcon-11B).
30
+
31
+ <!-- description end -->
32
+ <!-- README_GGUF.md-about-gguf start -->
33
+ ### About GGUF
34
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
35
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
36
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). This is the source project for GGUF, providing both a Command Line Interface (CLI) and a server option.
37
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), Known as the most widely used web UI, this project boasts numerous features and powerful extensions, and supports GPU acceleration.
38
+ * [Ollama](https://github.com/jmorganca/ollama) Ollama is a lightweight and extensible framework designed for building and running language models locally. It features a simple API for creating, managing, and executing models, along with a library of pre-built models for use in various applications​
39
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
40
+ * [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
41
+ * [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
42
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui). A notable web UI with a variety of unique features, including a comprehensive model library for easy model selection.
43
+ * [Faraday.dev](https://faraday.dev/), An attractive, user-friendly character-based chat GUI for Windows and macOS (both Silicon and Intel), also offering GPU acceleration.
44
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), A Python library equipped with GPU acceleration, LangChain support, and an OpenAI-compatible API server.
45
+ * [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
46
+ * [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
47
+ * [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
48
+ <!-- README_GGUF.md-about-gguf end -->
49
+
50
+ <!-- compatibility_gguf start -->
51
+ ## Explanation of quantisation methods
52
+ <details>
53
+ <summary>Click to see details</summary>
54
+ The new methods available are:
55
+
56
+ * 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)
57
+ * 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.
58
+ * 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.
59
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
60
+ * 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.
61
+ </details>
62
+ <!-- compatibility_gguf end -->
63
+
64
+ <!-- README_GGUF.md-how-to-download start -->
65
+ ## How to download GGUF files
66
+
67
+ **Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single folder.
68
+
69
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
70
+
71
+ * LM Studio
72
+ * LoLLMS Web UI
73
+ * Faraday.dev
74
+
75
+ ### In `text-generation-webui`
76
+
77
+ Under Download Model, you can enter the model repo: LiteLLMs/falcon-11B-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
78
+
79
+ Then click Download.
80
+
81
+ ### On the command line, including multiple files at once
82
+
83
+ I recommend using the `huggingface-hub` Python library:
84
+
85
+ ```shell
86
+ pip3 install huggingface-hub
87
+ ```
88
+
89
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
90
+
91
+ ```shell
92
+ huggingface-cli download LiteLLMs/falcon-11B-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
93
+ ```
94
+
95
+ <details>
96
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
97
+
98
+ You can also download multiple files at once with a pattern:
99
+
100
+ ```shell
101
+ huggingface-cli download LiteLLMs/falcon-11B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
102
+ ```
103
+
104
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
105
+
106
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
107
+
108
+ ```shell
109
+ pip3 install huggingface_hub[hf_transfer]
110
+ ```
111
+
112
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
113
+
114
+ ```shell
115
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/falcon-11B-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
116
+ ```
117
+
118
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
119
+ </details>
120
+ <!-- README_GGUF.md-how-to-download end -->
121
+ <!-- README_GGUF.md-how-to-run start -->
122
+ ## Example `llama.cpp` command
123
+
124
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
125
+
126
+ ```shell
127
+ ./main -ngl 35 -m Q4_0/Q4_0-00001-of-00009.gguf --color -c 8192 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
128
+ ```
129
+
130
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
131
+
132
+ Change `-c 8192` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
133
+
134
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
135
+
136
+ For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
137
+
138
+ ## How to run in `text-generation-webui`
139
+
140
+ Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
141
+
142
+ ## How to run from Python code
143
+
144
+ You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
145
+
146
+ ### How to load this model in Python code, using llama-cpp-python
147
+
148
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
149
+
150
+ #### First install the package
151
+
152
+ Run one of the following commands, according to your system:
153
+
154
+ ```shell
155
+ # Base ctransformers with no GPU acceleration
156
+ pip install llama-cpp-python
157
+ # With NVidia CUDA acceleration
158
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
159
+ # Or with OpenBLAS acceleration
160
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
161
+ # Or with CLBLast acceleration
162
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
163
+ # Or with AMD ROCm GPU acceleration (Linux only)
164
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
165
+ # Or with Metal GPU acceleration for macOS systems only
166
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
167
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
168
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
169
+ pip install llama-cpp-python
170
+ ```
171
+
172
+ #### Simple llama-cpp-python example code
173
+
174
+ ```python
175
+ from llama_cpp import Llama
176
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
177
+ llm = Llama(
178
+ model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
179
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
180
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
181
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
182
+ )
183
+ # Simple inference example
184
+ output = llm(
185
+ "<PROMPT>", # Prompt
186
+ max_tokens=512, # Generate up to 512 tokens
187
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
188
+ echo=True # Whether to echo the prompt
189
+ )
190
+ # Chat Completion API
191
+ llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
192
+ llm.create_chat_completion(
193
+ messages = [
194
+ {"role": "system", "content": "You are a story writing assistant."},
195
+ {
196
+ "role": "user",
197
+ "content": "Write a story about llamas."
198
+ }
199
+ ]
200
+ )
201
+ ```
202
+
203
+ ## How to use with LangChain
204
+
205
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
206
+
207
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
208
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
209
+
210
+ <!-- README_GGUF.md-how-to-run end -->
211
+
212
+ <!-- footer end -->
213
+
214
+ <!-- original-model-card start -->
215
+ # Original model card: falcon-11B
216
+
217
+
218
+ # πŸš€ Falcon2-11B
219
+
220
+ **Falcon2-11B is an 11B parameters causal decoder-only model built by [TII](https://www.tii.ae) and trained on over 5,000B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. The model is made available under the [TII Falcon License 2.0](https://falconllm-staging.tii.ae/falcon-2-terms-and-conditions.html), the permissive Apache 2.0-based software license which includes an [acceptable use policy](https://falconllm-staging.tii.ae/falcon-2-acceptable-use-policy.html) that promotes the responsible use of AI.**
221
+
222
+ *Paper coming soon 😊.*
223
+
224
+
225
+ πŸ€— To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost from HF](https://huggingface.co/blog/falcon)!
226
+
227
+ ⚠️ **This is a raw, pretrained model, which should be further finetuned for most usecases.**
228
+
229
+ ```python
230
+ from transformers import AutoTokenizer, AutoModelForCausalLM
231
+ import transformers
232
+ import torch
233
+
234
+ model = "tiiuae/falcon-11B"
235
+
236
+ tokenizer = AutoTokenizer.from_pretrained(model)
237
+ pipeline = transformers.pipeline(
238
+ "text-generation",
239
+ model=model,
240
+ tokenizer=tokenizer,
241
+ torch_dtype=torch.bfloat16,
242
+ )
243
+ sequences = pipeline(
244
+ "Can you explain the concepts of Quantum Computing?",
245
+ max_length=200,
246
+ do_sample=True,
247
+ top_k=10,
248
+ num_return_sequences=1,
249
+ eos_token_id=tokenizer.eos_token_id,
250
+ )
251
+ for seq in sequences:
252
+ print(f"Result: {seq['generated_text']}")
253
+
254
+ ```
255
+
256
+ πŸ’₯ **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
257
+
258
+ 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).
259
+
260
+ # Model Card for Falcon2-11B
261
+
262
+ ## Model Details
263
+
264
+ ### Model Description
265
+
266
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae)
267
+ - **Model type:** Causal decoder-only
268
+ - **Language(s) (NLP):** English, German, Spanish, French, Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish
269
+ - **License:** [TII Falcon License 2.0](https://falconllm-staging.tii.ae/falcon-2-terms-and-conditions.html)
270
+
271
+ ### Model Source
272
+
273
+ - **Paper:** *coming soon*.
274
+
275
+ ## Uses
276
+
277
+ ### Direct Use
278
+
279
+ Research on large language models; as a foundation for further specialization and finetuning for specific usecases (e.g., summarization, text generation, chatbot, etc.)
280
+
281
+ ### Out-of-Scope Use
282
+
283
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
284
+
285
+ ## Bias, Risks, and Limitations
286
+
287
+ Falcon2-11B is trained mostly on English, but also German, Spanish, French, Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish. It 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.
288
+
289
+ ### Recommendations
290
+
291
+ We recommend users of Falcon2-11B to consider finetuning it for the specific set of tasks of interest, and for guardrails and appropriate precautions to be taken for any production use.
292
+
293
+ ## How to Get Started with the Model
294
+
295
+
296
+ ```python
297
+ from transformers import AutoTokenizer, AutoModelForCausalLM
298
+ import transformers
299
+ import torch
300
+
301
+ model = "tiiuae/falcon-11B"
302
+
303
+ tokenizer = AutoTokenizer.from_pretrained(model)
304
+ pipeline = transformers.pipeline(
305
+ "text-generation",
306
+ model=model,
307
+ tokenizer=tokenizer,
308
+ torch_dtype=torch.bfloat16,
309
+ device_map="auto",
310
+ )
311
+ sequences = pipeline(
312
+ "Can you explain the concepts of Quantum Computing?",
313
+ max_length=200,
314
+ do_sample=True,
315
+ top_k=10,
316
+ num_return_sequences=1,
317
+ eos_token_id=tokenizer.eos_token_id,
318
+ )
319
+ for seq in sequences:
320
+ print(f"Result: {seq['generated_text']}")
321
+
322
+ ```
323
+
324
+ ## Training Details
325
+
326
+ ### Training Data
327
+
328
+ Falcon2-11B was trained over 5,000B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb), a high-quality filtered and deduplicated web dataset which we enhanced with curated corpora. It followed a four stage training strategy. The first three stages were focused on increasing the context length, from to 2048 to 4096 and finally to 8192 tokens. The last stage aimed to further enhance performance using only high quality data.
329
+
330
+ Overall, the data sources included RefinedWeb-English, Refined Web-Europe (cs, de, es, fr, it, nl, pl, pt, ro, sv), high quality technical data, code data, and conversational data extracted from public sources.
331
+
332
+
333
+ The training stages were as follows:
334
+
335
+ | **Stage** | **Context length** | **Tokens** |
336
+ | - |
337
+ | Stage 1 | 2048 | 4500 B |
338
+ | Stage 2 | 4096 | 250 B |
339
+ | Stage 3 | 8192 | 250 B |
340
+ | Stage 4 | 8192 | 500 B |
341
+
342
+
343
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[11B](https://huggingface.co/tiiuae/falcon-11B) tokenizer.
344
+
345
+ ### Training Procedure
346
+
347
+ Falcon2-11B was trained on 1024 A100 40GB GPUs for the majority of the training, using a 3D parallelism strategy (TP=8, PP=1, DP=128) combined with ZeRO and Flash-Attention 2.
348
+
349
+ #### Training Hyperparameters
350
+
351
+ | **Hyperparameter** | **Value** | **Comment** |
352
+ | | | | --- |
353
+ | Layers | 60 | |
354
+ | `d_model` | 4096 | |
355
+ | `head_dim` | 128 | |
356
+ | Vocabulary | 65024 | |
357
+ | Sequence length | 8192 | During stages 3 and 4 |
358
+
359
+ ### Compute Infrastructure
360
+
361
+ #### Hardware
362
+
363
+ Falcon2-11B was trained on AWS SageMaker, using on average 1024 A100 40GB GPUs in 128 p4d instances.
364
+
365
+ #### Software
366
+
367
+ Falcon2-11B was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO, high-performance Triton kernels and FlashAttention-2. More details about the distributed training strategy can be found in [Almazrouei et.al](https://arxiv.org/abs/2311.16867).
368
+
369
+ ## Citation
370
+
371
+ *Paper coming soon* 😊.
372
+
373
+ ## License
374
+
375
+ Falcon2-11B is licenced under [TII Falcon License 2.0](https://falconllm-staging.tii.ae/falcon-2-terms-and-conditions.html), the permissive Apache 2.0-based software license which includes an [acceptable use policy](https://falconllm-staging.tii.ae/falcon-2-acceptable-use-policy.html) that promotes the responsible use of AI.
376
+
377
+ ## Contact
378
379
+
380
+ <!-- original-model-card end -->