TheBloke commited on
Commit
17c3f49
1 Parent(s): 4918fb1

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +421 -0
README.md ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: deepseek-ai/deepseek-llm-7b-chat
3
+ inference: false
4
+ license: other
5
+ license_link: LICENSE
6
+ license_name: deepseek
7
+ model_creator: DeepSeek
8
+ model_name: Deepseek LLM 7B Chat
9
+ model_type: deepseek
10
+ prompt_template: 'User: {prompt}
11
+
12
+
13
+ Assistant:
14
+
15
+ '
16
+ quantized_by: TheBloke
17
+ ---
18
+ <!-- markdownlint-disable MD041 -->
19
+
20
+ <!-- header start -->
21
+ <!-- 200823 -->
22
+ <div style="width: auto; margin-left: auto; margin-right: auto">
23
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
24
+ </div>
25
+ <div style="display: flex; justify-content: space-between; width: 100%;">
26
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
27
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
28
+ </div>
29
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
30
+ <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>
31
+ </div>
32
+ </div>
33
+ <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>
34
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
35
+ <!-- header end -->
36
+
37
+ # Deepseek LLM 7B Chat - AWQ
38
+ - Model creator: [DeepSeek](https://huggingface.co/deepseek-ai)
39
+ - Original model: [Deepseek LLM 7B Chat](https://huggingface.co/deepseek-ai/deepseek-llm-7b-chat)
40
+
41
+ <!-- description start -->
42
+ ## Description
43
+
44
+ This repo contains AWQ model files for [DeepSeek's Deepseek LLM 7B Chat](https://huggingface.co/deepseek-ai/deepseek-llm-7b-chat).
45
+
46
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
47
+
48
+
49
+ ### About AWQ
50
+
51
+ 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.
52
+
53
+ It is supported by:
54
+
55
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
56
+ - [vLLM](https://github.com/vllm-project/vllm) - Llama and Mistral models only
57
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
58
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
59
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
60
+
61
+ <!-- description end -->
62
+ <!-- repositories-available start -->
63
+ ## Repositories available
64
+
65
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/deepseek-llm-7B-chat-AWQ)
66
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/deepseek-llm-7B-chat-GPTQ)
67
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/deepseek-llm-7B-chat-GGUF)
68
+ * [DeepSeek's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/deepseek-ai/deepseek-llm-7b-chat)
69
+ <!-- repositories-available end -->
70
+
71
+ <!-- prompt-template start -->
72
+ ## Prompt template: DeepSeek-LLM
73
+
74
+ ```
75
+ User: {prompt}
76
+
77
+ Assistant:
78
+
79
+ ```
80
+
81
+ <!-- prompt-template end -->
82
+
83
+
84
+ <!-- README_AWQ.md-provided-files start -->
85
+ ## Provided files, and AWQ parameters
86
+
87
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
88
+
89
+ Models are released as sharded safetensors files.
90
+
91
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
92
+ | ------ | ---- | -- | ----------- | ------- | ---- |
93
+ | [main](https://huggingface.co/TheBloke/deepseek-llm-7B-chat-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.83 GB
94
+
95
+ <!-- README_AWQ.md-provided-files end -->
96
+
97
+ <!-- README_AWQ.md-text-generation-webui start -->
98
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
99
+
100
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
101
+
102
+ 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.
103
+
104
+ 1. Click the **Model tab**.
105
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/deepseek-llm-7B-chat-AWQ`.
106
+ 3. Click **Download**.
107
+ 4. The model will start downloading. Once it's finished it will say "Done".
108
+ 5. In the top left, click the refresh icon next to **Model**.
109
+ 6. In the **Model** dropdown, choose the model you just downloaded: `deepseek-llm-7B-chat-AWQ`
110
+ 7. Select **Loader: AutoAWQ**.
111
+ 8. Click Load, and the model will load and is now ready for use.
112
+ 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.
113
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
114
+ <!-- README_AWQ.md-text-generation-webui end -->
115
+
116
+ <!-- README_AWQ.md-use-from-vllm start -->
117
+ ## Multi-user inference server: vLLM
118
+
119
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
120
+
121
+ - Please ensure you are using vLLM version 0.2 or later.
122
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
123
+
124
+ For example:
125
+
126
+ ```shell
127
+ python3 -m vllm.entrypoints.api_server --model TheBloke/deepseek-llm-7B-chat-AWQ --quantization awq --dtype auto
128
+ ```
129
+
130
+ - When using vLLM from Python code, again set `quantization=awq`.
131
+
132
+ For example:
133
+
134
+ ```python
135
+ from vllm import LLM, SamplingParams
136
+
137
+ prompts = [
138
+ "Tell me about AI",
139
+ "Write a story about llamas",
140
+ "What is 291 - 150?",
141
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
142
+ ]
143
+ prompt_template=f'''User: {prompt}
144
+
145
+ Assistant:
146
+ '''
147
+
148
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
149
+
150
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
151
+
152
+ llm = LLM(model="TheBloke/deepseek-llm-7B-chat-AWQ", quantization="awq", dtype="auto")
153
+
154
+ outputs = llm.generate(prompts, sampling_params)
155
+
156
+ # Print the outputs.
157
+ for output in outputs:
158
+ prompt = output.prompt
159
+ generated_text = output.outputs[0].text
160
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
161
+ ```
162
+ <!-- README_AWQ.md-use-from-vllm start -->
163
+
164
+ <!-- README_AWQ.md-use-from-tgi start -->
165
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
166
+
167
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
168
+
169
+ Example Docker parameters:
170
+
171
+ ```shell
172
+ --model-id TheBloke/deepseek-llm-7B-chat-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
173
+ ```
174
+
175
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
176
+
177
+ ```shell
178
+ pip3 install huggingface-hub
179
+ ```
180
+
181
+ ```python
182
+ from huggingface_hub import InferenceClient
183
+
184
+ endpoint_url = "https://your-endpoint-url-here"
185
+
186
+ prompt = "Tell me about AI"
187
+ prompt_template=f'''User: {prompt}
188
+
189
+ Assistant:
190
+ '''
191
+
192
+ client = InferenceClient(endpoint_url)
193
+ response = client.text_generation(prompt,
194
+ max_new_tokens=128,
195
+ do_sample=True,
196
+ temperature=0.7,
197
+ top_p=0.95,
198
+ top_k=40,
199
+ repetition_penalty=1.1)
200
+
201
+ print(f"Model output: ", response)
202
+ ```
203
+ <!-- README_AWQ.md-use-from-tgi end -->
204
+
205
+ <!-- README_AWQ.md-use-from-python start -->
206
+ ## Inference from Python code using Transformers
207
+
208
+ ### Install the necessary packages
209
+
210
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
211
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
212
+
213
+ ```shell
214
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
215
+ ```
216
+
217
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
218
+
219
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
220
+
221
+ ```shell
222
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
223
+ ```
224
+
225
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
226
+
227
+ ```shell
228
+ pip3 uninstall -y autoawq
229
+ git clone https://github.com/casper-hansen/AutoAWQ
230
+ cd AutoAWQ
231
+ pip3 install .
232
+ ```
233
+
234
+ ### Transformers example code (requires Transformers 4.35.0 and later)
235
+
236
+ ```python
237
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
238
+
239
+ model_name_or_path = "TheBloke/deepseek-llm-7B-chat-AWQ"
240
+
241
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
242
+ model = AutoModelForCausalLM.from_pretrained(
243
+ model_name_or_path,
244
+ low_cpu_mem_usage=True,
245
+ device_map="cuda:0"
246
+ )
247
+
248
+ # Using the text streamer to stream output one token at a time
249
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
250
+
251
+ prompt = "Tell me about AI"
252
+ prompt_template=f'''User: {prompt}
253
+
254
+ Assistant:
255
+ '''
256
+
257
+ # Convert prompt to tokens
258
+ tokens = tokenizer(
259
+ prompt_template,
260
+ return_tensors='pt'
261
+ ).input_ids.cuda()
262
+
263
+ generation_params = {
264
+ "do_sample": True,
265
+ "temperature": 0.7,
266
+ "top_p": 0.95,
267
+ "top_k": 40,
268
+ "max_new_tokens": 512,
269
+ "repetition_penalty": 1.1
270
+ }
271
+
272
+ # Generate streamed output, visible one token at a time
273
+ generation_output = model.generate(
274
+ tokens,
275
+ streamer=streamer,
276
+ **generation_params
277
+ )
278
+
279
+ # Generation without a streamer, which will include the prompt in the output
280
+ generation_output = model.generate(
281
+ tokens,
282
+ **generation_params
283
+ )
284
+
285
+ # Get the tokens from the output, decode them, print them
286
+ token_output = generation_output[0]
287
+ text_output = tokenizer.decode(token_output)
288
+ print("model.generate output: ", text_output)
289
+
290
+ # Inference is also possible via Transformers' pipeline
291
+ from transformers import pipeline
292
+
293
+ pipe = pipeline(
294
+ "text-generation",
295
+ model=model,
296
+ tokenizer=tokenizer,
297
+ **generation_params
298
+ )
299
+
300
+ pipe_output = pipe(prompt_template)[0]['generated_text']
301
+ print("pipeline output: ", pipe_output)
302
+
303
+ ```
304
+ <!-- README_AWQ.md-use-from-python end -->
305
+
306
+ <!-- README_AWQ.md-compatibility start -->
307
+ ## Compatibility
308
+
309
+ The files provided are tested to work with:
310
+
311
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
312
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
313
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
314
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
315
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
316
+
317
+ <!-- README_AWQ.md-compatibility end -->
318
+
319
+ <!-- footer start -->
320
+ <!-- 200823 -->
321
+ ## Discord
322
+
323
+ For further support, and discussions on these models and AI in general, join us at:
324
+
325
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
326
+
327
+ ## Thanks, and how to contribute
328
+
329
+ Thanks to the [chirper.ai](https://chirper.ai) team!
330
+
331
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
332
+
333
+ 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.
334
+
335
+ 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.
336
+
337
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
338
+
339
+ * Patreon: https://patreon.com/TheBlokeAI
340
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
341
+
342
+ **Special thanks to**: Aemon Algiz.
343
+
344
+ **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
345
+
346
+
347
+ Thank you to all my generous patrons and donaters!
348
+
349
+ And thank you again to a16z for their generous grant.
350
+
351
+ <!-- footer end -->
352
+
353
+ # Original model card: DeepSeek's Deepseek LLM 7B Chat
354
+
355
+
356
+ <p align="center">
357
+ <img width="500px" alt="DeepSeek Chat" src="https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/images/logo.png?raw=true">
358
+ </p>
359
+ <p align="center"><a href="https://www.deepseek.com/">[🏠Homepage]</a> | <a href="https://chat.deepseek.com/">[🤖 Chat with DeepSeek LLM]</a> | <a href="https://discord.gg/Tc7c45Zzu5">[Discord]</a> | <a href="https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/images/qr.jpeg">[Wechat(微信)]</a> </p>
360
+ <hr>
361
+
362
+
363
+
364
+
365
+ ### 1. Introduction of Deepseek LLM
366
+
367
+ Introducing DeepSeek LLM, an advanced language model comprising 7 billion parameters. It has been trained from scratch on a vast dataset of 2 trillion tokens in both English and Chinese. In order to foster research, we have made DeepSeek LLM 7B/67B Base and DeepSeek LLM 7B/67B Chat open source for the research community.
368
+
369
+
370
+ ### 2. Model Summary
371
+ `deepseek-llm-7b-chat` is a 7B parameter model initialized from `deepseek-llm-7b-base` and fine-tuned on extra instruction data.
372
+
373
+ - **Home Page:** [DeepSeek](https://deepseek.com/)
374
+ - **Repository:** [deepseek-ai/deepseek-LLM](https://github.com/deepseek-ai/deepseek-LLM)
375
+ - **Chat With DeepSeek LLM:** [DeepSeek-LLM](https://chat.deepseek.com/)
376
+
377
+
378
+ ### 3. How to Use
379
+ Here give some examples of how to use our model.
380
+ #### Chat Completion
381
+ ```python
382
+ import torch
383
+ from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
384
+
385
+ model_name = "deepseek-ai/deepseek-llm-7b-chat"
386
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
387
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
388
+ model.generation_config = GenerationConfig.from_pretrained(model_name)
389
+ model.generation_config.pad_token_id = model.generation_config.eos_token_id
390
+
391
+ messages = [
392
+ {"role": "user", "content": "Who are you?"}
393
+ ]
394
+ input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
395
+ outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)
396
+
397
+ result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
398
+ print(result)
399
+ ```
400
+
401
+ Avoiding the use of the provided function `apply_chat_template`, you can also interact with our model following the sample template. Note that `messages` should be replaced by your input.
402
+
403
+ ```
404
+ User: {messages[0]['content']}
405
+
406
+ Assistant: {messages[1]['content']}<|end▁of▁sentence|>User: {messages[2]['content']}
407
+
408
+ Assistant:
409
+ ```
410
+
411
+ **Note:** By default (`add_special_tokens=True`), our tokenizer automatically adds a `bos_token` (`<|begin▁of▁sentence|>`) before the input text. Additionally, since the system prompt is not compatible with this version of our models, we DO NOT RECOMMEND including the system prompt in your input.
412
+
413
+ ### 4. License
414
+ This code repository is licensed under the MIT License. The use of DeepSeek LLM models is subject to the Model License. DeepSeek LLM supports commercial use.
415
+
416
+ See the [LICENSE-MODEL](https://github.com/deepseek-ai/deepseek-LLM/blob/main/LICENSE-MODEL) for more details.
417
+
418
+ ### 5. Contact
419
+
420
+ If you have any questions, please raise an issue or contact us at [service@deepseek.com](mailto:service@deepseek.com).
421
+