TheBloke commited on
Commit
84ed9c1
1 Parent(s): 35154c0

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +374 -0
README.md ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/upstage/Llama-2-70b-instruct-v2
3
+ inference: false
4
+ language:
5
+ - en
6
+ license: llama2
7
+ model_creator: Upstage
8
+ model_name: Llama 2 70B Instruct v2
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-2
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 2 70B Instruct v2 - AWQ
50
+ - Model creator: [Upstage](https://huggingface.co/Upstage)
51
+ - Original model: [Llama 2 70B Instruct v2](https://huggingface.co/upstage/Llama-2-70b-instruct-v2)
52
+
53
+ <!-- description start -->
54
+ ## Description
55
+
56
+ This repo contains AWQ model files for [Upstage's Llama 2 70B Instruct v2](https://huggingface.co/upstage/Llama-2-70b-instruct-v2).
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-Llama-2-70B-instruct-v2-AWQ)
69
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Upstage-Llama-2-70B-instruct-v2-GPTQ)
70
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Upstage-Llama-2-70B-instruct-v2-GGUF)
71
+ * [Upstage's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/upstage/Llama-2-70b-instruct-v2)
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-Llama-2-70B-instruct-v2-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 36.61 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-Llama-2-70B-instruct-v2-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-Llama-2-70B-instruct-v2-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-Llama-2-70B-instruct-v2-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 2 70B Instruct v2
266
+
267
+ # Updates
268
+ Solar, a new bot created by Upstage, is now available on **Poe**. As a top-ranked model on the HuggingFace Open LLM leaderboard, and a fine tune of Llama 2, Solar is a great example of the progress enabled by open source.
269
+ Try now at https://poe.com/Solar-0-70b
270
+
271
+
272
+ # SOLAR-0-70b-16bit model card
273
+ The model name has been changed from LLaMa-2-70b-instruct-v2 to SOLAR-0-70b-16bit
274
+
275
+ ## Model Details
276
+
277
+ * **Developed by**: [Upstage](https://en.upstage.ai)
278
+ * **Backbone Model**: [LLaMA-2](https://github.com/facebookresearch/llama/tree/main)
279
+ * **Language(s)**: English
280
+ * **Library**: [HuggingFace Transformers](https://github.com/huggingface/transformers)
281
+ * **License**: Fine-tuned checkpoints is licensed under the Non-Commercial Creative Commons license ([CC BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/))
282
+ * **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-2-70b-instruct-v2/discussions)
283
+ * **Contact**: For questions and comments about the model, please email [contact@upstage.ai](mailto:contact@upstage.ai)
284
+
285
+ ## Dataset Details
286
+
287
+ ### Used Datasets
288
+ - Orca-style dataset
289
+ - Alpaca-style dataset
290
+ - No other dataset was used except for the dataset mentioned above
291
+ - No benchmark test set or the training set are used
292
+
293
+
294
+ ### Prompt Template
295
+ ```
296
+ ### System:
297
+ {System}
298
+
299
+ ### User:
300
+ {User}
301
+
302
+ ### Assistant:
303
+ {Assistant}
304
+ ```
305
+
306
+ ## Usage
307
+
308
+ - The followings are tested on A100 80GB
309
+ - Our model can handle up to 10k+ input tokens, thanks to the `rope_scaling` option
310
+
311
+ ```python
312
+ import torch
313
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
314
+
315
+ tokenizer = AutoTokenizer.from_pretrained("upstage/Llama-2-70b-instruct-v2")
316
+ model = AutoModelForCausalLM.from_pretrained(
317
+ "upstage/Llama-2-70b-instruct-v2",
318
+ device_map="auto",
319
+ torch_dtype=torch.float16,
320
+ load_in_8bit=True,
321
+ rope_scaling={"type": "dynamic", "factor": 2} # allows handling of longer inputs
322
+ )
323
+
324
+ prompt = "### User:\nThomas is healthy, but he has to go to the hospital. What could be the reasons?\n\n### Assistant:\n"
325
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
326
+ del inputs["token_type_ids"]
327
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
328
+
329
+ output = model.generate(**inputs, streamer=streamer, use_cache=True, max_new_tokens=float('inf'))
330
+ output_text = tokenizer.decode(output[0], skip_special_tokens=True)
331
+ ```
332
+
333
+ ## Hardware and Software
334
+
335
+ * **Hardware**: We utilized an A100x8 * 4 for training our model
336
+ * **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) / [HuggingFace Accelerate](https://huggingface.co/docs/accelerate/index)
337
+
338
+ ## Evaluation Results
339
+
340
+ ### Overview
341
+ - We conducted a performance evaluation following the tasks being evaluated on the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
342
+ We evaluated our model on four benchmark datasets, which include `ARC-Challenge`, `HellaSwag`, `MMLU`, and `TruthfulQA`
343
+ 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).
344
+ - 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
345
+
346
+ ### Main Results
347
+ | Model | H4(Avg) | ARC | HellaSwag | MMLU | TruthfulQA | | MT_Bench |
348
+ |--------------------------------------------------------------------|----------|----------|----------|------|----------|-|-------------|
349
+ | **[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** |
350
+ | [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 |
351
+ | [llama-65b-instruct](https://huggingface.co/upstage/llama-65b-instruct) (Ours, Open LLM Leaderboard) | 69.4 | 67.6 | 86.5 | 64.9 | 58.8 | | |
352
+ | Llama-2-70b-hf | 67.3 | 67.3 | 87.3 | 69.8 | 44.9 | | |
353
+ | [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 | | |
354
+ | [llama-30b-instruct](https://huggingface.co/upstage/llama-30b-instruct) (Ours, Open LLM Leaderboard) | 65.2 | 62.5 | 86.2 | 59.4 | 52.8 | | |
355
+ | llama-65b | 64.2 | 63.5 | 86.1 | 63.9 | 43.4 | | |
356
+ | falcon-40b-instruct | 63.4 | 61.6 | 84.3 | 55.4 | 52.5 | | |
357
+
358
+ ### Scripts for H4 Score Reproduction
359
+ - Prepare evaluation environments:
360
+ ```
361
+ # clone the repository
362
+ git clone https://github.com/EleutherAI/lm-evaluation-harness.git
363
+ # check out the specific commit
364
+ git checkout b281b0921b636bc36ad05c0b0b0763bd6dd43463
365
+ # change to the repository directory
366
+ cd lm-evaluation-harness
367
+ ```
368
+
369
+ ## Contact Us
370
+
371
+ ### About Upstage
372
+ - [Upstage](https://en.upstage.ai) is a company specialized in Large Language Models (LLMs) and AI. We will help you build private LLMs and related applications.
373
+ If you have a dataset to build domain specific LLMs or make LLM applications, please contact us at ► [click here to contact](https://www.upstage.ai/private-llm?utm_source=huggingface&utm_medium=link&utm_campaign=privatellm)
374
+ - As of August 1st, our 70B model has reached the top spot in openLLM rankings, marking itself as the current leading performer globally.