TheBloke commited on
Commit
8484718
1 Parent(s): f082706

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +337 -0
README.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/OpenLemur/lemur-70b-chat-v1
3
+ inference: false
4
+ language:
5
+ - en
6
+ library_name: transformers
7
+ license: cc-by-nc-4.0
8
+ model_creator: OpenLemur
9
+ model_name: Lemur 70B Chat v1
10
+ model_type: llama
11
+ pipeline_tag: text-generation
12
+ prompt_template: '<|im_start|>system
13
+
14
+ {system_message}<|im_end|>
15
+
16
+ <|im_start|>user
17
+
18
+ {prompt}<|im_end|>
19
+
20
+ <|im_start|>assistant
21
+
22
+ '
23
+ quantized_by: TheBloke
24
+ tags:
25
+ - text-generation
26
+ - code
27
+ - text-generation-inference
28
+ widget:
29
+ - example_title: Lemur favorite fruit
30
+ group: Python
31
+ text: What's lemur's favorite fruit?
32
+ - example_title: Merge Sort
33
+ group: Python
34
+ text: Write a Python function to merge two sorted lists into one sorted list without
35
+ using any built-in sort functions.
36
+ ---
37
+
38
+ <!-- header start -->
39
+ <!-- 200823 -->
40
+ <div style="width: auto; margin-left: auto; margin-right: auto">
41
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
42
+ </div>
43
+ <div style="display: flex; justify-content: space-between; width: 100%;">
44
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
45
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
46
+ </div>
47
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
48
+ <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>
49
+ </div>
50
+ </div>
51
+ <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>
52
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
53
+ <!-- header end -->
54
+
55
+ # Lemur 70B Chat v1 - AWQ
56
+ - Model creator: [OpenLemur](https://huggingface.co/OpenLemur)
57
+ - Original model: [Lemur 70B Chat v1](https://huggingface.co/OpenLemur/lemur-70b-chat-v1)
58
+
59
+ <!-- description start -->
60
+ ## Description
61
+
62
+ This repo contains AWQ model files for [OpenLemur's Lemur 70B Chat v1](https://huggingface.co/OpenLemur/lemur-70b-chat-v1).
63
+
64
+
65
+ ### About AWQ
66
+
67
+ 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.
68
+
69
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of AWQ models for high-throughput concurrent inference in multi-user server scenarios. Note that, at the time of writing, overall throughput is still lower than running vLLM with unquantised models, however using AWQ enables using much smaller GPUs which can lead to easier deployment and overall cost savings. For example, a 70B model can be run on 1 x 48GB GPU instead of 2 x 80GB.
70
+ <!-- description end -->
71
+ <!-- repositories-available start -->
72
+ ## Repositories available
73
+
74
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Lemur-70B-Chat-v1-AWQ)
75
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Lemur-70B-Chat-v1-GPTQ)
76
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Lemur-70B-Chat-v1-GGUF)
77
+ * [OpenLemur's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/OpenLemur/lemur-70b-chat-v1)
78
+ <!-- repositories-available end -->
79
+
80
+ <!-- prompt-template start -->
81
+ ## Prompt template: ChatML
82
+
83
+ ```
84
+ <|im_start|>system
85
+ {system_message}<|im_end|>
86
+ <|im_start|>user
87
+ {prompt}<|im_end|>
88
+ <|im_start|>assistant
89
+
90
+ ```
91
+
92
+ <!-- prompt-template end -->
93
+ <!-- licensing start -->
94
+ ## Licensing
95
+
96
+ The creator of the source model has listed its license as `cc-by-nc-4.0`, and this quantization has therefore used that same license.
97
+
98
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
99
+
100
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [OpenLemur's Lemur 70B Chat v1](https://huggingface.co/OpenLemur/lemur-70b-chat-v1).
101
+ <!-- licensing end -->
102
+ <!-- README_AWQ.md-provided-files start -->
103
+ ## Provided files and AWQ parameters
104
+
105
+ 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.
106
+
107
+ Models are released as sharded safetensors files.
108
+
109
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
110
+ | ------ | ---- | -- | ----------- | ------- | ---- |
111
+ | [main](https://huggingface.co/TheBloke/Lemur-70B-Chat-v1-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 36.61 GB
112
+
113
+ <!-- README_AWQ.md-provided-files end -->
114
+
115
+ <!-- README_AWQ.md-use-from-vllm start -->
116
+ ## Serving this model from vLLM
117
+
118
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
119
+
120
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
121
+
122
+ ```shell
123
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Lemur-70B-Chat-v1-AWQ --quantization awq
124
+ ```
125
+
126
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
127
+
128
+ ```python
129
+ from vllm import LLM, SamplingParams
130
+
131
+ prompts = [
132
+ "Hello, my name is",
133
+ "The president of the United States is",
134
+ "The capital of France is",
135
+ "The future of AI is",
136
+ ]
137
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
138
+
139
+ llm = LLM(model="TheBloke/Lemur-70B-Chat-v1-AWQ", quantization="awq")
140
+
141
+ outputs = llm.generate(prompts, sampling_params)
142
+
143
+ # Print the outputs.
144
+ for output in outputs:
145
+ prompt = output.prompt
146
+ generated_text = output.outputs[0].text
147
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
148
+ ```
149
+ <!-- README_AWQ.md-use-from-vllm start -->
150
+
151
+ <!-- README_AWQ.md-use-from-python start -->
152
+ ## How to use this AWQ model from Python code
153
+
154
+ ### Install the necessary packages
155
+
156
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
157
+
158
+ ```shell
159
+ pip3 install autoawq
160
+ ```
161
+
162
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
163
+
164
+ ```shell
165
+ pip3 uninstall -y autoawq
166
+ git clone https://github.com/casper-hansen/AutoAWQ
167
+ cd AutoAWQ
168
+ pip3 install .
169
+ ```
170
+
171
+ ### You can then try the following example code
172
+
173
+ ```python
174
+ from awq import AutoAWQForCausalLM
175
+ from transformers import AutoTokenizer
176
+
177
+ model_name_or_path = "TheBloke/Lemur-70B-Chat-v1-AWQ"
178
+
179
+ # Load model
180
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
181
+ trust_remote_code=False, safetensors=True)
182
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
183
+
184
+ prompt = "Tell me about AI"
185
+ prompt_template=f'''<|im_start|>system
186
+ {system_message}<|im_end|>
187
+ <|im_start|>user
188
+ {prompt}<|im_end|>
189
+ <|im_start|>assistant
190
+
191
+ '''
192
+
193
+ print("\n\n*** Generate:")
194
+
195
+ tokens = tokenizer(
196
+ prompt_template,
197
+ return_tensors='pt'
198
+ ).input_ids.cuda()
199
+
200
+ # Generate output
201
+ generation_output = model.generate(
202
+ tokens,
203
+ do_sample=True,
204
+ temperature=0.7,
205
+ top_p=0.95,
206
+ top_k=40,
207
+ max_new_tokens=512
208
+ )
209
+
210
+ print("Output: ", tokenizer.decode(generation_output[0]))
211
+
212
+ # Inference can also be done using transformers' pipeline
213
+ from transformers import pipeline
214
+
215
+ print("*** Pipeline:")
216
+ pipe = pipeline(
217
+ "text-generation",
218
+ model=model,
219
+ tokenizer=tokenizer,
220
+ max_new_tokens=512,
221
+ do_sample=True,
222
+ temperature=0.7,
223
+ top_p=0.95,
224
+ top_k=40,
225
+ repetition_penalty=1.1
226
+ )
227
+
228
+ print(pipe(prompt_template)[0]['generated_text'])
229
+ ```
230
+ <!-- README_AWQ.md-use-from-python end -->
231
+
232
+ <!-- README_AWQ.md-compatibility start -->
233
+ ## Compatibility
234
+
235
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
236
+
237
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is not yet compatible with AWQ, but a PR is open which should bring support soon: [TGI PR #781](https://github.com/huggingface/text-generation-inference/issues/781).
238
+ <!-- README_AWQ.md-compatibility end -->
239
+
240
+ <!-- footer start -->
241
+ <!-- 200823 -->
242
+ ## Discord
243
+
244
+ For further support, and discussions on these models and AI in general, join us at:
245
+
246
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
247
+
248
+ ## Thanks, and how to contribute
249
+
250
+ Thanks to the [chirper.ai](https://chirper.ai) team!
251
+
252
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
253
+
254
+ 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.
255
+
256
+ 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.
257
+
258
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
259
+
260
+ * Patreon: https://patreon.com/TheBlokeAI
261
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
262
+
263
+ **Special thanks to**: Aemon Algiz.
264
+
265
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
266
+
267
+
268
+ Thank you to all my generous patrons and donaters!
269
+
270
+ And thank you again to a16z for their generous grant.
271
+
272
+ <!-- footer end -->
273
+
274
+ # Original model card: OpenLemur's Lemur 70B Chat v1
275
+
276
+
277
+ # lemur-70b-chat-v1
278
+
279
+ <p align="center">
280
+ <img src="https://huggingface.co/datasets/OpenLemur/assets/resolve/main/lemur_icon.png" width="300" height="300" alt="Lemur">
281
+ </p>
282
+
283
+ <div align="center">
284
+ <img src="https://huggingface.co/datasets/OpenLemur/assets/resolve/main/lemur_chat_radar.png">
285
+ </div>
286
+
287
+
288
+ ## Use
289
+
290
+ ### Setup
291
+
292
+ First, we have to install all the libraries listed in `requirements.txt` in [GitHub](https://github.com/OpenLemur/lemur-v1):
293
+
294
+ ```bash
295
+ pip install -r requirements.txt
296
+ ```
297
+
298
+ ### Generation
299
+
300
+ ```python
301
+ from transformers import AutoTokenizer, AutoModelForCausalLM
302
+
303
+ tokenizer = AutoTokenizer.from_pretrained("OpenLemur/lemur-70b-chat-v1")
304
+ model = AutoModelForCausalLM.from_pretrained("OpenLemur/lemur-70b-chat-v1", device_map="auto", load_in_8bit=True)
305
+
306
+ # Text Generation Example
307
+ prompt = """<|im_start|>system
308
+ You are a helpful, respectful, and honest assistant.
309
+ <|im_end|>
310
+ <|im_start|>user
311
+ What's a lemur's favorite fruit?<|im_end|>
312
+ <|im_start|>assistant
313
+ """
314
+ input = tokenizer(prompt, return_tensors="pt")
315
+ output = model.generate(**input, max_length=50, num_return_sequences=1)
316
+ generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
317
+ print(generated_text)
318
+
319
+ # Code Generation Example
320
+ prompt = """<|im_start|>system
321
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
322
+ <|im_end|>
323
+ <|im_start|>user
324
+ Write a Python function to merge two sorted lists into one sorted list without using any built-in sort functions.<|im_end|>
325
+ <|im_start|>assistant
326
+ """
327
+ input = tokenizer(prompt, return_tensors="pt")
328
+ output = model.generate(**input, max_length=200, num_return_sequences=1)
329
+ generated_code = tokenizer.decode(output[0], skip_special_tokens=True)
330
+ print(generated_code)
331
+ ```
332
+
333
+ # License
334
+ The model is licensed under a CC BY-NC-4.0 license focused on research use cases.
335
+
336
+ # Acknowledgements
337
+ The Lemur project is an open collaborative research effort between [XLang Lab](https://www.xlang.ai/) and Salesforce Research. We thank Salesforce, Google Research and Amazon AWS for their gift support.