TheBloke commited on
Commit
7893840
1 Parent(s): 6f51c69

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +538 -0
README.md ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - GPTQ
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 GPTQ 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
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
75
+
76
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
77
+
78
+ <!-- description end -->
79
+ <!-- repositories-available start -->
80
+ ## Repositories available
81
+
82
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-AWQ)
83
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ)
84
+ * [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)
85
+ * [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)
86
+ <!-- repositories-available end -->
87
+
88
+ <!-- prompt-template start -->
89
+ ## Prompt template: ChatML
90
+
91
+ ```
92
+ <|im_start|>system
93
+ {system_message}<|im_end|>
94
+ <|im_start|>user
95
+ {prompt}<|im_end|>
96
+ <|im_start|>assistant
97
+
98
+ ```
99
+
100
+ <!-- prompt-template end -->
101
+
102
+
103
+
104
+ <!-- README_GPTQ.md-compatible clients start -->
105
+ ## Known compatible clients / servers
106
+
107
+ GPTQ models are currently supported on Linux (NVidia/AMD) and Windows (NVidia only). macOS users: please use GGUF models.
108
+
109
+ These GPTQ models are known to work in the following inference servers/webuis.
110
+
111
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
112
+ - [KoboldAI United](https://github.com/henk717/koboldai)
113
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
114
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
115
+
116
+ This may not be a complete list; if you know of others, please let me know!
117
+ <!-- README_GPTQ.md-compatible clients end -->
118
+
119
+ <!-- README_GPTQ.md-provided-files start -->
120
+ ## Provided files, and GPTQ parameters
121
+
122
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
123
+
124
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
125
+
126
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
127
+
128
+ <details>
129
+ <summary>Explanation of GPTQ parameters</summary>
130
+
131
+ - Bits: The bit size of the quantised model.
132
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
133
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
134
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
135
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
136
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
137
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
138
+
139
+ </details>
140
+
141
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
142
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
143
+ | [main](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.16 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
144
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.57 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
145
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 7.52 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
146
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 7.68 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
147
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 8.17 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
148
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.30 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
149
+
150
+ <!-- README_GPTQ.md-provided-files end -->
151
+
152
+ <!-- README_GPTQ.md-download-from-branches start -->
153
+ ## How to download, including from branches
154
+
155
+ ### In text-generation-webui
156
+
157
+ To download from the `main` branch, enter `TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ` in the "Download model" box.
158
+
159
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ:gptq-4bit-32g-actorder_True`
160
+
161
+ ### From the command line
162
+
163
+ I recommend using the `huggingface-hub` Python library:
164
+
165
+ ```shell
166
+ pip3 install huggingface-hub
167
+ ```
168
+
169
+ To download the `main` branch to a folder called `Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ`:
170
+
171
+ ```shell
172
+ mkdir Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ
173
+ huggingface-cli download TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --local-dir Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --local-dir-use-symlinks False
174
+ ```
175
+
176
+ To download from a different branch, add the `--revision` parameter:
177
+
178
+ ```shell
179
+ mkdir Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ
180
+ huggingface-cli download TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --local-dir-use-symlinks False
181
+ ```
182
+
183
+ <details>
184
+ <summary>More advanced huggingface-cli download usage</summary>
185
+
186
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
187
+
188
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
189
+
190
+ 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).
191
+
192
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
193
+
194
+ ```shell
195
+ pip3 install hf_transfer
196
+ ```
197
+
198
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
199
+
200
+ ```shell
201
+ mkdir Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ
202
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --local-dir Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --local-dir-use-symlinks False
203
+ ```
204
+
205
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
206
+ </details>
207
+
208
+ ### With `git` (**not** recommended)
209
+
210
+ To clone a specific branch with `git`, use a command like this:
211
+
212
+ ```shell
213
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ
214
+ ```
215
+
216
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
217
+
218
+ <!-- README_GPTQ.md-download-from-branches end -->
219
+ <!-- README_GPTQ.md-text-generation-webui start -->
220
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
221
+
222
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
223
+
224
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
225
+
226
+ 1. Click the **Model tab**.
227
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ`.
228
+
229
+ - To download from a specific branch, enter for example `TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ:gptq-4bit-32g-actorder_True`
230
+ - see Provided Files above for the list of branches for each option.
231
+
232
+ 3. Click **Download**.
233
+ 4. The model will start downloading. Once it's finished it will say "Done".
234
+ 5. In the top left, click the refresh icon next to **Model**.
235
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ`
236
+ 7. The model will automatically load, and is now ready for use!
237
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
238
+
239
+ - Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
240
+
241
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
242
+
243
+ <!-- README_GPTQ.md-text-generation-webui end -->
244
+
245
+ <!-- README_GPTQ.md-use-from-tgi start -->
246
+ ## Serving this model from Text Generation Inference (TGI)
247
+
248
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
249
+
250
+ Example Docker parameters:
251
+
252
+ ```shell
253
+ --model-id TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
254
+ ```
255
+
256
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
257
+
258
+ ```shell
259
+ pip3 install huggingface-hub
260
+ ```
261
+
262
+ ```python
263
+ from huggingface_hub import InferenceClient
264
+
265
+ endpoint_url = "https://your-endpoint-url-here"
266
+
267
+ prompt = "Tell me about AI"
268
+ prompt_template=f'''<|im_start|>system
269
+ {system_message}<|im_end|>
270
+ <|im_start|>user
271
+ {prompt}<|im_end|>
272
+ <|im_start|>assistant
273
+ '''
274
+
275
+ client = InferenceClient(endpoint_url)
276
+ response = client.text_generation(
277
+ prompt_template,
278
+ max_new_tokens=128,
279
+ do_sample=True,
280
+ temperature=0.7,
281
+ top_p=0.95,
282
+ top_k=40,
283
+ repetition_penalty=1.1
284
+ )
285
+
286
+ print(f"Model output: {response}")
287
+ ```
288
+ <!-- README_GPTQ.md-use-from-tgi end -->
289
+ <!-- README_GPTQ.md-use-from-python start -->
290
+ ## Python code example: inference from this GPTQ model
291
+
292
+ ### Install the necessary packages
293
+
294
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
295
+
296
+ ```shell
297
+ pip3 install --upgrade transformers optimum
298
+ # If using PyTorch 2.1 + CUDA 12.x:
299
+ pip3 install --upgrade auto-gptq
300
+ # or, if using PyTorch 2.1 + CUDA 11.x:
301
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
302
+ ```
303
+
304
+ If you are using PyTorch 2.0, you will need to install AutoGPTQ from source. Likewise if you have problems with the pre-built wheels, you should try building from source:
305
+
306
+ ```shell
307
+ pip3 uninstall -y auto-gptq
308
+ git clone https://github.com/PanQiWei/AutoGPTQ
309
+ cd AutoGPTQ
310
+ git checkout v0.5.1
311
+ pip3 install .
312
+ ```
313
+
314
+ ### Example Python code
315
+
316
+ ```python
317
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
318
+
319
+ model_name_or_path = "TheBloke/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2-GPTQ"
320
+ # To use a different branch, change revision
321
+ # For example: revision="gptq-4bit-32g-actorder_True"
322
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
323
+ device_map="auto",
324
+ trust_remote_code=False,
325
+ revision="main")
326
+
327
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
328
+
329
+ prompt = "Write a story about llamas"
330
+ system_message = "You are a story writing assistant"
331
+ prompt_template=f'''<|im_start|>system
332
+ {system_message}<|im_end|>
333
+ <|im_start|>user
334
+ {prompt}<|im_end|>
335
+ <|im_start|>assistant
336
+ '''
337
+
338
+ print("\n\n*** Generate:")
339
+
340
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
341
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
342
+ print(tokenizer.decode(output[0]))
343
+
344
+ # Inference can also be done using transformers' pipeline
345
+
346
+ print("*** Pipeline:")
347
+ pipe = pipeline(
348
+ "text-generation",
349
+ model=model,
350
+ tokenizer=tokenizer,
351
+ max_new_tokens=512,
352
+ do_sample=True,
353
+ temperature=0.7,
354
+ top_p=0.95,
355
+ top_k=40,
356
+ repetition_penalty=1.1
357
+ )
358
+
359
+ print(pipe(prompt_template)[0]['generated_text'])
360
+ ```
361
+ <!-- README_GPTQ.md-use-from-python end -->
362
+
363
+ <!-- README_GPTQ.md-compatibility start -->
364
+ ## Compatibility
365
+
366
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
367
+
368
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama architecture models (including Mistral, Yi, DeepSeek, SOLAR, etc) in 4-bit. Please see the Provided Files table above for per-file compatibility.
369
+
370
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
371
+ <!-- README_GPTQ.md-compatibility end -->
372
+
373
+ <!-- footer start -->
374
+ <!-- 200823 -->
375
+ ## Discord
376
+
377
+ For further support, and discussions on these models and AI in general, join us at:
378
+
379
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
380
+
381
+ ## Thanks, and how to contribute
382
+
383
+ Thanks to the [chirper.ai](https://chirper.ai) team!
384
+
385
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
386
+
387
+ 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.
388
+
389
+ 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.
390
+
391
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
392
+
393
+ * Patreon: https://patreon.com/TheBlokeAI
394
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
395
+
396
+ **Special thanks to**: Aemon Algiz.
397
+
398
+ **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
399
+
400
+
401
+ Thank you to all my generous patrons and donaters!
402
+
403
+ And thank you again to a16z for their generous grant.
404
+
405
+ <!-- footer end -->
406
+
407
+ # Original model card: Nicky's Mistral 7B Openorca Oasst Top1 2023 08 25 V2
408
+
409
+
410
+
411
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/641b435ba5f876fe30c5ae0a/rJ1RxzuE-3gzgCppx-T8f.png)
412
+
413
+ ```
414
+ reference-data-model:
415
+
416
+ datasets:
417
+ - OpenAssistant/oasst_top1_2023-08-25:
418
+ lang: "bg,ca,cs,da,de,en,es,fr,hr,hu,it,nl,pl,pt,ro,ru,sl,sr,sv,uk"
419
+ link: https://huggingface.co/datasets/OpenAssistant/oasst_top1_2023-08-25
420
+
421
+ model:
422
+ - Open-Orca/Mistral-7B-OpenOrca
423
+ Link:
424
+ https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca
425
+
426
+ 100 examples of generating:
427
+ - Link:
428
+ https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2/blob/main/output.xlsx
429
+
430
+ Activated training with:
431
+ - Link:
432
+ https://huggingface.co/blog/tomaarsen/attention-sinks
433
+ https://github.com/tomaarsen/attention_sinks
434
+ https://arxiv.org/abs/2309.17453
435
+
436
+ Version:
437
+ - Link:
438
+ https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v1
439
+ https://huggingface.co/NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v3
440
+
441
+ ```
442
+
443
+
444
+ ##
445
+
446
+
447
+ ```py
448
+ # attention-sinks
449
+ pip install attention_sinks
450
+
451
+ # flash-attn
452
+ !export CUDA_HOME=/usr/local/cuda-11.8
453
+ !MAX_JOBS=4 pip install flash-attn --no-build-isolation -qqq
454
+ !pip install git+"https://github.com/HazyResearch/flash-attention.git#subdirectory=csrc/rotary" -qqq
455
+ ```
456
+
457
+
458
+ ## Version
459
+ ```py
460
+ import torch, transformers,torchvision
461
+ torch.__version__,transformers.__version__, torchvision.__version__
462
+ #OUTPUTS: ('2.0.1+cu118', '4.34.0.dev0', '0.15.2+cu118')
463
+ ```
464
+
465
+ ## How to use
466
+ ```py
467
+
468
+ from transformers import (
469
+ AutoModelForCausalLM,
470
+ AutoTokenizer,
471
+ BitsAndBytesConfig,
472
+ HfArgumentParser,
473
+ TrainingArguments,
474
+ pipeline,
475
+ logging,
476
+ GenerationConfig,
477
+ TextIteratorStreamer,
478
+ )
479
+
480
+ from attention_sinks import AutoModelForCausalLM
481
+
482
+ import torch
483
+
484
+ # model_id = 'Open-Orca/Mistral-7B-OpenOrca'
485
+ model_id='NickyNicky/Mistral-7B-OpenOrca-oasst_top1_2023-08-25-v2'
486
+
487
+ model = AutoModelForCausalLM.from_pretrained(model_id,
488
+ device_map="auto",
489
+ trust_remote_code=True,
490
+ torch_dtype=torch.bfloat16,
491
+ load_in_4bit=True,
492
+ low_cpu_mem_usage= True,
493
+
494
+ attention_sink_size=4,
495
+ attention_sink_window_size=1024, #512, # <- Low for the sake of faster generation
496
+ )
497
+
498
+ max_length=2048
499
+ print("max_length",max_length)
500
+
501
+
502
+ tokenizer = AutoTokenizer.from_pretrained(model_id,
503
+ # use_fast = False,
504
+ max_length=max_length,)
505
+
506
+ tokenizer.pad_token = tokenizer.eos_token
507
+ tokenizer.padding_side = 'right'
508
+
509
+ #EXAMPLE #1
510
+ txt="""<|im_start|>user
511
+ 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|>
512
+ <|im_start|>assistant
513
+ """
514
+
515
+ #EXAMPLE #2
516
+ txt="""<|im_start|>user
517
+ 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|>
518
+ <|im_start|>assistant
519
+ """
520
+
521
+ inputs = tokenizer.encode(txt, return_tensors="pt").to("cuda")
522
+
523
+ generation_config = GenerationConfig(
524
+ max_new_tokens=max_new_tokens,
525
+ temperature=0.7,
526
+ top_p=0.9,
527
+ top_k=len_tokens,
528
+ repetition_penalty=1.11,
529
+ do_sample=True,
530
+ # pad_token_id=tokenizer.eos_token_id,
531
+ # eos_token_id=tokenizer.eos_token_id,
532
+ # use_cache=True,
533
+ # stopping_criteria= StoppingCriteriaList([stopping_criteria]),
534
+ )
535
+ outputs = model.generate(generation_config=generation_config,
536
+ input_ids=inputs,)
537
+ tokenizer.decode(outputs[0], skip_special_tokens=False) #True
538
+ ```