TheBloke commited on
Commit
a3be746
1 Parent(s): fd1f889

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +330 -0
README.md ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: emrgnt-cmplxty/Mistral-7B-SciPhi-32k
3
+ inference: false
4
+ license: llama2
5
+ model_creator: Owen Colegrove
6
+ model_name: Mistral 7B SciPhi 32K
7
+ model_type: mistral
8
+ prompt_template: '{prompt}
9
+
10
+ '
11
+ quantized_by: TheBloke
12
+ ---
13
+ <!-- markdownlint-disable MD041 -->
14
+
15
+ <!-- header start -->
16
+ <!-- 200823 -->
17
+ <div style="width: auto; margin-left: auto; margin-right: auto">
18
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
19
+ </div>
20
+ <div style="display: flex; justify-content: space-between; width: 100%;">
21
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
22
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
23
+ </div>
24
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
25
+ <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>
26
+ </div>
27
+ </div>
28
+ <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>
29
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
30
+ <!-- header end -->
31
+
32
+ # Mistral 7B SciPhi 32K - AWQ
33
+ - Model creator: [Owen Colegrove](https://huggingface.co/emrgnt-cmplxty)
34
+ - Original model: [Mistral 7B SciPhi 32K](https://huggingface.co/emrgnt-cmplxty/Mistral-7B-SciPhi-32k)
35
+
36
+ <!-- description start -->
37
+ ## Description
38
+
39
+ This repo contains AWQ model files for [Owen Colegrove's Mistral 7B SciPhi 32K](https://huggingface.co/emrgnt-cmplxty/Mistral-7B-SciPhi-32k).
40
+
41
+
42
+ ### About AWQ
43
+
44
+ AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
45
+
46
+ It is supported by:
47
+
48
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
49
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
50
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
51
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
52
+
53
+ <!-- description end -->
54
+ <!-- repositories-available start -->
55
+ ## Repositories available
56
+
57
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mistral-7B-SciPhi-32k-AWQ)
58
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mistral-7B-SciPhi-32k-GPTQ)
59
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mistral-7B-SciPhi-32k-GGUF)
60
+ * [Owen Colegrove's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/emrgnt-cmplxty/Mistral-7B-SciPhi-32k)
61
+ <!-- repositories-available end -->
62
+
63
+ <!-- prompt-template start -->
64
+ ## Prompt template: Unknown
65
+
66
+ ```
67
+ {prompt}
68
+
69
+ ```
70
+
71
+ <!-- prompt-template end -->
72
+
73
+
74
+ <!-- README_AWQ.md-provided-files start -->
75
+ ## Provided files, and AWQ parameters
76
+
77
+ For my first release of AWQ models, I am releasing 128g models only. I will consider adding 32g as well if there is interest, and once I have done perplexity and evaluation comparisons, but at this time 32g models are still not fully tested with AutoAWQ and vLLM.
78
+
79
+ Models are released as sharded safetensors files.
80
+
81
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
82
+ | ------ | ---- | -- | ----------- | ------- | ---- |
83
+ | [main](https://huggingface.co/TheBloke/Mistral-7B-SciPhi-32k-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.15 GB
84
+
85
+ <!-- README_AWQ.md-provided-files end -->
86
+
87
+ <!-- README_AWQ.md-text-generation-webui start -->
88
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
89
+
90
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
91
+
92
+ 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.
93
+
94
+ 1. Click the **Model tab**.
95
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mistral-7B-SciPhi-32k-AWQ`.
96
+ 3. Click **Download**.
97
+ 4. The model will start downloading. Once it's finished it will say "Done".
98
+ 5. In the top left, click the refresh icon next to **Model**.
99
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mistral-7B-SciPhi-32k-AWQ`
100
+ 7. Select **Loader: AutoAWQ**.
101
+ 8. Click Load, and the model will load and is now ready for use.
102
+ 9. 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.
103
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
104
+ <!-- README_AWQ.md-text-generation-webui end -->
105
+
106
+ <!-- README_AWQ.md-use-from-vllm start -->
107
+ ## Multi-user inference server: vLLM
108
+
109
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
110
+
111
+ - Please ensure you are using vLLM version 0.2 or later.
112
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
113
+
114
+ For example:
115
+
116
+ ```shell
117
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Mistral-7B-SciPhi-32k-AWQ --quantization awq
118
+ ```
119
+
120
+ - When using vLLM from Python code, again set `quantization=awq`.
121
+
122
+ For example:
123
+
124
+ ```python
125
+ from vllm import LLM, SamplingParams
126
+
127
+ prompts = [
128
+ "Tell me about AI",
129
+ "Write a story about llamas",
130
+ "What is 291 - 150?",
131
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
132
+ ]
133
+ prompt_template=f'''{prompt}
134
+ '''
135
+
136
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
137
+
138
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
139
+
140
+ llm = LLM(model="TheBloke/Mistral-7B-SciPhi-32k-AWQ", quantization="awq", dtype="auto")
141
+
142
+ outputs = llm.generate(prompts, sampling_params)
143
+
144
+ # Print the outputs.
145
+ for output in outputs:
146
+ prompt = output.prompt
147
+ generated_text = output.outputs[0].text
148
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
149
+ ```
150
+ <!-- README_AWQ.md-use-from-vllm start -->
151
+
152
+ <!-- README_AWQ.md-use-from-tgi start -->
153
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
154
+
155
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
156
+
157
+ Example Docker parameters:
158
+
159
+ ```shell
160
+ --model-id TheBloke/Mistral-7B-SciPhi-32k-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
161
+ ```
162
+
163
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
164
+
165
+ ```shell
166
+ pip3 install huggingface-hub
167
+ ```
168
+
169
+ ```python
170
+ from huggingface_hub import InferenceClient
171
+
172
+ endpoint_url = "https://your-endpoint-url-here"
173
+
174
+ prompt = "Tell me about AI"
175
+ prompt_template=f'''{prompt}
176
+ '''
177
+
178
+ client = InferenceClient(endpoint_url)
179
+ response = client.text_generation(prompt,
180
+ max_new_tokens=128,
181
+ do_sample=True,
182
+ temperature=0.7,
183
+ top_p=0.95,
184
+ top_k=40,
185
+ repetition_penalty=1.1)
186
+
187
+ print(f"Model output: ", response)
188
+ ```
189
+ <!-- README_AWQ.md-use-from-tgi end -->
190
+
191
+ <!-- README_AWQ.md-use-from-python start -->
192
+ ## Inference from Python code using AutoAWQ
193
+
194
+ ### Install the AutoAWQ package
195
+
196
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later.
197
+
198
+ ```shell
199
+ pip3 install autoawq
200
+ ```
201
+
202
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
203
+
204
+ ```shell
205
+ pip3 uninstall -y autoawq
206
+ git clone https://github.com/casper-hansen/AutoAWQ
207
+ cd AutoAWQ
208
+ pip3 install .
209
+ ```
210
+
211
+ ### AutoAWQ example code
212
+
213
+ ```python
214
+ from awq import AutoAWQForCausalLM
215
+ from transformers import AutoTokenizer
216
+
217
+ model_name_or_path = "TheBloke/Mistral-7B-SciPhi-32k-AWQ"
218
+
219
+ # Load tokenizer
220
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
221
+ # Load model
222
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
223
+ trust_remote_code=False, safetensors=True)
224
+
225
+ prompt = "Tell me about AI"
226
+ prompt_template=f'''{prompt}
227
+ '''
228
+
229
+ print("*** Running model.generate:")
230
+
231
+ token_input = tokenizer(
232
+ prompt_template,
233
+ return_tensors='pt'
234
+ ).input_ids.cuda()
235
+
236
+ # Generate output
237
+ generation_output = model.generate(
238
+ token_input,
239
+ do_sample=True,
240
+ temperature=0.7,
241
+ top_p=0.95,
242
+ top_k=40,
243
+ max_new_tokens=512
244
+ )
245
+
246
+ # Get the tokens from the output, decode them, print them
247
+ token_output = generation_output[0]
248
+ text_output = tokenizer.decode(token_output)
249
+ print("LLM output: ", text_output)
250
+
251
+ """
252
+ # Inference should be possible with transformers pipeline as well in future
253
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
254
+ from transformers import pipeline
255
+
256
+ print("*** Pipeline:")
257
+ pipe = pipeline(
258
+ "text-generation",
259
+ model=model,
260
+ tokenizer=tokenizer,
261
+ max_new_tokens=512,
262
+ do_sample=True,
263
+ temperature=0.7,
264
+ top_p=0.95,
265
+ top_k=40,
266
+ repetition_penalty=1.1
267
+ )
268
+
269
+ print(pipe(prompt_template)[0]['generated_text'])
270
+ """
271
+ ```
272
+ <!-- README_AWQ.md-use-from-python end -->
273
+
274
+ <!-- README_AWQ.md-compatibility start -->
275
+ ## Compatibility
276
+
277
+ The files provided are tested to work with:
278
+
279
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
280
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
281
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
282
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
283
+
284
+ <!-- README_AWQ.md-compatibility end -->
285
+
286
+ <!-- footer start -->
287
+ <!-- 200823 -->
288
+ ## Discord
289
+
290
+ For further support, and discussions on these models and AI in general, join us at:
291
+
292
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
293
+
294
+ ## Thanks, and how to contribute
295
+
296
+ Thanks to the [chirper.ai](https://chirper.ai) team!
297
+
298
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
299
+
300
+ 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.
301
+
302
+ 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.
303
+
304
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
305
+
306
+ * Patreon: https://patreon.com/TheBlokeAI
307
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
308
+
309
+ **Special thanks to**: Aemon Algiz.
310
+
311
+ **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
312
+
313
+
314
+ Thank you to all my generous patrons and donaters!
315
+
316
+ And thank you again to a16z for their generous grant.
317
+
318
+ <!-- footer end -->
319
+
320
+ # Original model card: Owen Colegrove's Mistral 7B SciPhi 32K
321
+
322
+
323
+ Training is currently still underway, but this is the first epoch of a 32k context fine-tuning run of Mistral-7b over the following datasets:
324
+
325
+ - emrgnt-cmplxty/sciphi-textbooks-are-all-you-need
326
+ - open-phi/rag-textbook-instruct-full
327
+ - open-phi/programming_books_llama
328
+ - open-phi/textbooks
329
+ - Open-Orca/SlimOrca
330
+ - WizardLM/WizardLM_evol_instruct_70k