TheBloke commited on
Commit
15061a1
1 Parent(s): 3ffe1a6

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +580 -0
README.md ADDED
@@ -0,0 +1,580 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: PAIXAI/Astrid-Mistral-7B
3
+ inference: false
4
+ language:
5
+ - en
6
+ library_name: transformers
7
+ license: apache-2.0
8
+ model_creator: PAIX
9
+ model_name: Astrid Mistral 7B
10
+ model_type: mistral
11
+ prompt_template: '<|im_start|>system
12
+
13
+ {system_message}<|im_end|>
14
+
15
+ <|im_start|>user
16
+
17
+ {prompt}<|im_end|>
18
+
19
+ <|im_start|>assistant
20
+
21
+ '
22
+ quantized_by: TheBloke
23
+ tags:
24
+ - gpt
25
+ - llm
26
+ - large language model
27
+ - PAIX.Cloud
28
+ thumbnail: https://static.wixstatic.com/media/bdee4e_8aa5cefc86024bc88f7e20e3e19d9ff3~mv2.png/v1/fill/w_192%2Ch_192%2Clg_1%2Cusm_0.66_1.00_0.01/bdee4e_8aa5cefc86024bc88f7e20e3e19d9ff3~mv2.png
29
+ ---
30
+ <!-- markdownlint-disable MD041 -->
31
+
32
+ <!-- header start -->
33
+ <!-- 200823 -->
34
+ <div style="width: auto; margin-left: auto; margin-right: auto">
35
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
36
+ </div>
37
+ <div style="display: flex; justify-content: space-between; width: 100%;">
38
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
39
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
40
+ </div>
41
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
42
+ <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>
43
+ </div>
44
+ </div>
45
+ <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>
46
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
47
+ <!-- header end -->
48
+
49
+ # Astrid Mistral 7B - GPTQ
50
+ - Model creator: [PAIX](https://huggingface.co/PAIXAI)
51
+ - Original model: [Astrid Mistral 7B](https://huggingface.co/PAIXAI/Astrid-Mistral-7B)
52
+
53
+ <!-- description start -->
54
+ # Description
55
+
56
+ This repo contains GPTQ model files for [PAIX's Astrid Mistral 7B](https://huggingface.co/PAIXAI/Astrid-Mistral-7B).
57
+
58
+ 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.
59
+
60
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
61
+
62
+ <!-- description end -->
63
+ <!-- repositories-available start -->
64
+ ## Repositories available
65
+
66
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Astrid-Mistral-7B-AWQ)
67
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Astrid-Mistral-7B-GPTQ)
68
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Astrid-Mistral-7B-GGUF)
69
+ * [PAIX's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/PAIXAI/Astrid-Mistral-7B)
70
+ <!-- repositories-available end -->
71
+
72
+ <!-- prompt-template start -->
73
+ ## Prompt template: ChatML
74
+
75
+ ```
76
+ <|im_start|>system
77
+ {system_message}<|im_end|>
78
+ <|im_start|>user
79
+ {prompt}<|im_end|>
80
+ <|im_start|>assistant
81
+
82
+ ```
83
+
84
+ <!-- prompt-template end -->
85
+
86
+
87
+
88
+ <!-- README_GPTQ.md-compatible clients start -->
89
+ ## Known compatible clients / servers
90
+
91
+ These GPTQ models are known to work in the following inference servers/webuis.
92
+
93
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
94
+ - [KoboldAI United](https://github.com/henk717/koboldai)
95
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
96
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
97
+
98
+ This may not be a complete list; if you know of others, please let me know!
99
+ <!-- README_GPTQ.md-compatible clients end -->
100
+
101
+ <!-- README_GPTQ.md-provided-files start -->
102
+ ## Provided files, and GPTQ parameters
103
+
104
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
105
+
106
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
107
+
108
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
109
+
110
+ <details>
111
+ <summary>Explanation of GPTQ parameters</summary>
112
+
113
+ - Bits: The bit size of the quantised model.
114
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
115
+ - 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.
116
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
117
+ - 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).
118
+ - 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.
119
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
120
+
121
+ </details>
122
+
123
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
124
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
125
+ | [main](https://huggingface.co/TheBloke/Astrid-Mistral-7B-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. |
126
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Astrid-Mistral-7B-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. |
127
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Astrid-Mistral-7B-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. |
128
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Astrid-Mistral-7B-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. |
129
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Astrid-Mistral-7B-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. |
130
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Astrid-Mistral-7B-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. |
131
+
132
+ <!-- README_GPTQ.md-provided-files end -->
133
+
134
+ <!-- README_GPTQ.md-download-from-branches start -->
135
+ ## How to download, including from branches
136
+
137
+ ### In text-generation-webui
138
+
139
+ To download from the `main` branch, enter `TheBloke/Astrid-Mistral-7B-GPTQ` in the "Download model" box.
140
+
141
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Astrid-Mistral-7B-GPTQ:gptq-4bit-32g-actorder_True`
142
+
143
+ ### From the command line
144
+
145
+ I recommend using the `huggingface-hub` Python library:
146
+
147
+ ```shell
148
+ pip3 install huggingface-hub
149
+ ```
150
+
151
+ To download the `main` branch to a folder called `Astrid-Mistral-7B-GPTQ`:
152
+
153
+ ```shell
154
+ mkdir Astrid-Mistral-7B-GPTQ
155
+ huggingface-cli download TheBloke/Astrid-Mistral-7B-GPTQ --local-dir Astrid-Mistral-7B-GPTQ --local-dir-use-symlinks False
156
+ ```
157
+
158
+ To download from a different branch, add the `--revision` parameter:
159
+
160
+ ```shell
161
+ mkdir Astrid-Mistral-7B-GPTQ
162
+ huggingface-cli download TheBloke/Astrid-Mistral-7B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Astrid-Mistral-7B-GPTQ --local-dir-use-symlinks False
163
+ ```
164
+
165
+ <details>
166
+ <summary>More advanced huggingface-cli download usage</summary>
167
+
168
+ 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.
169
+
170
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
171
+
172
+ 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).
173
+
174
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
175
+
176
+ ```shell
177
+ pip3 install hf_transfer
178
+ ```
179
+
180
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
181
+
182
+ ```shell
183
+ mkdir Astrid-Mistral-7B-GPTQ
184
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Astrid-Mistral-7B-GPTQ --local-dir Astrid-Mistral-7B-GPTQ --local-dir-use-symlinks False
185
+ ```
186
+
187
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
188
+ </details>
189
+
190
+ ### With `git` (**not** recommended)
191
+
192
+ To clone a specific branch with `git`, use a command like this:
193
+
194
+ ```shell
195
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Astrid-Mistral-7B-GPTQ
196
+ ```
197
+
198
+ 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.)
199
+
200
+ <!-- README_GPTQ.md-download-from-branches end -->
201
+ <!-- README_GPTQ.md-text-generation-webui start -->
202
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
203
+
204
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
205
+
206
+ 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.
207
+
208
+ 1. Click the **Model tab**.
209
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Astrid-Mistral-7B-GPTQ`.
210
+
211
+ - To download from a specific branch, enter for example `TheBloke/Astrid-Mistral-7B-GPTQ:gptq-4bit-32g-actorder_True`
212
+ - see Provided Files above for the list of branches for each option.
213
+
214
+ 3. Click **Download**.
215
+ 4. The model will start downloading. Once it's finished it will say "Done".
216
+ 5. In the top left, click the refresh icon next to **Model**.
217
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Astrid-Mistral-7B-GPTQ`
218
+ 7. The model will automatically load, and is now ready for use!
219
+ 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.
220
+
221
+ - 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`.
222
+
223
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
224
+
225
+ <!-- README_GPTQ.md-text-generation-webui end -->
226
+
227
+ <!-- README_GPTQ.md-use-from-tgi start -->
228
+ ## Serving this model from Text Generation Inference (TGI)
229
+
230
+ 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`
231
+
232
+ Example Docker parameters:
233
+
234
+ ```shell
235
+ --model-id TheBloke/Astrid-Mistral-7B-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
236
+ ```
237
+
238
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
239
+
240
+ ```shell
241
+ pip3 install huggingface-hub
242
+ ```
243
+
244
+ ```python
245
+ from huggingface_hub import InferenceClient
246
+
247
+ endpoint_url = "https://your-endpoint-url-here"
248
+
249
+ prompt = "Tell me about AI"
250
+ prompt_template=f'''<|im_start|>system
251
+ {system_message}<|im_end|>
252
+ <|im_start|>user
253
+ {prompt}<|im_end|>
254
+ <|im_start|>assistant
255
+ '''
256
+
257
+ client = InferenceClient(endpoint_url)
258
+ response = client.text_generation(prompt,
259
+ max_new_tokens=128,
260
+ do_sample=True,
261
+ temperature=0.7,
262
+ top_p=0.95,
263
+ top_k=40,
264
+ repetition_penalty=1.1)
265
+
266
+ print(f"Model output: {response}")
267
+ ```
268
+ <!-- README_GPTQ.md-use-from-tgi end -->
269
+ <!-- README_GPTQ.md-use-from-python start -->
270
+ ## Python code example: inference from this GPTQ model
271
+
272
+ ### Install the necessary packages
273
+
274
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
275
+
276
+ ```shell
277
+ pip3 install --upgrade transformers optimum
278
+ # If using PyTorch 2.1 + CUDA 12.x:
279
+ pip3 install --upgrade auto-gptq
280
+ # or, if using PyTorch 2.1 + CUDA 11.x:
281
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
282
+ ```
283
+
284
+ 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:
285
+
286
+ ```shell
287
+ pip3 uninstall -y auto-gptq
288
+ git clone https://github.com/PanQiWei/AutoGPTQ
289
+ cd AutoGPTQ
290
+ git checkout v0.5.1
291
+ pip3 install .
292
+ ```
293
+
294
+ ### Example Python code
295
+
296
+ ```python
297
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
298
+
299
+ model_name_or_path = "TheBloke/Astrid-Mistral-7B-GPTQ"
300
+ # To use a different branch, change revision
301
+ # For example: revision="gptq-4bit-32g-actorder_True"
302
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
303
+ device_map="auto",
304
+ trust_remote_code=False,
305
+ revision="main")
306
+
307
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
308
+
309
+ prompt = "Tell me about AI"
310
+ prompt_template=f'''<|im_start|>system
311
+ {system_message}<|im_end|>
312
+ <|im_start|>user
313
+ {prompt}<|im_end|>
314
+ <|im_start|>assistant
315
+ '''
316
+
317
+ print("\n\n*** Generate:")
318
+
319
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
320
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
321
+ print(tokenizer.decode(output[0]))
322
+
323
+ # Inference can also be done using transformers' pipeline
324
+
325
+ print("*** Pipeline:")
326
+ pipe = pipeline(
327
+ "text-generation",
328
+ model=model,
329
+ tokenizer=tokenizer,
330
+ max_new_tokens=512,
331
+ do_sample=True,
332
+ temperature=0.7,
333
+ top_p=0.95,
334
+ top_k=40,
335
+ repetition_penalty=1.1
336
+ )
337
+
338
+ print(pipe(prompt_template)[0]['generated_text'])
339
+ ```
340
+ <!-- README_GPTQ.md-use-from-python end -->
341
+
342
+ <!-- README_GPTQ.md-compatibility start -->
343
+ ## Compatibility
344
+
345
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
346
+
347
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
348
+
349
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
350
+ <!-- README_GPTQ.md-compatibility end -->
351
+
352
+ <!-- footer start -->
353
+ <!-- 200823 -->
354
+ ## Discord
355
+
356
+ For further support, and discussions on these models and AI in general, join us at:
357
+
358
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
359
+
360
+ ## Thanks, and how to contribute
361
+
362
+ Thanks to the [chirper.ai](https://chirper.ai) team!
363
+
364
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
365
+
366
+ 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.
367
+
368
+ 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.
369
+
370
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
371
+
372
+ * Patreon: https://patreon.com/TheBlokeAI
373
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
374
+
375
+ **Special thanks to**: Aemon Algiz.
376
+
377
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
378
+
379
+
380
+ Thank you to all my generous patrons and donaters!
381
+
382
+ And thank you again to a16z for their generous grant.
383
+
384
+ <!-- footer end -->
385
+
386
+ # Original model card: PAIX's Astrid Mistral 7B
387
+
388
+ # Model Card
389
+ ## Summary
390
+
391
+ - Base model: [mistralai/Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
392
+
393
+ This model, Astrid-7B-Assistant is a Mistral-7B base model for causal language modeling, designed to generate human-like text.
394
+ It's part of our mission to make AI technology accessible to everyone, focusing on personalization, data privacy, and transparent AI governance.
395
+ Trained in English, it's a versatile tool for a variety of applications.
396
+ This model is one of the many models available on our platform, and we currently have a 1B and 7B open-source model.
397
+
398
+ This model was trained by [PAIX.Cloud](https://www.paix.cloud/).
399
+ - Wait list: [Wait List](https://www.paix.cloud/join-waitlist)
400
+
401
+
402
+ ## Usage
403
+
404
+ To use the model with the `transformers` library on a machine with GPUs, first make sure you have the `transformers` library installed.
405
+
406
+ ```bash
407
+ pip install transformers==4.34.0
408
+ ```
409
+
410
+ Also make sure you are providing your huggingface token to the pipeline if the model is lying in a private repo.
411
+ - Either leave `token=True` in the `pipeline` and login to hugginface_hub by running
412
+ ```python
413
+ import huggingface_hub
414
+ huggingface_hub.login(<ACCES_TOKEN>)
415
+ ```
416
+ - Or directly pass your <ACCES_TOKEN> to `token` in the `pipeline`
417
+
418
+ ```python
419
+ from transformers import pipeline
420
+
421
+ generate_text = pipeline(
422
+ model="PAIXAI/Astrid-Mistral-7B",
423
+ torch_dtype="auto",
424
+ trust_remote_code=True,
425
+ use_fast=True,
426
+ device_map={"": "cuda:0"},
427
+ token=True,
428
+ )
429
+
430
+ res = generate_text(
431
+ "Why is drinking water so healthy?",
432
+ min_new_tokens=2,
433
+ max_new_tokens=256,
434
+ do_sample=False,
435
+ num_beams=1,
436
+ temperature=float(0.3),
437
+ repetition_penalty=float(1.2),
438
+ renormalize_logits=True
439
+ )
440
+ print(res[0]["generated_text"])
441
+ ```
442
+
443
+ You can print a sample prompt after the preprocessing step to see how it is feed to the tokenizer:
444
+
445
+ ```python
446
+ print(generate_text.preprocess("Why is drinking water so healthy?")["prompt_text"])
447
+ ```
448
+
449
+ ```bash
450
+ <|prompt|>Why is drinking water so healthy?<|im_end|><|answer|>
451
+ ```
452
+
453
+ Alternatively, you can download [h2oai_pipeline.py](h2oai_pipeline.py), store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer. If the model and the tokenizer are fully supported in the `transformers` package, this will allow you to set `trust_remote_code=False`.
454
+
455
+ ```python
456
+ from h2oai_pipeline import H2OTextGenerationPipeline
457
+ from transformers import AutoModelForCausalLM, AutoTokenizer
458
+
459
+ tokenizer = AutoTokenizer.from_pretrained(
460
+ "PAIXAI/Astrid-Mistral-7B",
461
+ use_fast=True,
462
+ padding_side="left",
463
+ trust_remote_code=True,
464
+ )
465
+ model = AutoModelForCausalLM.from_pretrained(
466
+ "PAIXAI/Astrid-Mistral-7B",
467
+ torch_dtype="auto",
468
+ device_map={"": "cuda:0"},
469
+ trust_remote_code=True,
470
+ )
471
+ generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
472
+
473
+ res = generate_text(
474
+ "Why is drinking water so healthy?",
475
+ min_new_tokens=2,
476
+ max_new_tokens=256,
477
+ do_sample=False,
478
+ num_beams=1,
479
+ temperature=float(0.3),
480
+ repetition_penalty=float(1.2),
481
+ renormalize_logits=True
482
+ )
483
+ print(res[0]["generated_text"])
484
+ ```
485
+
486
+
487
+ You may also construct the pipeline from the loaded model and tokenizer yourself and consider the preprocessing steps:
488
+
489
+ ```python
490
+ from transformers import AutoModelForCausalLM, AutoTokenizer
491
+
492
+ model_name = "PAIXAI/Astrid-Mistral-7B" # either local folder or huggingface model name
493
+ # Important: The prompt needs to be in the same format the model was trained with.
494
+ # You can find an example prompt in the experiment logs.
495
+ prompt = "<|prompt|>How are you?<|im_end|><|answer|>"
496
+
497
+ tokenizer = AutoTokenizer.from_pretrained(
498
+ model_name,
499
+ use_fast=True,
500
+ trust_remote_code=True,
501
+ )
502
+ model = AutoModelForCausalLM.from_pretrained(
503
+ model_name,
504
+ torch_dtype="auto",
505
+ device_map={"": "cuda:0"},
506
+ trust_remote_code=True,
507
+ )
508
+ model.cuda().eval()
509
+ inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
510
+
511
+ # generate configuration can be modified to your needs
512
+ tokens = model.generate(
513
+ input_ids=inputs["input_ids"],
514
+ attention_mask=inputs["attention_mask"],
515
+ min_new_tokens=2,
516
+ max_new_tokens=256,
517
+ do_sample=False,
518
+ num_beams=1,
519
+ temperature=float(0.3),
520
+ repetition_penalty=float(1.2),
521
+ renormalize_logits=True
522
+ )[0]
523
+
524
+ tokens = tokens[inputs["input_ids"].shape[1]:]
525
+ answer = tokenizer.decode(tokens, skip_special_tokens=True)
526
+ print(answer)
527
+ ```
528
+
529
+ ## Quantization and sharding
530
+
531
+ You can load the models using quantization by specifying ```load_in_8bit=True``` or ```load_in_4bit=True```. Also, sharding on multiple GPUs is possible by setting ```device_map=auto```.
532
+
533
+ ## Model Architecture
534
+
535
+ ```
536
+ MistralForCausalLM(
537
+ (model): MistralModel(
538
+ (embed_tokens): Embedding(32002, 4096, padding_idx=0)
539
+ (layers): ModuleList(
540
+ (0-31): 32 x MistralDecoderLayer(
541
+ (self_attn): MistralAttention(
542
+ (q_proj): Linear(in_features=4096, out_features=4096, bias=False)
543
+ (k_proj): Linear(in_features=4096, out_features=1024, bias=False)
544
+ (v_proj): Linear(in_features=4096, out_features=1024, bias=False)
545
+ (o_proj): Linear(in_features=4096, out_features=4096, bias=False)
546
+ (rotary_emb): MistralRotaryEmbedding()
547
+ )
548
+ (mlp): MistralMLP(
549
+ (gate_proj): Linear(in_features=4096, out_features=14336, bias=False)
550
+ (up_proj): Linear(in_features=4096, out_features=14336, bias=False)
551
+ (down_proj): Linear(in_features=14336, out_features=4096, bias=False)
552
+ (act_fn): SiLUActivation()
553
+ )
554
+ (input_layernorm): MistralRMSNorm()
555
+ (post_attention_layernorm): MistralRMSNorm()
556
+ )
557
+ )
558
+ (norm): MistralRMSNorm()
559
+ )
560
+ (lm_head): Linear(in_features=4096, out_features=32002, bias=False)
561
+ )
562
+ ```
563
+
564
+ ## Model Configuration
565
+
566
+ This model was trained using H2O LLM Studio and with the configuration in [cfg.yaml](cfg.yaml). Visit [H2O LLM Studio](https://github.com/h2oai/h2o-llmstudio) to learn how to train your own large language models.
567
+
568
+
569
+ ## Disclaimer
570
+
571
+ Please read this disclaimer carefully before using the large language model provided in this repository. Your use of the model signifies your agreement to the following terms and conditions.
572
+
573
+ - Biases and Offensiveness: The large language model is trained on a diverse range of internet text data, which may contain biased, racist, offensive, or otherwise inappropriate content. By using this model, you acknowledge and accept that the generated content may sometimes exhibit biases or produce content that is offensive or inappropriate. The developers of this repository do not endorse, support, or promote any such content or viewpoints.
574
+ - Limitations: The large language model is an AI-based tool and not a human. It may produce incorrect, nonsensical, or irrelevant responses. It is the user's responsibility to critically evaluate the generated content and use it at their discretion.
575
+ - Use at Your Own Risk: Users of this large language model must assume full responsibility for any consequences that may arise from their use of the tool. The developers and contributors of this repository shall not be held liable for any damages, losses, or harm resulting from the use or misuse of the provided model.
576
+ - Ethical Considerations: Users are encouraged to use the large language model responsibly and ethically. By using this model, you agree not to use it for purposes that promote hate speech, discrimination, harassment, or any form of illegal or harmful activities.
577
+ - Reporting Issues: If you encounter any biased, offensive, or otherwise inappropriate content generated by the large language model, please report it to the repository maintainers through the provided channels. Your feedback will help improve the model and mitigate potential issues.
578
+ - Changes to this Disclaimer: The developers of this repository reserve the right to modify or update this disclaimer at any time without prior notice. It is the user's responsibility to periodically review the disclaimer to stay informed about any changes.
579
+
580
+ By using the large language model provided in this repository, you agree to accept and comply with the terms and conditions outlined in this disclaimer. If you do not agree with any part of this disclaimer, you should refrain from using the model and any content generated by it.