TheBloke commited on
Commit
b906d4b
1 Parent(s): ae8f46b

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +388 -0
README.md ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: llm-agents/tora-70b-v1.0
3
+ datasets:
4
+ - gsm8k
5
+ - competition_math
6
+ inference: false
7
+ language:
8
+ - en
9
+ library_name: transformers
10
+ license: llama2
11
+ metrics:
12
+ - exact_match
13
+ model_creator: LLM-Agents
14
+ model_name: ToRA 70B v1.0
15
+ model_type: llama
16
+ pipeline_tag: text-generation
17
+ prompt_template: '<|user|>
18
+
19
+ {prompt}
20
+
21
+ <|assistant|>
22
+
23
+ '
24
+ quantized_by: TheBloke
25
+ tags:
26
+ - code
27
+ - math
28
+ ---
29
+
30
+ <!-- header start -->
31
+ <!-- 200823 -->
32
+ <div style="width: auto; margin-left: auto; margin-right: auto">
33
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
34
+ </div>
35
+ <div style="display: flex; justify-content: space-between; width: 100%;">
36
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
37
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
38
+ </div>
39
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
40
+ <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>
41
+ </div>
42
+ </div>
43
+ <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>
44
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
45
+ <!-- header end -->
46
+
47
+ # ToRA 70B v1.0 - AWQ
48
+ - Model creator: [LLM-Agents](https://huggingface.co/llm-agents)
49
+ - Original model: [ToRA 70B v1.0](https://huggingface.co/llm-agents/tora-70b-v1.0)
50
+
51
+ <!-- description start -->
52
+ ## Description
53
+
54
+ This repo contains AWQ model files for [LLM-Agents's ToRA 70B v1.0](https://huggingface.co/llm-agents/tora-70b-v1.0).
55
+
56
+
57
+ ### About AWQ
58
+
59
+ 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.
60
+
61
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of Llama AWQ models for high-throughput concurrent inference in multi-user server scenarios.
62
+
63
+ As of September 25th 2023, preliminary Llama-only AWQ support has also been added to [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference).
64
+
65
+ Note that, at the time of writing, overall throughput is still lower than running vLLM or TGI 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.
66
+ <!-- description end -->
67
+ <!-- repositories-available start -->
68
+ ## Repositories available
69
+
70
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/tora-70B-v1.0-AWQ)
71
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/tora-70B-v1.0-GPTQ)
72
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/tora-70B-v1.0-GGUF)
73
+ * [LLM-Agents's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/llm-agents/tora-70b-v1.0)
74
+ <!-- repositories-available end -->
75
+
76
+ <!-- prompt-template start -->
77
+ ## Prompt template: ToRA
78
+
79
+ ```
80
+ <|user|>
81
+ {prompt}
82
+ <|assistant|>
83
+
84
+ ```
85
+
86
+ <!-- prompt-template end -->
87
+
88
+
89
+ <!-- README_AWQ.md-provided-files start -->
90
+ ## Provided files, and AWQ parameters
91
+
92
+ 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.
93
+
94
+ Models are released as sharded safetensors files.
95
+
96
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
97
+ | ------ | ---- | -- | ----------- | ------- | ---- |
98
+ | [main](https://huggingface.co/TheBloke/tora-70B-v1.0-AWQ/tree/main) | 4 | 128 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 36.61 GB
99
+
100
+ <!-- README_AWQ.md-provided-files end -->
101
+
102
+ <!-- README_AWQ.md-use-from-vllm start -->
103
+ ## Serving this model from vLLM
104
+
105
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
106
+
107
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
108
+
109
+ If you try the vLLM examples below and get an error about `quantization` being unrecognised, or other AWQ-related issues, please install vLLM from Github source.
110
+
111
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
112
+
113
+ ```shell
114
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/tora-70B-v1.0-AWQ --quantization awq --dtype half
115
+ ```
116
+
117
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
118
+
119
+ ```python
120
+ from vllm import LLM, SamplingParams
121
+
122
+ prompts = [
123
+ "Hello, my name is",
124
+ "The president of the United States is",
125
+ "The capital of France is",
126
+ "The future of AI is",
127
+ ]
128
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
129
+
130
+ llm = LLM(model="TheBloke/tora-70B-v1.0-AWQ", quantization="awq", dtype="half")
131
+
132
+ outputs = llm.generate(prompts, sampling_params)
133
+
134
+ # Print the outputs.
135
+ for output in outputs:
136
+ prompt = output.prompt
137
+ generated_text = output.outputs[0].text
138
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
139
+ ```
140
+ <!-- README_AWQ.md-use-from-vllm start -->
141
+
142
+ <!-- README_AWQ.md-use-from-tgi start -->
143
+ ## Serving this model from Text Generation Inference (TGI)
144
+
145
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
146
+
147
+ Example Docker parameters:
148
+
149
+ ```shell
150
+ --model-id TheBloke/tora-70B-v1.0-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
151
+ ```
152
+
153
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
154
+
155
+ ```shell
156
+ pip3 install huggingface-hub
157
+ ```
158
+
159
+ ```python
160
+ from huggingface_hub import InferenceClient
161
+
162
+ endpoint_url = "https://your-endpoint-url-here"
163
+
164
+ prompt = "Tell me about AI"
165
+ prompt_template=f'''<|user|>
166
+ {prompt}
167
+ <|assistant|>
168
+
169
+ '''
170
+
171
+ client = InferenceClient(endpoint_url)
172
+ response = client.text_generation(prompt,
173
+ max_new_tokens=128,
174
+ do_sample=True,
175
+ temperature=0.7,
176
+ top_p=0.95,
177
+ top_k=40,
178
+ repetition_penalty=1.1)
179
+
180
+ print(f"Model output: {response}")
181
+ ```
182
+ <!-- README_AWQ.md-use-from-tgi end -->
183
+
184
+ <!-- README_AWQ.md-use-from-python start -->
185
+ ## How to use this AWQ model from Python code
186
+
187
+ ### Install the necessary packages
188
+
189
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.1 or later
190
+
191
+ ```shell
192
+ pip3 install autoawq
193
+ ```
194
+
195
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
196
+
197
+ ```shell
198
+ pip3 uninstall -y autoawq
199
+ git clone https://github.com/casper-hansen/AutoAWQ
200
+ cd AutoAWQ
201
+ pip3 install .
202
+ ```
203
+
204
+ ### You can then try the following example code
205
+
206
+ ```python
207
+ from awq import AutoAWQForCausalLM
208
+ from transformers import AutoTokenizer
209
+
210
+ model_name_or_path = "TheBloke/tora-70B-v1.0-AWQ"
211
+
212
+ # Load model
213
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
214
+ trust_remote_code=False, safetensors=True)
215
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
216
+
217
+ prompt = "Tell me about AI"
218
+ prompt_template=f'''<|user|>
219
+ {prompt}
220
+ <|assistant|>
221
+
222
+ '''
223
+
224
+ print("\n\n*** Generate:")
225
+
226
+ tokens = tokenizer(
227
+ prompt_template,
228
+ return_tensors='pt'
229
+ ).input_ids.cuda()
230
+
231
+ # Generate output
232
+ generation_output = model.generate(
233
+ tokens,
234
+ do_sample=True,
235
+ temperature=0.7,
236
+ top_p=0.95,
237
+ top_k=40,
238
+ max_new_tokens=512
239
+ )
240
+
241
+ print("Output: ", tokenizer.decode(generation_output[0]))
242
+
243
+ """
244
+ # Inference should be possible with transformers pipeline as well in future
245
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
246
+ from transformers import pipeline
247
+
248
+ print("*** Pipeline:")
249
+ pipe = pipeline(
250
+ "text-generation",
251
+ model=model,
252
+ tokenizer=tokenizer,
253
+ max_new_tokens=512,
254
+ do_sample=True,
255
+ temperature=0.7,
256
+ top_p=0.95,
257
+ top_k=40,
258
+ repetition_penalty=1.1
259
+ )
260
+
261
+ print(pipe(prompt_template)[0]['generated_text'])
262
+ """
263
+ ```
264
+ <!-- README_AWQ.md-use-from-python end -->
265
+
266
+ <!-- README_AWQ.md-compatibility start -->
267
+ ## Compatibility
268
+
269
+ The files provided are tested to work with:
270
+
271
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
272
+ - [vLLM](https://github.com/vllm-project/vllm)
273
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
274
+
275
+ TGI merged AWQ support on September 25th, 2023: [TGI PR #1054](https://github.com/huggingface/text-generation-inference/pull/1054). Use the `:latest` Docker container until the next TGI release is made.
276
+
277
+ <!-- README_AWQ.md-compatibility end -->
278
+
279
+ <!-- footer start -->
280
+ <!-- 200823 -->
281
+ ## Discord
282
+
283
+ For further support, and discussions on these models and AI in general, join us at:
284
+
285
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
286
+
287
+ ## Thanks, and how to contribute
288
+
289
+ Thanks to the [chirper.ai](https://chirper.ai) team!
290
+
291
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
292
+
293
+ 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.
294
+
295
+ 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.
296
+
297
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
298
+
299
+ * Patreon: https://patreon.com/TheBlokeAI
300
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
301
+
302
+ **Special thanks to**: Aemon Algiz.
303
+
304
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
305
+
306
+
307
+ Thank you to all my generous patrons and donaters!
308
+
309
+ And thank you again to a16z for their generous grant.
310
+
311
+ <!-- footer end -->
312
+
313
+ # Original model card: LLM-Agents's ToRA 70B v1.0
314
+
315
+
316
+
317
+ <h1 align="center">
318
+ ToRA: A Tool-Integrated Reasoning Agent <br> for Mathematical Problem Solving
319
+ </h1>
320
+
321
+ <p align="center">
322
+ <a href="https://microsoft.github.io/ToRA/"><b>[🌐 Website]</b></a> •
323
+ <a href="https://arxiv.org/abs/2309.17452"><b>[📜 Paper]</b></a> •
324
+ <a href="https://huggingface.co/llm-agents"><b>[🤗 HF Models]</b></a> •
325
+ <a href="https://github.com/microsoft/ToRA"><b>[🐱 GitHub]</b></a>
326
+ <br>
327
+ <a href="https://twitter.com/zhs05232838/status/1708860992631763092"><b>[🐦 Twitter]</b></a> •
328
+ <a href="https://www.reddit.com/r/LocalLLaMA/comments/1703k6d/tora_a_toolintegrated_reasoning_agent_for/"><b>[💬 Reddit]</b></a> •
329
+ <a href="https://notes.aimodels.fyi/researchers-announce-tora-training-language-models-to-better-understand-math-using-external-tools/">[🍀 Unofficial Blog]</a>
330
+ <!-- <a href="#-quick-start">Quick Start</a> • -->
331
+ <!-- <a href="#%EF%B8%8F-citation">Citation</a> -->
332
+ </p>
333
+
334
+ <p align="center">
335
+ Repo for "<a href="https://arxiv.org/abs/2309.17452" target="_blank">ToRA: A Tool-Integrated Reasoning Agent for Mathematical Problem Solving</a>"
336
+ </p>
337
+
338
+ ## 🔥 News
339
+
340
+ - [2023/10/08] 🔥🔥🔥 All ToRA models released at [HuggingFace](https://huggingface.co/llm-agents)!!!
341
+ - [2023/09/29] ToRA paper, repo, and website released.
342
+
343
+ ## 💡 Introduction
344
+
345
+ ToRA is a series of Tool-integrated Reasoning Agents designed to solve challenging mathematical reasoning problems by interacting with tools, e.g., computation libraries and symbolic solvers. ToRA series seamlessly integrate natural language reasoning with the utilization of external tools, thereby amalgamating the analytical prowess of language and the computational efficiency of external tools.
346
+
347
+ | Model | Size | GSM8k | MATH | AVG@10 math tasks<sup>&dagger;</sup> |
348
+ |---|---|---|---|---|
349
+ | GPT-4 | - | 92.0 | 42.5 | 78.3 |
350
+ | GPT-4 (PAL) | - | 94.2 | 51.8 | 86.4 |
351
+ | [ToRA-7B](https://huggingface.co/llm-agents/tora-7b-v1.0) | 7B | 68.8 | 40.1 | 62.4|
352
+ | [ToRA-Code-7B](https://huggingface.co/llm-agents/tora-code-7b-v1.0) | 7B | 72.6 | 44.6 | 66.5|
353
+ | [ToRA-13B](https://huggingface.co/llm-agents/tora-13b-v1.0) | 13B | 72.7 | 43.0 | 65.9|
354
+ | [ToRA-Code-13B](https://huggingface.co/llm-agents/tora-code-13b-v1.0) | 13B | 75.8 | 48.1 | 71.3 |
355
+ | [ToRA-Code-34B<sup>*</sup>](https://huggingface.co/llm-agents/tora-code-34b-v1.0) | 34B | 80.7 | **51.0** | 74.8 |
356
+ | [ToRA-70B](https://huggingface.co/llm-agents/tora-70b-v1.0) | 70B | **84.3** | 49.7 | **76.9** |
357
+
358
+ - <sup>*</sup>ToRA-Code-34B is currently the first and only open-source model to achieve over 50% accuracy (pass@1) on the MATH dataset, which significantly outperforms GPT-4’s CoT result (51.0 vs. 42.5), and is competitive with GPT-4 solving problems with programs. By open-sourcing our codes and models, we hope more breakthroughs will come!
359
+
360
+ - <sup>&dagger;</sup>10 math tasks include GSM8k, MATH, GSM-Hard, SVAMP, TabMWP, ASDiv, SingleEQ, SingleOP, AddSub, and MultiArith.
361
+
362
+
363
+ ## ⚡️ Training
364
+
365
+ The models are trained on ToRA-Corpus 16k, which contains tool-integrated reasoning trajectories of MATH and GSM8k from GPT-4.
366
+
367
+ We use imitation learning (i.e., SFT) to fine-tune the models, and then apply our proposed *output space shaping* to improve tool-integrated reasoning behaviors. Please refer to the [paper](https://arxiv.org/pdf/2309.17452.pdf) for more details.
368
+
369
+
370
+ ## 🪁 Inference & Evaluation
371
+
372
+ Please refer to ToRA's [GitHub repo](https://github.com/microsoft/ToRA) for inference, evaluation, and training code.
373
+
374
+
375
+ ## ☕️ Citation
376
+
377
+ If you find this repository helpful, please consider citing our paper:
378
+
379
+ ```
380
+ @misc{gou2023tora,
381
+ title={ToRA: A Tool-Integrated Reasoning Agent for Mathematical Problem Solving},
382
+ author={Zhibin Gou and Zhihong Shao and Yeyun Gong and yelong shen and Yujiu Yang and Minlie Huang and Nan Duan and Weizhu Chen},
383
+ year={2023},
384
+ eprint={2309.17452},
385
+ archivePrefix={arXiv},
386
+ primaryClass={cs.CL}
387
+ }
388
+ ```