MaziyarPanahi commited on
Commit
7bb0832
1 Parent(s): 5a8f841

01e85fdd302925afaec75f6c62b1c695fd366cb16e824e32663111f52ea1949c

Browse files
Files changed (1) hide show
  1. README.md +332 -0
README.md ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - quantized
4
+ - 2-bit
5
+ - 3-bit
6
+ - 4-bit
7
+ - 5-bit
8
+ - 6-bit
9
+ - 8-bit
10
+ - GGUF
11
+ - transformers
12
+ - pytorch
13
+ - tensorboard
14
+ - safetensors
15
+ - mistral
16
+ - text-generation
17
+ - axolotl
18
+ - 7b
19
+ - generated_from_trainer
20
+ - conversational
21
+ - afr
22
+ - amh
23
+ - ara
24
+ - aze
25
+ - bel
26
+ - ben
27
+ - bul
28
+ - cat
29
+ - ceb
30
+ - ces
31
+ - cym
32
+ - dan
33
+ - deu
34
+ - ell
35
+ - eng
36
+ - epo
37
+ - est
38
+ - eus
39
+ - fin
40
+ - fil
41
+ - fra
42
+ - fry
43
+ - gla
44
+ - gle
45
+ - glg
46
+ - guj
47
+ - hat
48
+ - hau
49
+ - heb
50
+ - hin
51
+ - hun
52
+ - hye
53
+ - ibo
54
+ - ind
55
+ - isl
56
+ - ita
57
+ - jav
58
+ - jpn
59
+ - kan
60
+ - kat
61
+ - kaz
62
+ - khm
63
+ - kir
64
+ - kor
65
+ - kur
66
+ - lao
67
+ - lav
68
+ - lat
69
+ - lit
70
+ - ltz
71
+ - mal
72
+ - mar
73
+ - mkd
74
+ - mlg
75
+ - mlt
76
+ - mon
77
+ - mri
78
+ - msa
79
+ - mya
80
+ - nep
81
+ - nld
82
+ - nor
83
+ - nso
84
+ - nya
85
+ - ory
86
+ - pan
87
+ - pes
88
+ - pol
89
+ - por
90
+ - pus
91
+ - ron
92
+ - rus
93
+ - sin
94
+ - slk
95
+ - slv
96
+ - smo
97
+ - sna
98
+ - snd
99
+ - som
100
+ - sot
101
+ - spa
102
+ - sqi
103
+ - srp
104
+ - sun
105
+ - swa
106
+ - swe
107
+ - tam
108
+ - tel
109
+ - tgk
110
+ - tha
111
+ - tur
112
+ - twi
113
+ - ukr
114
+ - urd
115
+ - uzb
116
+ - vie
117
+ - xho
118
+ - yid
119
+ - yor
120
+ - zho
121
+ - zul
122
+ - dataset:CohereForAI/aya_dataset
123
+ - base_model:mistralai/Mistral-7B-Instruct-v0.2
124
+ - license:apache-2.0
125
+ - autotrain_compatible
126
+ - endpoints_compatible
127
+ - text-generation-inference
128
+ - region:us
129
+ - text-generation
130
+ model_name: Mistral-7B-Instruct-Aya-101-GGUF
131
+ base_model: MaziyarPanahi/Mistral-7B-Instruct-Aya-101
132
+ inference: false
133
+ model_creator: MaziyarPanahi
134
+ pipeline_tag: text-generation
135
+ quantized_by: MaziyarPanahi
136
+ ---
137
+ # [MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF](https://huggingface.co/MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF)
138
+ - Model creator: [MaziyarPanahi](https://huggingface.co/MaziyarPanahi)
139
+ - Original model: [MaziyarPanahi/Mistral-7B-Instruct-Aya-101](https://huggingface.co/MaziyarPanahi/Mistral-7B-Instruct-Aya-101)
140
+
141
+ ## Description
142
+ [MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF](https://huggingface.co/MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF) contains GGUF format model files for [MaziyarPanahi/Mistral-7B-Instruct-Aya-101](https://huggingface.co/MaziyarPanahi/Mistral-7B-Instruct-Aya-101).
143
+
144
+ ## How to use
145
+ Thanks to [TheBloke](https://huggingface.co/TheBloke) for preparing an amazing README on how to use GGUF models:
146
+
147
+ ### About GGUF
148
+
149
+ 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.
150
+
151
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
152
+
153
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
154
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
155
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
156
+ * [GPT4All](https://gpt4all.io/index.html), a free and open source local running GUI, supporting Windows, Linux and macOS with full GPU accel.
157
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration. Linux available, in beta as of 27/11/2023.
158
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
159
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
160
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
161
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
162
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server. Note, as of time of writing (November 27th 2023), ctransformers has not been updated in a long time and does not support many recent models.
163
+
164
+ ### Explanation of quantisation methods
165
+
166
+ <details>
167
+ <summary>Click to see details</summary>
168
+
169
+ The new methods available are:
170
+
171
+ * 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)
172
+ * 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.
173
+ * 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.
174
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
175
+ * 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
176
+
177
+ ## How to download GGUF files
178
+
179
+ **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 file.
180
+
181
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
182
+
183
+ * LM Studio
184
+ * LoLLMS Web UI
185
+ * Faraday.dev
186
+
187
+ ### In `text-generation-webui`
188
+
189
+ Under Download Model, you can enter the model repo: [MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF](https://huggingface.co/MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF) and below it, a specific filename to download, such as: Mistral-7B-Instruct-Aya-101-GGUF.Q4_K_M.gguf.
190
+
191
+ Then click Download.
192
+
193
+ ### On the command line, including multiple files at once
194
+
195
+ I recommend using the `huggingface-hub` Python library:
196
+
197
+ ```shell
198
+ pip3 install huggingface-hub
199
+ ```
200
+
201
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
202
+
203
+ ```shell
204
+ huggingface-cli download MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF Mistral-7B-Instruct-Aya-101-GGUF.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
205
+ ```
206
+ </details>
207
+ <details>
208
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
209
+
210
+ You can also download multiple files at once with a pattern:
211
+
212
+ ```shell
213
+ huggingface-cli download [MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF](https://huggingface.co/MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF) --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
214
+ ```
215
+
216
+ 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).
217
+
218
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
219
+
220
+ ```shell
221
+ pip3 install hf_transfer
222
+ ```
223
+
224
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
225
+
226
+ ```shell
227
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download MaziyarPanahi/Mistral-7B-Instruct-Aya-101-GGUF Mistral-7B-Instruct-Aya-101-GGUF.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
228
+ ```
229
+
230
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
231
+ </details>
232
+
233
+ ## Example `llama.cpp` command
234
+
235
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
236
+
237
+ ```shell
238
+ ./main -ngl 35 -m Mistral-7B-Instruct-Aya-101-GGUF.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<|im_start|>system
239
+ {system_message}<|im_end|>
240
+ <|im_start|>user
241
+ {prompt}<|im_end|>
242
+ <|im_start|>assistant"
243
+ ```
244
+
245
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
246
+
247
+ Change `-c 32768` 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.
248
+
249
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
250
+
251
+ 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)
252
+
253
+ ## How to run in `text-generation-webui`
254
+
255
+ 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).
256
+
257
+ ## How to run from Python code
258
+
259
+ 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.
260
+
261
+ ### How to load this model in Python code, using llama-cpp-python
262
+
263
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
264
+
265
+ #### First install the package
266
+
267
+ Run one of the following commands, according to your system:
268
+
269
+ ```shell
270
+ # Base ctransformers with no GPU acceleration
271
+ pip install llama-cpp-python
272
+ # With NVidia CUDA acceleration
273
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
274
+ # Or with OpenBLAS acceleration
275
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
276
+ # Or with CLBLast acceleration
277
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
278
+ # Or with AMD ROCm GPU acceleration (Linux only)
279
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
280
+ # Or with Metal GPU acceleration for macOS systems only
281
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
282
+
283
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
284
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
285
+ pip install llama-cpp-python
286
+ ```
287
+
288
+ #### Simple llama-cpp-python example code
289
+
290
+ ```python
291
+ from llama_cpp import Llama
292
+
293
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
294
+ llm = Llama(
295
+ model_path="./Mistral-7B-Instruct-Aya-101-GGUF.Q4_K_M.gguf", # Download the model file first
296
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
297
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
298
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
299
+ )
300
+
301
+ # Simple inference example
302
+ output = llm(
303
+ "<|im_start|>system
304
+ {system_message}<|im_end|>
305
+ <|im_start|>user
306
+ {prompt}<|im_end|>
307
+ <|im_start|>assistant", # Prompt
308
+ max_tokens=512, # Generate up to 512 tokens
309
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
310
+ echo=True # Whether to echo the prompt
311
+ )
312
+
313
+ # Chat Completion API
314
+
315
+ llm = Llama(model_path="./Mistral-7B-Instruct-Aya-101-GGUF.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
316
+ llm.create_chat_completion(
317
+ messages = [
318
+ {"role": "system", "content": "You are a story writing assistant."},
319
+ {
320
+ "role": "user",
321
+ "content": "Write a story about llamas."
322
+ }
323
+ ]
324
+ )
325
+ ```
326
+
327
+ ## How to use with LangChain
328
+
329
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
330
+
331
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
332
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)