Transformers
GGUF
mistral
conversational
TheBloke commited on
Commit
4554fc5
1 Parent(s): ccf901e

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +490 -0
README.md ADDED
@@ -0,0 +1,490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2
3
+ datasets:
4
+ - Open-Orca/OpenOrca
5
+ - OpenAssistant/oasst_top1_2023-08-25
6
+ inference: false
7
+ language:
8
+ - bg
9
+ - ca
10
+ - cs
11
+ - da
12
+ - de
13
+ - en
14
+ - es
15
+ - fr
16
+ - hr
17
+ - hu
18
+ - it
19
+ - nl
20
+ - pl
21
+ - pt
22
+ - ro
23
+ - ru
24
+ - sl
25
+ - sr
26
+ - sv
27
+ - uk
28
+ library_name: transformers
29
+ license: apache-2.0
30
+ model_creator: Nicky
31
+ model_name: Mistral 7B Openorca Oasst Top1 2023 08 25 V2
32
+ model_type: mistral
33
+ prompt_template: '<|im_start|>system
34
+
35
+ {system_message}<|im_end|>
36
+
37
+ <|im_start|>user
38
+
39
+ {prompt}<|im_end|>
40
+
41
+ <|im_start|>assistant
42
+
43
+ '
44
+ quantized_by: TheBloke
45
+ ---
46
+ <!-- markdownlint-disable MD041 -->
47
+
48
+ <!-- header start -->
49
+ <!-- 200823 -->
50
+ <div style="width: auto; margin-left: auto; margin-right: auto">
51
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
52
+ </div>
53
+ <div style="display: flex; justify-content: space-between; width: 100%;">
54
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
55
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
56
+ </div>
57
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
58
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
59
+ </div>
60
+ </div>
61
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
62
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
63
+ <!-- header end -->
64
+
65
+ # Mistral 7B Openorca Oasst Top1 2023 08 25 V2 - GGUF
66
+ - Model creator: [Nicky](https://huggingface.co/NickyNicky)
67
+ - Original model: [Mistral 7B Openorca Oasst Top1 2023 08 25 V2](https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2)
68
+
69
+ <!-- description start -->
70
+ ## Description
71
+
72
+ This repo contains GGUF format model files for [Nicky's Mistral 7B Openorca Oasst Top1 2023 08 25 V2](https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2).
73
+
74
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
75
+
76
+ <!-- description end -->
77
+ <!-- README_GGUF.md-about-gguf start -->
78
+ ### About GGUF
79
+
80
+ 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.
81
+
82
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
83
+
84
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
85
+ * [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.
86
+ * [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.
87
+ * [GPT4All](https://gpt4all.io/index.html), a free and open source local running GUI, supporting Windows, Linux and macOS with full GPU accel.
88
+ * [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.
89
+ * [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.
90
+ * [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.
91
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
92
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
93
+ * [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.
94
+
95
+ <!-- README_GGUF.md-about-gguf end -->
96
+ <!-- repositories-available start -->
97
+ ## Repositories available
98
+
99
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-AWQ)
100
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ)
101
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF)
102
+ * [Nicky's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2)
103
+ <!-- repositories-available end -->
104
+
105
+ <!-- prompt-template start -->
106
+ ## Prompt template: ChatML
107
+
108
+ ```
109
+ <|im_start|>system
110
+ {system_message}<|im_end|>
111
+ <|im_start|>user
112
+ {prompt}<|im_end|>
113
+ <|im_start|>assistant
114
+
115
+ ```
116
+
117
+ <!-- prompt-template end -->
118
+
119
+
120
+ <!-- compatibility_gguf start -->
121
+ ## Compatibility
122
+
123
+ These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
124
+
125
+ They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
126
+
127
+ ## Explanation of quantisation methods
128
+
129
+ <details>
130
+ <summary>Click to see details</summary>
131
+
132
+ The new methods available are:
133
+
134
+ * 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)
135
+ * 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.
136
+ * 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.
137
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
138
+ * 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
139
+
140
+ Refer to the Provided Files table below to see what files use which methods, and how.
141
+ </details>
142
+ <!-- compatibility_gguf end -->
143
+
144
+ <!-- README_GGUF.md-provided-files start -->
145
+ ## Provided files
146
+
147
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
148
+ | ---- | ---- | ---- | ---- | ---- | ----- |
149
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q2_K.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q2_K.gguf) | Q2_K | 2 | 3.08 GB| 5.58 GB | smallest, significant quality loss - not recommended for most purposes |
150
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q3_K_S.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q3_K_S.gguf) | Q3_K_S | 3 | 3.17 GB| 5.67 GB | very small, high quality loss |
151
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q3_K_M.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q3_K_M.gguf) | Q3_K_M | 3 | 3.52 GB| 6.02 GB | very small, high quality loss |
152
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q3_K_L.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q3_K_L.gguf) | Q3_K_L | 3 | 3.82 GB| 6.32 GB | small, substantial quality loss |
153
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_0.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_0.gguf) | Q4_0 | 4 | 4.11 GB| 6.61 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
154
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_S.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_S.gguf) | Q4_K_S | 4 | 4.14 GB| 6.64 GB | small, greater quality loss |
155
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf) | Q4_K_M | 4 | 4.37 GB| 6.87 GB | medium, balanced quality - recommended |
156
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q5_0.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q5_0.gguf) | Q5_0 | 5 | 5.00 GB| 7.50 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
157
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q5_K_S.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q5_K_S.gguf) | Q5_K_S | 5 | 5.00 GB| 7.50 GB | large, low quality loss - recommended |
158
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q5_K_M.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q5_K_M.gguf) | Q5_K_M | 5 | 5.13 GB| 7.63 GB | large, very low quality loss - recommended |
159
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q6_K.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q6_K.gguf) | Q6_K | 6 | 5.94 GB| 8.44 GB | very large, extremely low quality loss |
160
+ | [mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q8_0.gguf](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF/blob/main/mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q8_0.gguf) | Q8_0 | 8 | 7.70 GB| 10.20 GB | very large, extremely low quality loss - not recommended |
161
+
162
+ **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.
163
+
164
+
165
+
166
+ <!-- README_GGUF.md-provided-files end -->
167
+
168
+ <!-- README_GGUF.md-how-to-download start -->
169
+ ## How to download GGUF files
170
+
171
+ **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.
172
+
173
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
174
+
175
+ * LM Studio
176
+ * LoLLMS Web UI
177
+ * Faraday.dev
178
+
179
+ ### In `text-generation-webui`
180
+
181
+ Under Download Model, you can enter the model repo: TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF and below it, a specific filename to download, such as: mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf.
182
+
183
+ Then click Download.
184
+
185
+ ### On the command line, including multiple files at once
186
+
187
+ I recommend using the `huggingface-hub` Python library:
188
+
189
+ ```shell
190
+ pip3 install huggingface-hub
191
+ ```
192
+
193
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
194
+
195
+ ```shell
196
+ huggingface-cli download TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
197
+ ```
198
+
199
+ <details>
200
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
201
+
202
+ You can also download multiple files at once with a pattern:
203
+
204
+ ```shell
205
+ huggingface-cli download TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
206
+ ```
207
+
208
+ 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).
209
+
210
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
211
+
212
+ ```shell
213
+ pip3 install hf_transfer
214
+ ```
215
+
216
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
217
+
218
+ ```shell
219
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GGUF mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
220
+ ```
221
+
222
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
223
+ </details>
224
+ <!-- README_GGUF.md-how-to-download end -->
225
+
226
+ <!-- README_GGUF.md-how-to-run start -->
227
+ ## Example `llama.cpp` command
228
+
229
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
230
+
231
+ ```shell
232
+ ./main -ngl 35 -m mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant"
233
+ ```
234
+
235
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
236
+
237
+ 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.
238
+
239
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
240
+
241
+ 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)
242
+
243
+ ## How to run in `text-generation-webui`
244
+
245
+ 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).
246
+
247
+ ## How to run from Python code
248
+
249
+ 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.
250
+
251
+ ### How to load this model in Python code, using llama-cpp-python
252
+
253
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
254
+
255
+ #### First install the package
256
+
257
+ Run one of the following commands, according to your system:
258
+
259
+ ```shell
260
+ # Base ctransformers with no GPU acceleration
261
+ pip install llama-cpp-python
262
+ # With NVidia CUDA acceleration
263
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
264
+ # Or with OpenBLAS acceleration
265
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
266
+ # Or with CLBLast acceleration
267
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
268
+ # Or with AMD ROCm GPU acceleration (Linux only)
269
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
270
+ # Or with Metal GPU acceleration for macOS systems only
271
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
272
+
273
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
274
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
275
+ pip install llama-cpp-python
276
+ ```
277
+
278
+ #### Simple llama-cpp-python example code
279
+
280
+ ```python
281
+ from llama_cpp import Llama
282
+
283
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
284
+ llm = Llama(
285
+ model_path="./mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf", # Download the model file first
286
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
287
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
288
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
289
+ )
290
+
291
+ # Simple inference example
292
+ output = llm(
293
+ "<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant", # Prompt
294
+ max_tokens=512, # Generate up to 512 tokens
295
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
296
+ echo=True # Whether to echo the prompt
297
+ )
298
+
299
+ # Chat Completion API
300
+
301
+ llm = Llama(model_path="./mistral-7b-openorca-oasst_top1_2023-08-25-v2.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
302
+ llm.create_chat_completion(
303
+ messages = [
304
+ {"role": "system", "content": "You are a story writing assistant."},
305
+ {
306
+ "role": "user",
307
+ "content": "Write a story about llamas."
308
+ }
309
+ ]
310
+ )
311
+ ```
312
+
313
+ ## How to use with LangChain
314
+
315
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
316
+
317
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
318
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
319
+
320
+ <!-- README_GGUF.md-how-to-run end -->
321
+
322
+ <!-- footer start -->
323
+ <!-- 200823 -->
324
+ ## Discord
325
+
326
+ For further support, and discussions on these models and AI in general, join us at:
327
+
328
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
329
+
330
+ ## Thanks, and how to contribute
331
+
332
+ Thanks to the [chirper.ai](https://chirper.ai) team!
333
+
334
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
335
+
336
+ 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.
337
+
338
+ 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.
339
+
340
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
341
+
342
+ * Patreon: https://patreon.com/TheBlokeAI
343
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
344
+
345
+ **Special thanks to**: Aemon Algiz.
346
+
347
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
348
+
349
+
350
+ Thank you to all my generous patrons and donaters!
351
+
352
+ And thank you again to a16z for their generous grant.
353
+
354
+ <!-- footer end -->
355
+
356
+ <!-- original-model-card start -->
357
+ # Original model card: Nicky's Mistral 7B Openorca Oasst Top1 2023 08 25 V2
358
+
359
+
360
+
361
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/641b435ba5f876fe30c5ae0a/rJ1RxzuE-3gzgCppx-T8f.png)
362
+
363
+ ```
364
+ reference-data-model:
365
+
366
+ datasets:
367
+ - OpenAssistant/oasst_top1_2023-08-25:
368
+ lang: "bg,ca,cs,da,de,en,es,fr,hr,hu,it,nl,pl,pt,ro,ru,sl,sr,sv,uk"
369
+ link: https://huggingface.co/datasets/OpenAssistant/oasst_top1_2023-08-25
370
+
371
+ model:
372
+ - Open-Orca/Mistral-7B-OpenOrca
373
+ Link:
374
+ https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca
375
+
376
+ 100 examples of generating:
377
+ - Link:
378
+ https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2/blob/main/output.xlsx
379
+
380
+ Activated training with:
381
+ - Link:
382
+ https://huggingface.co/blog/tomaarsen/attention-sinks
383
+ https://github.com/tomaarsen/attention_sinks
384
+ https://arxiv.org/abs/2309.17453
385
+
386
+ Version:
387
+ - Link:
388
+ https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v1
389
+ https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v3
390
+
391
+ ```
392
+
393
+
394
+ ##
395
+
396
+
397
+ ```py
398
+ # attention-sinks
399
+ pip install attention_sinks
400
+
401
+ # flash-attn
402
+ !export CUDA_HOME=/usr/local/cuda-11.8
403
+ !MAX_JOBS=4 pip install flash-attn --no-build-isolation -qqq
404
+ !pip install git+"https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary" -qqq
405
+ ```
406
+
407
+
408
+ ## Version
409
+ ```py
410
+ import torch, transformers,torchvision
411
+ torch.__version__,transformers.__version__, torchvision.__version__
412
+ #OUTPUTS: ('2.0.1+cu118', '4.34.0.dev0', '0.15.2+cu118')
413
+ ```
414
+
415
+ ## How to use
416
+ ```py
417
+
418
+ from transformers import (
419
+ AutoModelForCausalLM,
420
+ AutoTokenizer,
421
+ BitsAndBytesConfig,
422
+ HfArgumentParser,
423
+ TrainingArguments,
424
+ pipeline,
425
+ logging,
426
+ GenerationConfig,
427
+ TextIteratorStreamer,
428
+ )
429
+
430
+ from attention_sinks import AutoModelForCausalLM
431
+
432
+ import torch
433
+
434
+ # model_id = 'Open-Orca/Mistral-7B-OpenOrca'
435
+ model_id='NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2'
436
+
437
+ model = AutoModelForCausalLM.from_pretrained(model_id,
438
+ device_map="auto",
439
+ trust_remote_code=True,
440
+ torch_dtype=torch.bfloat16,
441
+ load_in_4bit=True,
442
+ low_cpu_mem_usage= True,
443
+
444
+ attention_sink_size=4,
445
+ attention_sink_window_size=1024, #512, # <- Low for the sake of faster generation
446
+ )
447
+
448
+ max_length=2048
449
+ print("max_length",max_length)
450
+
451
+
452
+ tokenizer = AutoTokenizer.from_pretrained(model_id,
453
+ # use_fast = False,
454
+ max_length=max_length,)
455
+
456
+ tokenizer.pad_token = tokenizer.eos_token
457
+ tokenizer.padding_side = 'right'
458
+
459
+ #EXAMPLE #1
460
+ txt="""<|im_start|>user
461
+ I'm looking for an efficient Python script to output prime numbers. Can you help me out? I'm interested in a script that can handle large numbers and output them quickly. Also, it would be great if the script could take a range of numbers as input and output all the prime numbers within that range. Can you generate a script that fits these requirements? Thanks!<|im_end|>
462
+ <|im_start|>assistant
463
+ """
464
+
465
+ #EXAMPLE #2
466
+ txt="""<|im_start|>user
467
+ Estoy desarrollando una REST API con Nodejs, y estoy tratando de aplicar algún sistema de seguridad, ya sea con tokens o algo similar, me puedes ayudar?<|im_end|>
468
+ <|im_start|>assistant
469
+ """
470
+
471
+ inputs = tokenizer.encode(txt, return_tensors="pt").to("cuda")
472
+
473
+ generation_config = GenerationConfig(
474
+ max_new_tokens=max_new_tokens,
475
+ temperature=0.7,
476
+ top_p=0.9,
477
+ top_k=len_tokens,
478
+ repetition_penalty=1.11,
479
+ do_sample=True,
480
+ # pad_token_id=tokenizer.eos_token_id,
481
+ # eos_token_id=tokenizer.eos_token_id,
482
+ # use_cache=True,
483
+ # stopping_criteria= StoppingCriteriaList([stopping_criteria]),
484
+ )
485
+ outputs = model.generate(generation_config=generation_config,
486
+ input_ids=inputs,)
487
+ tokenizer.decode(outputs[0], skip_special_tokens=False) #True
488
+ ```
489
+
490
+ <!-- original-model-card end -->