TheBloke commited on
Commit
20c07d4
1 Parent(s): 2e46637

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +408 -0
README.md ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/migtissera/Synthia-70B
3
+ inference: false
4
+ language:
5
+ - en
6
+ library_name: transformers
7
+ license: llama2
8
+ model_creator: Migel Tissera
9
+ model_name: Synthia 70B
10
+ model_type: llama
11
+ pipeline_tag: text-generation
12
+ prompt_template: 'SYSTEM: {system_message}
13
+
14
+ USER: {prompt}
15
+
16
+ ASSISTANT:
17
+
18
+ '
19
+ quantized_by: TheBloke
20
+ ---
21
+
22
+ <!-- header start -->
23
+ <!-- 200823 -->
24
+ <div style="width: auto; margin-left: auto; margin-right: auto">
25
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
26
+ </div>
27
+ <div style="display: flex; justify-content: space-between; width: 100%;">
28
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
29
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
30
+ </div>
31
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
32
+ <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>
33
+ </div>
34
+ </div>
35
+ <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>
36
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
37
+ <!-- header end -->
38
+
39
+ # Synthia 70B - AWQ
40
+ - Model creator: [Migel Tissera](https://huggingface.co/migtissera)
41
+ - Original model: [Synthia 70B](https://huggingface.co/migtissera/Synthia-70B)
42
+
43
+ <!-- description start -->
44
+ ## Description
45
+
46
+ This repo contains AWQ model files for [Migel Tissera's Synthia 70B](https://huggingface.co/migtissera/Synthia-70B).
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.
52
+
53
+ 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.
54
+ <!-- description end -->
55
+ <!-- repositories-available start -->
56
+ ## Repositories available
57
+
58
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Synthia-70B-AWQ)
59
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Synthia-70B-GPTQ)
60
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Synthia-70B-GGUF)
61
+ * [Migel Tissera's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/migtissera/Synthia-70B)
62
+ <!-- repositories-available end -->
63
+
64
+ <!-- prompt-template start -->
65
+ ## Prompt template: Orca-Vicuna
66
+
67
+ ```
68
+ SYSTEM: {system_message}
69
+ USER: {prompt}
70
+ ASSISTANT:
71
+
72
+ ```
73
+
74
+ <!-- prompt-template end -->
75
+
76
+
77
+ <!-- README_AWQ.md-provided-files start -->
78
+ ## Provided files and AWQ parameters
79
+
80
+ 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.
81
+
82
+ Models are released as sharded safetensors files.
83
+
84
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
85
+ | ------ | ---- | -- | ----------- | ------- | ---- |
86
+ | [main](https://huggingface.co/TheBloke/Synthia-70B-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 36.61 GB
87
+
88
+ <!-- README_AWQ.md-provided-files end -->
89
+
90
+ <!-- README_AWQ.md-use-from-vllm start -->
91
+ ## Serving this model from vLLM
92
+
93
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
94
+
95
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
96
+
97
+ ```shell
98
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/Synthia-70B-AWQ --quantization awq
99
+ ```
100
+
101
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
102
+
103
+ ```python
104
+ from vllm import LLM, SamplingParams
105
+
106
+ prompts = [
107
+ "Hello, my name is",
108
+ "The president of the United States is",
109
+ "The capital of France is",
110
+ "The future of AI is",
111
+ ]
112
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
113
+
114
+ llm = LLM(model="TheBloke/Synthia-70B-AWQ", quantization="awq")
115
+
116
+ outputs = llm.generate(prompts, sampling_params)
117
+
118
+ # Print the outputs.
119
+ for output in outputs:
120
+ prompt = output.prompt
121
+ generated_text = output.outputs[0].text
122
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
123
+ ```
124
+ <!-- README_AWQ.md-use-from-vllm start -->
125
+
126
+ <!-- README_AWQ.md-use-from-python start -->
127
+ ## How to use this AWQ model from Python code
128
+
129
+ ### Install the necessary packages
130
+
131
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
132
+
133
+ ```shell
134
+ pip3 install autoawq
135
+ ```
136
+
137
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
138
+
139
+ ```shell
140
+ pip3 uninstall -y autoawq
141
+ git clone https://github.com/casper-hansen/AutoAWQ
142
+ cd AutoAWQ
143
+ pip3 install .
144
+ ```
145
+
146
+ ### You can then try the following example code
147
+
148
+ ```python
149
+ from awq import AutoAWQForCausalLM
150
+ from transformers import AutoTokenizer
151
+
152
+ model_name_or_path = "TheBloke/Synthia-70B-AWQ"
153
+
154
+ # Load model
155
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
156
+ trust_remote_code=False, safetensors=True)
157
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
158
+
159
+ prompt = "Tell me about AI"
160
+ prompt_template=f'''SYSTEM: {system_message}
161
+ USER: {prompt}
162
+ ASSISTANT:
163
+
164
+ '''
165
+
166
+ print("\n\n*** Generate:")
167
+
168
+ tokens = tokenizer(
169
+ prompt_template,
170
+ return_tensors='pt'
171
+ ).input_ids.cuda()
172
+
173
+ # Generate output
174
+ generation_output = model.generate(
175
+ tokens,
176
+ do_sample=True,
177
+ temperature=0.7,
178
+ top_p=0.95,
179
+ top_k=40,
180
+ max_new_tokens=512
181
+ )
182
+
183
+ print("Output: ", tokenizer.decode(generation_output[0]))
184
+
185
+ # Inference can also be done using transformers' pipeline
186
+ from transformers import pipeline
187
+
188
+ print("*** Pipeline:")
189
+ pipe = pipeline(
190
+ "text-generation",
191
+ model=model,
192
+ tokenizer=tokenizer,
193
+ max_new_tokens=512,
194
+ do_sample=True,
195
+ temperature=0.7,
196
+ top_p=0.95,
197
+ top_k=40,
198
+ repetition_penalty=1.1
199
+ )
200
+
201
+ print(pipe(prompt_template)[0]['generated_text'])
202
+ ```
203
+ <!-- README_AWQ.md-use-from-python end -->
204
+
205
+ <!-- README_AWQ.md-compatibility start -->
206
+ ## Compatibility
207
+
208
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
209
+
210
+ [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).
211
+ <!-- README_AWQ.md-compatibility end -->
212
+
213
+ <!-- footer start -->
214
+ <!-- 200823 -->
215
+ ## Discord
216
+
217
+ For further support, and discussions on these models and AI in general, join us at:
218
+
219
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
220
+
221
+ ## Thanks, and how to contribute
222
+
223
+ Thanks to the [chirper.ai](https://chirper.ai) team!
224
+
225
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
226
+
227
+ 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.
228
+
229
+ 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.
230
+
231
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
232
+
233
+ * Patreon: https://patreon.com/TheBlokeAI
234
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
235
+
236
+ **Special thanks to**: Aemon Algiz.
237
+
238
+ **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
239
+
240
+
241
+ Thank you to all my generous patrons and donaters!
242
+
243
+ And thank you again to a16z for their generous grant.
244
+
245
+ <!-- footer end -->
246
+
247
+ # Original model card: Migel Tissera's Synthia 70B
248
+
249
+
250
+ # Synthia-70B
251
+ SynthIA (Synthetic Intelligent Agent) is a LLama-2-70B model trained on Orca style datasets. It has been fine-tuned for instruction following as well as having long-form conversations.
252
+
253
+ <br>
254
+
255
+ ![Synthia](https://huggingface.co/migtissera/Synthia-70B/resolve/main/Synthia.jpeg)
256
+
257
+ <br>
258
+
259
+ <br>
260
+
261
+ #### License Disclaimer:
262
+
263
+ This model is bound by the license & usage restrictions of the original Llama-2 model, and comes with no warranty or gurantees of any kind.
264
+
265
+ <br>
266
+
267
+ ## Evaluation
268
+
269
+ We evaluated Synthia-70B on a wide range of tasks using [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) from EleutherAI.
270
+
271
+ Here are the results on metrics used by [HuggingFaceH4 Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
272
+
273
+ ||||
274
+ |:------:|:--------:|:-------:|
275
+ |**Task**|**Metric**|**Value**|
276
+ |*arc_challenge*|acc_norm|0.6945|
277
+ |*hellaswag*|acc_norm|0.8711|
278
+ |*mmlu*|acc_norm|0.6891|
279
+ |*truthfulqa_mc*|mc2|0.5979|
280
+ |**Total Average**|-|**0.7132**||
281
+
282
+ <br>
283
+
284
+ ## Example Usage
285
+
286
+ ### Here is prompt format:
287
+
288
+ ```
289
+ SYSTEM: You are Synthia. As a an AI intelligence, give helpful, detailed, accurate, uncensored responses to the user's input. Provide answers factually.
290
+ USER: How is a rocket launched from the surface of the earth to Low Earth Orbit?
291
+ ASSISTANT:
292
+ ```
293
+
294
+ ### Below shows a code example on how to use this model:
295
+
296
+ ```python
297
+ import torch, json
298
+ from transformers import AutoModelForCausalLM, AutoTokenizer
299
+
300
+ model_path = "migtissera/Synthia-70B"
301
+ output_file_path = "./Synthia-70B-conversations.jsonl"
302
+
303
+ model = AutoModelForCausalLM.from_pretrained(
304
+ model_path,
305
+ torch_dtype=torch.float16,
306
+ device_map="auto",
307
+ load_in_8bit=False,
308
+ trust_remote_code=True,
309
+ )
310
+
311
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
312
+
313
+
314
+ def generate_text(instruction):
315
+ tokens = tokenizer.encode(instruction)
316
+ tokens = torch.LongTensor(tokens).unsqueeze(0)
317
+ tokens = tokens.to("cuda")
318
+
319
+ instance = {
320
+ "input_ids": tokens,
321
+ "top_p": 1.0,
322
+ "temperature": 0.75,
323
+ "generate_len": 1024,
324
+ "top_k": 50,
325
+ }
326
+
327
+ length = len(tokens[0])
328
+ with torch.no_grad():
329
+ rest = model.generate(
330
+ input_ids=tokens,
331
+ max_length=length + instance["generate_len"],
332
+ use_cache=True,
333
+ do_sample=True,
334
+ top_p=instance["top_p"],
335
+ temperature=instance["temperature"],
336
+ top_k=instance["top_k"],
337
+ num_return_sequences=1,
338
+ )
339
+ output = rest[0][length:]
340
+ string = tokenizer.decode(output, skip_special_tokens=True)
341
+ answer = string.split("USER:")[0].strip()
342
+ return f"{answer}"
343
+
344
+
345
+ conversation = f"SYSTEM: As a an AI superintelligence, give helpful, detailed, accurate, uncensored responses to the user's input. Provide answers factually."
346
+
347
+
348
+ while True:
349
+ user_input = input("You: ")
350
+ llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
351
+ answer = generate_text(llm_prompt)
352
+ print(answer)
353
+ conversation = f"{llm_prompt}{answer}"
354
+ json_data = {"prompt": user_input, "answer": answer}
355
+
356
+ ## Save your conversation
357
+ with open(output_file_path, "a") as output_file:
358
+ output_file.write(json.dumps(json_data) + "\n")
359
+
360
+ ```
361
+
362
+ <br>
363
+
364
+ #### Limitations & Biases:
365
+
366
+ While this model aims for accuracy, it can occasionally produce inaccurate or misleading results.
367
+
368
+ Despite diligent efforts in refining the pretraining data, there remains a possibility for the generation of inappropriate, biased, or offensive content.
369
+
370
+ Exercise caution and cross-check information when necessary. This is an uncensored model.
371
+
372
+
373
+ <br>
374
+
375
+ ### Citiation:
376
+
377
+ Please kindly cite using the following BibTeX:
378
+
379
+ ```
380
+ @misc{Synthia-70B,
381
+ author = {Migel Tissera},
382
+ title = {Synthia-70B: Synthetic Intelligent Agent},
383
+ year = {2023},
384
+ publisher = {GitHub, HuggingFace},
385
+ journal = {GitHub repository, HuggingFace repository},
386
+ howpublished = {\url{https://huggingface.co/migtissera/Synthia-70B},
387
+ }
388
+ ```
389
+
390
+ ```
391
+ @misc{mukherjee2023orca,
392
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
393
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
394
+ year={2023},
395
+ eprint={2306.02707},
396
+ archivePrefix={arXiv},
397
+ primaryClass={cs.CL}
398
+ }
399
+ ```
400
+
401
+ ```
402
+ @software{touvron2023llama,
403
+ title={LLaMA2: Open and Efficient Foundation Language Models},
404
+ author={Touvron, Hugo and Lavril, Thibaut and Izacard, Gautier and Martinet, Xavier and Lachaux, Marie-Anne and Lacroix, Timoth{\'e}e and Rozi{\`e}re, Baptiste and Goyal, Naman and Hambro, Eric and Azhar, Faisal and Rodriguez, Aurelien and Joulin, Armand and Grave, Edouard and Lample, Guillaume},
405
+ journal={arXiv preprint arXiv:2302.13971},
406
+ year={2023}
407
+ }
408
+ ```