TheBloke commited on
Commit
4c69431
1 Parent(s): e8c6baf

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +374 -0
README.md ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mistral-7B-Instruct-v0.1
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Mistral AI
6
+ model_name: Mistral 7B Instruct v0.1
7
+ model_type: mistral
8
+ pipeline_tag: text-generation
9
+ prompt_template: '<s>[INST] {prompt} [/INST]
10
+
11
+ '
12
+ quantized_by: TheBloke
13
+ tags:
14
+ - finetuned
15
+ ---
16
+
17
+ <!-- header start -->
18
+ <!-- 200823 -->
19
+ <div style="width: auto; margin-left: auto; margin-right: auto">
20
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
21
+ </div>
22
+ <div style="display: flex; justify-content: space-between; width: 100%;">
23
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
24
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
25
+ </div>
26
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
27
+ <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>
28
+ </div>
29
+ </div>
30
+ <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>
31
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
32
+ <!-- header end -->
33
+
34
+ # Mistral 7B Instruct v0.1 - GPTQ
35
+ - Model creator: [Mistral AI](https://huggingface.co/mistralai)
36
+ - Original model: [Mistral 7B Instruct v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
37
+
38
+ <!-- description start -->
39
+ ## Description
40
+
41
+ This repo contains GPTQ model files for [Mistral AI's Mistral 7B Instruct v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1).
42
+
43
+ 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.
44
+
45
+ <!-- description end -->
46
+ <!-- repositories-available start -->
47
+ ## Repositories available
48
+
49
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-AWQ)
50
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GPTQ)
51
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF)
52
+ * [Mistral AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
53
+ <!-- repositories-available end -->
54
+
55
+ <!-- prompt-template start -->
56
+ ## Prompt template: Mistral
57
+
58
+ ```
59
+ <s>[INST] {prompt} [/INST]
60
+
61
+ ```
62
+
63
+ <!-- prompt-template end -->
64
+
65
+
66
+ <!-- README_GPTQ.md-provided-files start -->
67
+ ## Provided files, and GPTQ parameters
68
+
69
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
70
+
71
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
72
+
73
+ All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the `main` branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
74
+
75
+ <details>
76
+ <summary>Explanation of GPTQ parameters</summary>
77
+
78
+ - Bits: The bit size of the quantised model.
79
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
80
+ - 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.
81
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
82
+ - 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).
83
+ - 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.
84
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
85
+
86
+ </details>
87
+
88
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
89
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
90
+ | [main](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 32768 | 4.16 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
91
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 32768 | 4.57 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
92
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 32768 | 7.68 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
93
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 32768 | 8.17 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
94
+
95
+ <!-- README_GPTQ.md-provided-files end -->
96
+
97
+ <!-- README_GPTQ.md-download-from-branches start -->
98
+ ## How to download, including from branches
99
+
100
+ ### In text-generation-webui
101
+
102
+ To download from the `main` branch, enter `TheBloke/Mistral-7B-Instruct-v0.1-GPTQ` in the "Download model" box.
103
+
104
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Mistral-7B-Instruct-v0.1-GPTQ:gptq-4bit-32g-actorder_True`
105
+
106
+ ### From the command line
107
+
108
+ I recommend using the `huggingface-hub` Python library:
109
+
110
+ ```shell
111
+ pip3 install huggingface-hub
112
+ ```
113
+
114
+ To download the `main` branch to a folder called `Mistral-7B-Instruct-v0.1-GPTQ`:
115
+
116
+ ```shell
117
+ mkdir Mistral-7B-Instruct-v0.1-GPTQ
118
+ huggingface-cli download TheBloke/Mistral-7B-Instruct-v0.1-GPTQ --local-dir Mistral-7B-Instruct-v0.1-GPTQ --local-dir-use-symlinks False
119
+ ```
120
+
121
+ To download from a different branch, add the `--revision` parameter:
122
+
123
+ ```shell
124
+ mkdir Mistral-7B-Instruct-v0.1-GPTQ
125
+ huggingface-cli download TheBloke/Mistral-7B-Instruct-v0.1-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Mistral-7B-Instruct-v0.1-GPTQ --local-dir-use-symlinks False
126
+ ```
127
+
128
+ <details>
129
+ <summary>More advanced huggingface-cli download usage</summary>
130
+
131
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Huggingface 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.
132
+
133
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
134
+
135
+ 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).
136
+
137
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
138
+
139
+ ```shell
140
+ pip3 install hf_transfer
141
+ ```
142
+
143
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
144
+
145
+ ```shell
146
+ mkdir Mistral-7B-Instruct-v0.1-GPTQ
147
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mistral-7B-Instruct-v0.1-GPTQ --local-dir Mistral-7B-Instruct-v0.1-GPTQ --local-dir-use-symlinks False
148
+ ```
149
+
150
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
151
+ </details>
152
+
153
+ ### With `git` (**not** recommended)
154
+
155
+ To clone a specific branch with `git`, use a command like this:
156
+
157
+ ```shell
158
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GPTQ
159
+ ```
160
+
161
+ 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.)
162
+
163
+ <!-- README_GPTQ.md-download-from-branches end -->
164
+ <!-- README_GPTQ.md-text-generation-webui start -->
165
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
166
+
167
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
168
+
169
+ 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.
170
+
171
+ 1. Click the **Model tab**.
172
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mistral-7B-Instruct-v0.1-GPTQ`.
173
+ - To download from a specific branch, enter for example `TheBloke/Mistral-7B-Instruct-v0.1-GPTQ:gptq-4bit-32g-actorder_True`
174
+ - see Provided Files above for the list of branches for each option.
175
+ 3. Click **Download**.
176
+ 4. The model will start downloading. Once it's finished it will say "Done".
177
+ 5. In the top left, click the refresh icon next to **Model**.
178
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mistral-7B-Instruct-v0.1-GPTQ`
179
+ 7. The model will automatically load, and is now ready for use!
180
+ 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.
181
+ * 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`.
182
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
183
+ <!-- README_GPTQ.md-text-generation-webui end -->
184
+
185
+ <!-- README_GPTQ.md-use-from-python start -->
186
+ ## How to use this GPTQ model from Python code
187
+
188
+ ### Install the necessary packages
189
+
190
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
191
+
192
+ ```shell
193
+ pip3 install transformers optimum
194
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
195
+ ```
196
+
197
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
198
+
199
+ ```shell
200
+ pip3 uninstall -y auto-gptq
201
+ git clone https://github.com/PanQiWei/AutoGPTQ
202
+ cd AutoGPTQ
203
+ git checkout v0.4.2
204
+ pip3 install .
205
+ ```
206
+
207
+ ### You can then use the following code
208
+
209
+ ```python
210
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
211
+
212
+ model_name_or_path = "TheBloke/Mistral-7B-Instruct-v0.1-GPTQ"
213
+ # To use a different branch, change revision
214
+ # For example: revision="gptq-4bit-32g-actorder_True"
215
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
216
+ device_map="auto",
217
+ trust_remote_code=False,
218
+ revision="main")
219
+
220
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
221
+
222
+ prompt = "Tell me about AI"
223
+ prompt_template=f'''<s>[INST] {prompt} [/INST]
224
+ '''
225
+
226
+ print("\n\n*** Generate:")
227
+
228
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
229
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
230
+ print(tokenizer.decode(output[0]))
231
+
232
+ # Inference can also be done using transformers' pipeline
233
+
234
+ print("*** Pipeline:")
235
+ pipe = pipeline(
236
+ "text-generation",
237
+ model=model,
238
+ tokenizer=tokenizer,
239
+ max_new_tokens=512,
240
+ do_sample=True,
241
+ temperature=0.7,
242
+ top_p=0.95,
243
+ top_k=40,
244
+ repetition_penalty=1.1
245
+ )
246
+
247
+ print(pipe(prompt_template)[0]['generated_text'])
248
+ ```
249
+ <!-- README_GPTQ.md-use-from-python end -->
250
+
251
+ <!-- README_GPTQ.md-compatibility start -->
252
+ ## Compatibility
253
+
254
+ The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
255
+
256
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
257
+
258
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
259
+ <!-- README_GPTQ.md-compatibility end -->
260
+
261
+ <!-- footer start -->
262
+ <!-- 200823 -->
263
+ ## Discord
264
+
265
+ For further support, and discussions on these models and AI in general, join us at:
266
+
267
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
268
+
269
+ ## Thanks, and how to contribute
270
+
271
+ Thanks to the [chirper.ai](https://chirper.ai) team!
272
+
273
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
274
+
275
+ 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.
276
+
277
+ 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.
278
+
279
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
280
+
281
+ * Patreon: https://patreon.com/TheBlokeAI
282
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
283
+
284
+ **Special thanks to**: Aemon Algiz.
285
+
286
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
287
+
288
+
289
+ Thank you to all my generous patrons and donaters!
290
+
291
+ And thank you again to a16z for their generous grant.
292
+
293
+ <!-- footer end -->
294
+
295
+ # Original model card: Mistral AI's Mistral 7B Instruct v0.1
296
+
297
+
298
+ # Model Card for Mistral-7B-Instruct-v0.1
299
+
300
+ The Mistral-7B-Instruct-v0.1 Large Language Model (LLM) is a instruct fine-tuned version of the [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) generative text model using a variety of publicly available conversation datasets.
301
+
302
+ For full details of this model please read our [release blog post](https://mistral.ai/news/announcing-mistral-7b/)
303
+
304
+ ## Instruction format
305
+
306
+ In order to leverage instruction fine-tuning, your prompt should be surrounded by `[INST]` and `[\INST]` tokens. The very first instruction should begin with a begin of sentence id. The next instructions should not. The assistant generation will be ended by the end-of-sentence token id.
307
+
308
+ E.g.
309
+ ```
310
+ text = "<s>[INST] What is your favourite condiment? [/INST]"
311
+ "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!</s> "
312
+ "[INST] Do you have mayonnaise recipes? [/INST]"
313
+ ```
314
+
315
+ This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
316
+
317
+ ```python
318
+ from transformers import AutoModelForCausalLM, AutoTokenizer
319
+
320
+ device = "cuda" # the device to load the model onto
321
+
322
+ model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
323
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
324
+
325
+ messages = [
326
+ {"role": "user", "content": "What is your favourite condiment?"},
327
+ {"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
328
+ {"role": "user", "content": "Do you have mayonnaise recipes?"}
329
+ ]
330
+
331
+ encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
332
+
333
+ model_inputs = encodeds.to(device)
334
+ model.to(device)
335
+
336
+ generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
337
+ decoded = tokenizer.batch_decode(generated_ids)
338
+ print(decoded[0])
339
+ ```
340
+
341
+ ## Model Architecture
342
+ This instruction model is based on Mistral-7B-v0.1, a transformer model with the following architecture choices:
343
+ - Grouped-Query Attention
344
+ - Sliding-Window Attention
345
+ - Byte-fallback BPE tokenizer
346
+
347
+ ## Troubleshooting
348
+ - If you see the following error:
349
+ ```
350
+ Traceback (most recent call last):
351
+ File "", line 1, in
352
+ File "/transformers/models/auto/auto_factory.py", line 482, in from_pretrained
353
+ config, kwargs = AutoConfig.from_pretrained(
354
+ File "/transformers/models/auto/configuration_auto.py", line 1022, in from_pretrained
355
+ config_class = CONFIG_MAPPING[config_dict["model_type"]]
356
+ File "/transformers/models/auto/configuration_auto.py", line 723, in getitem
357
+ raise KeyError(key)
358
+ KeyError: 'mistral'
359
+ ```
360
+
361
+ Installing transformers from source should solve the issue
362
+ pip install git+https://github.com/huggingface/transformers
363
+
364
+ This should not be required after transformers-v4.33.4.
365
+
366
+ ## Limitations
367
+
368
+ The Mistral 7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
369
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
370
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
371
+
372
+ ## The Mistral AI Team
373
+
374
+ Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.