Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,430 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: llm-agents/tora-13b-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 13B 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 13B v1.0 - GPTQ
|
48 |
+
- Model creator: [LLM-Agents](https://huggingface.co/llm-agents)
|
49 |
+
- Original model: [ToRA 13B v1.0](https://huggingface.co/llm-agents/tora-13b-v1.0)
|
50 |
+
|
51 |
+
<!-- description start -->
|
52 |
+
## Description
|
53 |
+
|
54 |
+
This repo contains GPTQ model files for [LLM-Agents's ToRA 13B v1.0](https://huggingface.co/llm-agents/tora-13b-v1.0).
|
55 |
+
|
56 |
+
Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
|
57 |
+
|
58 |
+
<!-- description end -->
|
59 |
+
<!-- repositories-available start -->
|
60 |
+
## Repositories available
|
61 |
+
|
62 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/tora-13B-v1.0-AWQ)
|
63 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ)
|
64 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/tora-13B-v1.0-GGUF)
|
65 |
+
* [LLM-Agents's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/llm-agents/tora-13b-v1.0)
|
66 |
+
<!-- repositories-available end -->
|
67 |
+
|
68 |
+
<!-- prompt-template start -->
|
69 |
+
## Prompt template: ToRA
|
70 |
+
|
71 |
+
```
|
72 |
+
<|user|>
|
73 |
+
{prompt}
|
74 |
+
<|assistant|>
|
75 |
+
|
76 |
+
```
|
77 |
+
|
78 |
+
<!-- prompt-template end -->
|
79 |
+
|
80 |
+
|
81 |
+
<!-- README_GPTQ.md-provided-files start -->
|
82 |
+
## Provided files, and GPTQ parameters
|
83 |
+
|
84 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
85 |
+
|
86 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
87 |
+
|
88 |
+
Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
|
89 |
+
|
90 |
+
<details>
|
91 |
+
<summary>Explanation of GPTQ parameters</summary>
|
92 |
+
|
93 |
+
- Bits: The bit size of the quantised model.
|
94 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
95 |
+
- Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
|
96 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
97 |
+
- GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
|
98 |
+
- Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
|
99 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
|
100 |
+
|
101 |
+
</details>
|
102 |
+
|
103 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
104 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
105 |
+
| [main](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.26 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
|
106 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 8.00 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
|
107 |
+
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 13.36 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
|
108 |
+
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 13.65 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
|
109 |
+
| [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 14.55 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
|
110 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.51 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
|
111 |
+
|
112 |
+
<!-- README_GPTQ.md-provided-files end -->
|
113 |
+
|
114 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
115 |
+
## How to download, including from branches
|
116 |
+
|
117 |
+
### In text-generation-webui
|
118 |
+
|
119 |
+
To download from the `main` branch, enter `TheBloke/tora-13B-v1.0-GPTQ` in the "Download model" box.
|
120 |
+
|
121 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/tora-13B-v1.0-GPTQ:gptq-4bit-32g-actorder_True`
|
122 |
+
|
123 |
+
### From the command line
|
124 |
+
|
125 |
+
I recommend using the `huggingface-hub` Python library:
|
126 |
+
|
127 |
+
```shell
|
128 |
+
pip3 install huggingface-hub
|
129 |
+
```
|
130 |
+
|
131 |
+
To download the `main` branch to a folder called `tora-13B-v1.0-GPTQ`:
|
132 |
+
|
133 |
+
```shell
|
134 |
+
mkdir tora-13B-v1.0-GPTQ
|
135 |
+
huggingface-cli download TheBloke/tora-13B-v1.0-GPTQ --local-dir tora-13B-v1.0-GPTQ --local-dir-use-symlinks False
|
136 |
+
```
|
137 |
+
|
138 |
+
To download from a different branch, add the `--revision` parameter:
|
139 |
+
|
140 |
+
```shell
|
141 |
+
mkdir tora-13B-v1.0-GPTQ
|
142 |
+
huggingface-cli download TheBloke/tora-13B-v1.0-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir tora-13B-v1.0-GPTQ --local-dir-use-symlinks False
|
143 |
+
```
|
144 |
+
|
145 |
+
<details>
|
146 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
147 |
+
|
148 |
+
If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Huggingface cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
|
149 |
+
|
150 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
151 |
+
|
152 |
+
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
153 |
+
|
154 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
155 |
+
|
156 |
+
```shell
|
157 |
+
pip3 install hf_transfer
|
158 |
+
```
|
159 |
+
|
160 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
161 |
+
|
162 |
+
```shell
|
163 |
+
mkdir tora-13B-v1.0-GPTQ
|
164 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/tora-13B-v1.0-GPTQ --local-dir tora-13B-v1.0-GPTQ --local-dir-use-symlinks False
|
165 |
+
```
|
166 |
+
|
167 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
168 |
+
</details>
|
169 |
+
|
170 |
+
### With `git` (**not** recommended)
|
171 |
+
|
172 |
+
To clone a specific branch with `git`, use a command like this:
|
173 |
+
|
174 |
+
```shell
|
175 |
+
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/tora-13B-v1.0-GPTQ
|
176 |
+
```
|
177 |
+
|
178 |
+
Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
|
179 |
+
|
180 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
181 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
182 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
183 |
+
|
184 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
185 |
+
|
186 |
+
It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
|
187 |
+
|
188 |
+
1. Click the **Model tab**.
|
189 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/tora-13B-v1.0-GPTQ`.
|
190 |
+
- To download from a specific branch, enter for example `TheBloke/tora-13B-v1.0-GPTQ:gptq-4bit-32g-actorder_True`
|
191 |
+
- see Provided Files above for the list of branches for each option.
|
192 |
+
3. Click **Download**.
|
193 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
194 |
+
5. In the top left, click the refresh icon next to **Model**.
|
195 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `tora-13B-v1.0-GPTQ`
|
196 |
+
7. The model will automatically load, and is now ready for use!
|
197 |
+
8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
|
198 |
+
* Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
|
199 |
+
9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
|
200 |
+
|
201 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
202 |
+
|
203 |
+
<!-- README_GPTQ.md-use-from-tgi start -->
|
204 |
+
## Serving this model from Text Generation Inference (TGI)
|
205 |
+
|
206 |
+
It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
207 |
+
|
208 |
+
Example Docker parameters:
|
209 |
+
|
210 |
+
```shell
|
211 |
+
--model-id TheBloke/tora-13B-v1.0-GPTQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
212 |
+
```
|
213 |
+
|
214 |
+
Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
|
215 |
+
|
216 |
+
```shell
|
217 |
+
pip3 install huggingface-hub
|
218 |
+
```
|
219 |
+
|
220 |
+
```python
|
221 |
+
from huggingface_hub import InferenceClient
|
222 |
+
|
223 |
+
endpoint_url = "https://your-endpoint-url-here"
|
224 |
+
|
225 |
+
prompt = "Tell me about AI"
|
226 |
+
prompt_template=f'''<|user|>
|
227 |
+
{prompt}
|
228 |
+
<|assistant|>
|
229 |
+
'''
|
230 |
+
|
231 |
+
client = InferenceClient(endpoint_url)
|
232 |
+
response = client.text_generation(prompt,
|
233 |
+
max_new_tokens=128,
|
234 |
+
do_sample=True,
|
235 |
+
temperature=0.7,
|
236 |
+
top_p=0.95,
|
237 |
+
top_k=40,
|
238 |
+
repetition_penalty=1.1)
|
239 |
+
|
240 |
+
print(f"Model output: {response}")
|
241 |
+
```
|
242 |
+
<!-- README_GPTQ.md-use-from-tgi end -->
|
243 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
244 |
+
## How to use this GPTQ model from Python code
|
245 |
+
|
246 |
+
### Install the necessary packages
|
247 |
+
|
248 |
+
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
249 |
+
|
250 |
+
```shell
|
251 |
+
pip3 install transformers optimum
|
252 |
+
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
|
253 |
+
```
|
254 |
+
|
255 |
+
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
|
256 |
+
|
257 |
+
```shell
|
258 |
+
pip3 uninstall -y auto-gptq
|
259 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
260 |
+
cd AutoGPTQ
|
261 |
+
git checkout v0.4.2
|
262 |
+
pip3 install .
|
263 |
+
```
|
264 |
+
|
265 |
+
### You can then use the following code
|
266 |
+
|
267 |
+
```python
|
268 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
269 |
+
|
270 |
+
model_name_or_path = "TheBloke/tora-13B-v1.0-GPTQ"
|
271 |
+
# To use a different branch, change revision
|
272 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
273 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
274 |
+
device_map="auto",
|
275 |
+
trust_remote_code=False,
|
276 |
+
revision="main")
|
277 |
+
|
278 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
279 |
+
|
280 |
+
prompt = "Tell me about AI"
|
281 |
+
prompt_template=f'''<|user|>
|
282 |
+
{prompt}
|
283 |
+
<|assistant|>
|
284 |
+
'''
|
285 |
+
|
286 |
+
print("\n\n*** Generate:")
|
287 |
+
|
288 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
289 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
290 |
+
print(tokenizer.decode(output[0]))
|
291 |
+
|
292 |
+
# Inference can also be done using transformers' pipeline
|
293 |
+
|
294 |
+
print("*** Pipeline:")
|
295 |
+
pipe = pipeline(
|
296 |
+
"text-generation",
|
297 |
+
model=model,
|
298 |
+
tokenizer=tokenizer,
|
299 |
+
max_new_tokens=512,
|
300 |
+
do_sample=True,
|
301 |
+
temperature=0.7,
|
302 |
+
top_p=0.95,
|
303 |
+
top_k=40,
|
304 |
+
repetition_penalty=1.1
|
305 |
+
)
|
306 |
+
|
307 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
308 |
+
```
|
309 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
310 |
+
|
311 |
+
<!-- README_GPTQ.md-compatibility start -->
|
312 |
+
## Compatibility
|
313 |
+
|
314 |
+
The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
|
315 |
+
|
316 |
+
[ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
|
317 |
+
|
318 |
+
[Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
|
319 |
+
<!-- README_GPTQ.md-compatibility end -->
|
320 |
+
|
321 |
+
<!-- footer start -->
|
322 |
+
<!-- 200823 -->
|
323 |
+
## Discord
|
324 |
+
|
325 |
+
For further support, and discussions on these models and AI in general, join us at:
|
326 |
+
|
327 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
328 |
+
|
329 |
+
## Thanks, and how to contribute
|
330 |
+
|
331 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
332 |
+
|
333 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
334 |
+
|
335 |
+
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.
|
336 |
+
|
337 |
+
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.
|
338 |
+
|
339 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
340 |
+
|
341 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
342 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
343 |
+
|
344 |
+
**Special thanks to**: Aemon Algiz.
|
345 |
+
|
346 |
+
**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
|
347 |
+
|
348 |
+
|
349 |
+
Thank you to all my generous patrons and donaters!
|
350 |
+
|
351 |
+
And thank you again to a16z for their generous grant.
|
352 |
+
|
353 |
+
<!-- footer end -->
|
354 |
+
|
355 |
+
# Original model card: LLM-Agents's ToRA 13B v1.0
|
356 |
+
|
357 |
+
|
358 |
+
|
359 |
+
<h1 align="center">
|
360 |
+
ToRA: A Tool-Integrated Reasoning Agent <br> for Mathematical Problem Solving
|
361 |
+
</h1>
|
362 |
+
|
363 |
+
<p align="center">
|
364 |
+
<a href="https://microsoft.github.io/ToRA/"><b>[🌐 Website]</b></a> •
|
365 |
+
<a href="https://arxiv.org/abs/2309.17452"><b>[📜 Paper]</b></a> •
|
366 |
+
<a href="https://huggingface.co/llm-agents"><b>[🤗 HF Models]</b></a> •
|
367 |
+
<a href="https://github.com/microsoft/ToRA"><b>[🐱 GitHub]</b></a>
|
368 |
+
<br>
|
369 |
+
<a href="https://twitter.com/zhs05232838/status/1708860992631763092"><b>[🐦 Twitter]</b></a> •
|
370 |
+
<a href="https://www.reddit.com/r/LocalLLaMA/comments/1703k6d/tora_a_toolintegrated_reasoning_agent_for/"><b>[💬 Reddit]</b></a> •
|
371 |
+
<a href="https://notes.aimodels.fyi/researchers-announce-tora-training-language-models-to-better-understand-math-using-external-tools/">[🍀 Unofficial Blog]</a>
|
372 |
+
<!-- <a href="#-quick-start">Quick Start</a> • -->
|
373 |
+
<!-- <a href="#%EF%B8%8F-citation">Citation</a> -->
|
374 |
+
</p>
|
375 |
+
|
376 |
+
<p align="center">
|
377 |
+
Repo for "<a href="https://arxiv.org/abs/2309.17452" target="_blank">ToRA: A Tool-Integrated Reasoning Agent for Mathematical Problem Solving</a>"
|
378 |
+
</p>
|
379 |
+
|
380 |
+
## 🔥 News
|
381 |
+
|
382 |
+
- [2023/10/08] 🔥🔥🔥 All ToRA models released at [HuggingFace](https://huggingface.co/llm-agents)!!!
|
383 |
+
- [2023/09/29] ToRA paper, repo, and website released.
|
384 |
+
|
385 |
+
## 💡 Introduction
|
386 |
+
|
387 |
+
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.
|
388 |
+
|
389 |
+
| Model | Size | GSM8k | MATH | AVG@10 math tasks<sup>†</sup> |
|
390 |
+
|---|---|---|---|---|
|
391 |
+
| GPT-4 | - | 92.0 | 42.5 | 78.3 |
|
392 |
+
| GPT-4 (PAL) | - | 94.2 | 51.8 | 86.4 |
|
393 |
+
| [ToRA-7B](https://huggingface.co/llm-agents/tora-7b-v1.0) | 7B | 68.8 | 40.1 | 62.4|
|
394 |
+
| [ToRA-Code-7B](https://huggingface.co/llm-agents/tora-code-7b-v1.0) | 7B | 72.6 | 44.6 | 66.5|
|
395 |
+
| [ToRA-13B](https://huggingface.co/llm-agents/tora-13b-v1.0) | 13B | 72.7 | 43.0 | 65.9|
|
396 |
+
| [ToRA-Code-13B](https://huggingface.co/llm-agents/tora-code-13b-v1.0) | 13B | 75.8 | 48.1 | 71.3 |
|
397 |
+
| [ToRA-Code-34B<sup>*</sup>](https://huggingface.co/llm-agents/tora-code-34b-v1.0) | 34B | 80.7 | **51.0** | 74.8 |
|
398 |
+
| [ToRA-70B](https://huggingface.co/llm-agents/tora-70b-v1.0) | 70B | **84.3** | 49.7 | **76.9** |
|
399 |
+
|
400 |
+
- <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!
|
401 |
+
|
402 |
+
- <sup>†</sup>10 math tasks include GSM8k, MATH, GSM-Hard, SVAMP, TabMWP, ASDiv, SingleEQ, SingleOP, AddSub, and MultiArith.
|
403 |
+
|
404 |
+
|
405 |
+
## ⚡️ Training
|
406 |
+
|
407 |
+
The models are trained on ToRA-Corpus 16k, which contains tool-integrated reasoning trajectories of MATH and GSM8k from GPT-4.
|
408 |
+
|
409 |
+
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.
|
410 |
+
|
411 |
+
|
412 |
+
## 🪁 Inference & Evaluation
|
413 |
+
|
414 |
+
Please refer to ToRA's [GitHub repo](https://github.com/microsoft/ToRA) for inference, evaluation, and training code.
|
415 |
+
|
416 |
+
|
417 |
+
## ☕️ Citation
|
418 |
+
|
419 |
+
If you find this repository helpful, please consider citing our paper:
|
420 |
+
|
421 |
+
```
|
422 |
+
@misc{gou2023tora,
|
423 |
+
title={ToRA: A Tool-Integrated Reasoning Agent for Mathematical Problem Solving},
|
424 |
+
author={Zhibin Gou and Zhihong Shao and Yeyun Gong and yelong shen and Yujiu Yang and Minlie Huang and Nan Duan and Weizhu Chen},
|
425 |
+
year={2023},
|
426 |
+
eprint={2309.17452},
|
427 |
+
archivePrefix={arXiv},
|
428 |
+
primaryClass={cs.CL}
|
429 |
+
}
|
430 |
+
```
|