TheBloke commited on
Commit
d778944
1 Parent(s): ee7d9cd

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +373 -0
README.md ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/upstage/llama-65b-instruct
3
+ inference: false
4
+ language:
5
+ - en
6
+ license: other
7
+ model_creator: upstage
8
+ model_name: Llama 65B Instruct
9
+ model_type: llama
10
+ pipeline_tag: text-generation
11
+ prompt_template: '### System:
12
+
13
+ {system_message}
14
+
15
+
16
+ ### User:
17
+
18
+ {prompt}
19
+
20
+
21
+ ### Assistant:
22
+
23
+ '
24
+ quantized_by: TheBloke
25
+ tags:
26
+ - upstage
27
+ - llama
28
+ - instruct
29
+ - instruction
30
+ ---
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
+ # Llama 65B Instruct - AWQ
50
+ - Model creator: [upstage](https://huggingface.co/upstage)
51
+ - Original model: [Llama 65B Instruct](https://huggingface.co/upstage/llama-65b-instruct)
52
+
53
+ <!-- description start -->
54
+ ## Description
55
+
56
+ This repo contains AWQ model files for [Upstage's Llama 65B Instruct](https://huggingface.co/upstage/llama-65b-instruct).
57
+
58
+
59
+ ### About AWQ
60
+
61
+ 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.
62
+
63
+ 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.
64
+ <!-- description end -->
65
+ <!-- repositories-available start -->
66
+ ## Repositories available
67
+
68
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Upstage-Llama1-65B-Instruct-AWQ)
69
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Upstage-Llama1-65B-Instruct-GPTQ)
70
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Upstage-Llama1-65B-Instruct-GGUF)
71
+ * [upstage's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/upstage/llama-65b-instruct)
72
+ <!-- repositories-available end -->
73
+
74
+ <!-- prompt-template start -->
75
+ ## Prompt template: Orca-Hashes
76
+
77
+ ```
78
+ ### System:
79
+ {system_message}
80
+
81
+ ### User:
82
+ {prompt}
83
+
84
+ ### Assistant:
85
+
86
+ ```
87
+
88
+ <!-- prompt-template end -->
89
+
90
+
91
+ <!-- README_AWQ.md-provided-files start -->
92
+ ## Provided files and AWQ parameters
93
+
94
+ 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.
95
+
96
+ Models are released as sharded safetensors files.
97
+
98
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
99
+ | ------ | ---- | -- | ----------- | ------- | ---- |
100
+ | [main](https://huggingface.co/TheBloke/Upstage-Llama1-65B-Instruct-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 34.70 GB
101
+
102
+ <!-- README_AWQ.md-provided-files end -->
103
+
104
+ <!-- README_AWQ.md-use-from-vllm start -->
105
+ ## Serving this model from vLLM
106
+
107
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
108
+
109
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
110
+
111
+ ```shell
112
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Upstage-Llama1-65B-Instruct-AWQ --quantization awq
113
+ ```
114
+
115
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
116
+
117
+ ```python
118
+ from vllm import LLM, SamplingParams
119
+
120
+ prompts = [
121
+ "Hello, my name is",
122
+ "The president of the United States is",
123
+ "The capital of France is",
124
+ "The future of AI is",
125
+ ]
126
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
127
+
128
+ llm = LLM(model="TheBloke/Upstage-Llama1-65B-Instruct-AWQ", quantization="awq")
129
+
130
+ outputs = llm.generate(prompts, sampling_params)
131
+
132
+ # Print the outputs.
133
+ for output in outputs:
134
+ prompt = output.prompt
135
+ generated_text = output.outputs[0].text
136
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
137
+ ```
138
+ <!-- README_AWQ.md-use-from-vllm start -->
139
+
140
+ <!-- README_AWQ.md-use-from-python start -->
141
+ ## How to use this AWQ model from Python code
142
+
143
+ ### Install the necessary packages
144
+
145
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
146
+
147
+ ```shell
148
+ pip3 install autoawq
149
+ ```
150
+
151
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
152
+
153
+ ```shell
154
+ pip3 uninstall -y autoawq
155
+ git clone https://github.com/casper-hansen/AutoAWQ
156
+ cd AutoAWQ
157
+ pip3 install .
158
+ ```
159
+
160
+ ### You can then try the following example code
161
+
162
+ ```python
163
+ from awq import AutoAWQForCausalLM
164
+ from transformers import AutoTokenizer
165
+
166
+ model_name_or_path = "TheBloke/Upstage-Llama1-65B-Instruct-AWQ"
167
+
168
+ # Load model
169
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
170
+ trust_remote_code=False, safetensors=True)
171
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
172
+
173
+ prompt = "Tell me about AI"
174
+ prompt_template=f'''### System:
175
+ {system_message}
176
+
177
+ ### User:
178
+ {prompt}
179
+
180
+ ### Assistant:
181
+
182
+ '''
183
+
184
+ print("\n\n*** Generate:")
185
+
186
+ tokens = tokenizer(
187
+ prompt_template,
188
+ return_tensors='pt'
189
+ ).input_ids.cuda()
190
+
191
+ # Generate output
192
+ generation_output = model.generate(
193
+ tokens,
194
+ do_sample=True,
195
+ temperature=0.7,
196
+ top_p=0.95,
197
+ top_k=40,
198
+ max_new_tokens=512
199
+ )
200
+
201
+ print("Output: ", tokenizer.decode(generation_output[0]))
202
+
203
+ # Inference can also be done using transformers' pipeline
204
+ from transformers import pipeline
205
+
206
+ print("*** Pipeline:")
207
+ pipe = pipeline(
208
+ "text-generation",
209
+ model=model,
210
+ tokenizer=tokenizer,
211
+ max_new_tokens=512,
212
+ do_sample=True,
213
+ temperature=0.7,
214
+ top_p=0.95,
215
+ top_k=40,
216
+ repetition_penalty=1.1
217
+ )
218
+
219
+ print(pipe(prompt_template)[0]['generated_text'])
220
+ ```
221
+ <!-- README_AWQ.md-use-from-python end -->
222
+
223
+ <!-- README_AWQ.md-compatibility start -->
224
+ ## Compatibility
225
+
226
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
227
+
228
+ [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).
229
+ <!-- README_AWQ.md-compatibility end -->
230
+
231
+ <!-- footer start -->
232
+ <!-- 200823 -->
233
+ ## Discord
234
+
235
+ For further support, and discussions on these models and AI in general, join us at:
236
+
237
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
238
+
239
+ ## Thanks, and how to contribute
240
+
241
+ Thanks to the [chirper.ai](https://chirper.ai) team!
242
+
243
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
244
+
245
+ 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.
246
+
247
+ 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.
248
+
249
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
250
+
251
+ * Patreon: https://patreon.com/TheBlokeAI
252
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
253
+
254
+ **Special thanks to**: Aemon Algiz.
255
+
256
+ **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
257
+
258
+
259
+ Thank you to all my generous patrons and donaters!
260
+
261
+ And thank you again to a16z for their generous grant.
262
+
263
+ <!-- footer end -->
264
+
265
+ # Original model card: Upstage's Llama 65B Instruct
266
+
267
+ # LLaMa-65b-instruct model card
268
+
269
+ ## Model Details
270
+
271
+ * **Developed by**: [Upstage](https://en.upstage.ai)
272
+ * **Backbone Model**: [LLaMA](https://github.com/facebookresearch/llama/tree/llama_v1)
273
+ * **Variations**: It has different model parameter sizes and sequence lengths: [30B/1024](https://huggingface.co/upstage/llama-30b-instruct), [30B/2048](https://huggingface.co/upstage/llama-30b-instruct-2048), [65B/1024](https://huggingface.co/upstage/llama-65b-instruct)
274
+ * **Language(s)**: English
275
+ * **Library**: [HuggingFace Transformers](https://github.com/huggingface/transformers)
276
+ * **License**: This model is under a **Non-commercial** Bespoke License and governed by the Meta license. You should only use this repository if you have been granted access to the model by filling out [this form](https://docs.google.com/forms/d/e/1FAIpQLSfqNECQnMkycAp2jP4Z9TFX0cGR4uf7b_fBxjY_OjhJILlKGA/viewform), but have either lost your copy of the weights or encountered issues converting them to the Transformers format
277
+ * **Where to send comments**: Instructions on how to provide feedback or comments on a model can be found by opening an issue in the [Hugging Face community's model repository](https://huggingface.co/upstage/llama-30b-instruct-2048/discussions)
278
+ * **Contact**: For questions and comments about the model, please email [contact@upstage.ai](mailto:contact@upstage.ai)
279
+
280
+ ## Dataset Details
281
+
282
+ ### Used Datasets
283
+
284
+ - Orca-style dataset
285
+ - No other data was used except for the dataset mentioned above
286
+
287
+ ### Prompt Template
288
+ ```
289
+ ### System:
290
+ {System}
291
+
292
+ ### User:
293
+ {User}
294
+
295
+ ### Assistant:
296
+ {Assistant}
297
+ ```
298
+
299
+ ## Usage
300
+
301
+ - Tested on A100 80GB
302
+ - Our model can handle up to 10k+ input tokens, thanks to the `rope_scaling` option
303
+
304
+ ```python
305
+ import torch
306
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
307
+
308
+ tokenizer = AutoTokenizer.from_pretrained("upstage/llama-65b-instruct")
309
+ model = AutoModelForCausalLM.from_pretrained(
310
+ "upstage/llama-65b-instruct",
311
+ device_map="auto",
312
+ torch_dtype=torch.float16,
313
+ load_in_8bit=True,
314
+ rope_scaling={"type": "dynamic", "factor": 2} # allows handling of longer inputs
315
+ )
316
+
317
+ prompt = "### User:\nThomas is healthy, but he has to go to the hospital. What could be the reasons?\n\n### Assistant:\n"
318
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
319
+ del inputs["token_type_ids"]
320
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
321
+
322
+ output = model.generate(**inputs, streamer=streamer, use_cache=True, max_new_tokens=float('inf'))
323
+ output_text = tokenizer.decode(output[0], skip_special_tokens=True)
324
+ ```
325
+
326
+ ## Hardware and Software
327
+
328
+ * **Hardware**: We utilized an A100x8 * 4 for training our model
329
+ * **Training Factors**: We fine-tuned this model using a combination of the [DeepSpeed library](https://github.com/microsoft/DeepSpeed) and the [HuggingFace Trainer](https://huggingface.co/docs/transformers/main_classes/trainer)
330
+
331
+ ## Evaluation Results
332
+
333
+ ### Overview
334
+ - We conducted a performance evaluation based on the tasks being evaluated on the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
335
+ We evaluated our model on four benchmark datasets, which include `ARC-Challenge`, `HellaSwag`, `MMLU`, and `TruthfulQA`.
336
+ We used the [lm-evaluation-harness repository](https://github.com/EleutherAI/lm-evaluation-harness), specifically commit [b281b0921b636bc36ad05c0b0b0763bd6dd43463](https://github.com/EleutherAI/lm-evaluation-harness/tree/b281b0921b636bc36ad05c0b0b0763bd6dd43463)
337
+ - We used [MT-bench](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge), a set of challenging multi-turn open-ended questions, to evaluate the models
338
+
339
+ ### Main Results
340
+ | Model | H4(Avg) | ARC | HellaSwag | MMLU | TruthfulQA | | MT_Bench |
341
+ |--------------------------------------------------------------------|----------|----------|----------|------|----------|-|-------------|
342
+ | **[Llama-2-70b-instruct-v2](https://huggingface.co/upstage/Llama-2-70b-instruct-v2)**(Ours, Open LLM Leaderboard) | **73** | **71.1** | **87.9** | **70.6** | **62.2** | | **7.44063** |
343
+ | [Llama-2-70b-instruct](https://huggingface.co/upstage/Llama-2-70b-instruct) (Ours, Open LLM Leaderboard) | 72.3 | 70.9 | 87.5 | 69.8 | 61 | | 7.24375 |
344
+ | [llama-65b-instruct](https://huggingface.co/upstage/llama-65b-instruct) (***Ours***, ***Open LLM Leaderboard***) | 69.4 | 67.6 | 86.5 | 64.9 | 58.8 | | |
345
+ | Llama-2-70b-hf | 67.3 | 67.3 | 87.3 | 69.8 | 44.9 | | |
346
+ | [llama-30b-instruct-2048](https://huggingface.co/upstage/llama-30b-instruct-2048) (Ours, Open LLM Leaderboard) | 67.0 | 64.9 | 84.9 | 61.9 | 56.3 | | |
347
+ | [llama-30b-instruct](https://huggingface.co/upstage/llama-30b-instruct) (Ours, Open LLM Leaderboard) | 65.2 | 62.5 | 86.2 | 59.4 | 52.8 | | |
348
+ | llama-65b | 64.2 | 63.5 | 86.1 | 63.9 | 43.4 | | |
349
+ | falcon-40b-instruct | 63.4 | 61.6 | 84.3 | 55.4 | 52.5 | | |
350
+
351
+
352
+ ### Scripts for H4 Score Reproduction
353
+ - Prepare evaluation environments:
354
+ ```
355
+ # clone the repository
356
+ git clone https://github.com/EleutherAI/lm-evaluation-harness.git
357
+
358
+ # check out the specific commit
359
+ git checkout b281b0921b636bc36ad05c0b0b0763bd6dd43463
360
+
361
+ # change to the repository directory
362
+ cd lm-evaluation-harness
363
+ ```
364
+
365
+ ## Ethical Issues
366
+
367
+ ### Ethical Considerations
368
+ - There were no ethical issues involved, as we did not include the benchmark test set or the training set in the model's training process
369
+
370
+ ## Contact Us
371
+
372
+ ### Why Upstage LLM?
373
+ - [Upstage](https://en.upstage.ai)'s LLM research has yielded remarkable results. As of August 1st, our 70B model has reached the top spot in openLLM rankings, marking itself as the current leading performer globally. Recognizing the immense potential in implementing private LLM to actual businesses, we invite you to easily apply private LLM and fine-tune it with your own data. For a seamless and tailored solution, please do not hesitate to reach out to us. ► [click here to contact](https://www.upstage.ai/private-llm?utm_source=huggingface&utm_medium=link&utm_campaign=privatellm)