TheBloke commited on
Commit
439e442
1 Parent(s): e6a39f1

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +476 -0
README.md ADDED
@@ -0,0 +1,476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: meta-math/MetaMath-Mistral-7B
3
+ datasets:
4
+ - meta-math/MetaMathQA
5
+ inference: false
6
+ license: apache-2.0
7
+ model_creator: MetaMath
8
+ model_name: Metamath Mistral 7B
9
+ model_type: mistral
10
+ prompt_template: 'Below is an instruction that describes a task. Write a response
11
+ that appropriately completes the request.
12
+
13
+
14
+ ### Instruction:
15
+
16
+ {prompt}
17
+
18
+
19
+ ### Response:
20
+
21
+ '
22
+ quantized_by: TheBloke
23
+ ---
24
+ <!-- markdownlint-disable MD041 -->
25
+
26
+ <!-- header start -->
27
+ <!-- 200823 -->
28
+ <div style="width: auto; margin-left: auto; margin-right: auto">
29
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
30
+ </div>
31
+ <div style="display: flex; justify-content: space-between; width: 100%;">
32
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
34
+ </div>
35
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
36
+ <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>
37
+ </div>
38
+ </div>
39
+ <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>
40
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
41
+ <!-- header end -->
42
+
43
+ # Metamath Mistral 7B - GPTQ
44
+ - Model creator: [MetaMath](https://huggingface.co/meta-math)
45
+ - Original model: [Metamath Mistral 7B](https://huggingface.co/meta-math/MetaMath-Mistral-7B)
46
+
47
+ <!-- description start -->
48
+ ## Description
49
+
50
+ This repo contains GPTQ model files for [MetaMath's Metamath Mistral 7B](https://huggingface.co/meta-math/MetaMath-Mistral-7B).
51
+
52
+ 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.
53
+
54
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
55
+
56
+ <!-- description end -->
57
+ <!-- repositories-available start -->
58
+ ## Repositories available
59
+
60
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-AWQ)
61
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ)
62
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GGUF)
63
+ * [MetaMath's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/meta-math/MetaMath-Mistral-7B)
64
+ <!-- repositories-available end -->
65
+
66
+ <!-- prompt-template start -->
67
+ ## Prompt template: Alpaca
68
+
69
+ ```
70
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
71
+
72
+ ### Instruction:
73
+ {prompt}
74
+
75
+ ### Response:
76
+
77
+ ```
78
+
79
+ <!-- prompt-template end -->
80
+
81
+
82
+
83
+ <!-- README_GPTQ.md-compatible clients start -->
84
+ ## Known compatible clients / servers
85
+
86
+ These GPTQ models are known to work in the following inference servers/webuis.
87
+
88
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
89
+ - [KobaldAI United](https://github.com/henk717/koboldai)
90
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
91
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
92
+
93
+ This may not be a complete list; if you know of others, please let me know!
94
+ <!-- README_GPTQ.md-compatible clients end -->
95
+
96
+ <!-- README_GPTQ.md-provided-files start -->
97
+ ## Provided files, and GPTQ parameters
98
+
99
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
100
+
101
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
102
+
103
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
104
+
105
+ <details>
106
+ <summary>Explanation of GPTQ parameters</summary>
107
+
108
+ - Bits: The bit size of the quantised model.
109
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
110
+ - 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.
111
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
112
+ - 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).
113
+ - 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.
114
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
115
+
116
+ </details>
117
+
118
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
119
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
120
+ | [main](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 4.16 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
121
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 4.57 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
122
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.52 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
123
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.68 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
124
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 8.17 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
125
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 4.29 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
126
+
127
+ <!-- README_GPTQ.md-provided-files end -->
128
+
129
+ <!-- README_GPTQ.md-download-from-branches start -->
130
+ ## How to download, including from branches
131
+
132
+ ### In text-generation-webui
133
+
134
+ To download from the `main` branch, enter `TheBloke/MetaMath-Mistral-7B-GPTQ` in the "Download model" box.
135
+
136
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/MetaMath-Mistral-7B-GPTQ:gptq-4bit-32g-actorder_True`
137
+
138
+ ### From the command line
139
+
140
+ I recommend using the `huggingface-hub` Python library:
141
+
142
+ ```shell
143
+ pip3 install huggingface-hub
144
+ ```
145
+
146
+ To download the `main` branch to a folder called `MetaMath-Mistral-7B-GPTQ`:
147
+
148
+ ```shell
149
+ mkdir MetaMath-Mistral-7B-GPTQ
150
+ huggingface-cli download TheBloke/MetaMath-Mistral-7B-GPTQ --local-dir MetaMath-Mistral-7B-GPTQ --local-dir-use-symlinks False
151
+ ```
152
+
153
+ To download from a different branch, add the `--revision` parameter:
154
+
155
+ ```shell
156
+ mkdir MetaMath-Mistral-7B-GPTQ
157
+ huggingface-cli download TheBloke/MetaMath-Mistral-7B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir MetaMath-Mistral-7B-GPTQ --local-dir-use-symlinks False
158
+ ```
159
+
160
+ <details>
161
+ <summary>More advanced huggingface-cli download usage</summary>
162
+
163
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face 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.
164
+
165
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
166
+
167
+ 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).
168
+
169
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
170
+
171
+ ```shell
172
+ pip3 install hf_transfer
173
+ ```
174
+
175
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
176
+
177
+ ```shell
178
+ mkdir MetaMath-Mistral-7B-GPTQ
179
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/MetaMath-Mistral-7B-GPTQ --local-dir MetaMath-Mistral-7B-GPTQ --local-dir-use-symlinks False
180
+ ```
181
+
182
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
183
+ </details>
184
+
185
+ ### With `git` (**not** recommended)
186
+
187
+ To clone a specific branch with `git`, use a command like this:
188
+
189
+ ```shell
190
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/MetaMath-Mistral-7B-GPTQ
191
+ ```
192
+
193
+ 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.)
194
+
195
+ <!-- README_GPTQ.md-download-from-branches end -->
196
+ <!-- README_GPTQ.md-text-generation-webui start -->
197
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
198
+
199
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
200
+
201
+ 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.
202
+
203
+ 1. Click the **Model tab**.
204
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/MetaMath-Mistral-7B-GPTQ`.
205
+
206
+ - To download from a specific branch, enter for example `TheBloke/MetaMath-Mistral-7B-GPTQ:gptq-4bit-32g-actorder_True`
207
+ - see Provided Files above for the list of branches for each option.
208
+
209
+ 3. Click **Download**.
210
+ 4. The model will start downloading. Once it's finished it will say "Done".
211
+ 5. In the top left, click the refresh icon next to **Model**.
212
+ 6. In the **Model** dropdown, choose the model you just downloaded: `MetaMath-Mistral-7B-GPTQ`
213
+ 7. The model will automatically load, and is now ready for use!
214
+ 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.
215
+
216
+ - 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`.
217
+
218
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
219
+
220
+ <!-- README_GPTQ.md-text-generation-webui end -->
221
+
222
+ <!-- README_GPTQ.md-use-from-tgi start -->
223
+ ## Serving this model from Text Generation Inference (TGI)
224
+
225
+ 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`
226
+
227
+ Example Docker parameters:
228
+
229
+ ```shell
230
+ --model-id TheBloke/MetaMath-Mistral-7B-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
231
+ ```
232
+
233
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
234
+
235
+ ```shell
236
+ pip3 install huggingface-hub
237
+ ```
238
+
239
+ ```python
240
+ from huggingface_hub import InferenceClient
241
+
242
+ endpoint_url = "https://your-endpoint-url-here"
243
+
244
+ prompt = "Tell me about AI"
245
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
246
+
247
+ ### Instruction:
248
+ {prompt}
249
+
250
+ ### Response:
251
+ '''
252
+
253
+ client = InferenceClient(endpoint_url)
254
+ response = client.text_generation(prompt,
255
+ max_new_tokens=128,
256
+ do_sample=True,
257
+ temperature=0.7,
258
+ top_p=0.95,
259
+ top_k=40,
260
+ repetition_penalty=1.1)
261
+
262
+ print(f"Model output: {response}")
263
+ ```
264
+ <!-- README_GPTQ.md-use-from-tgi end -->
265
+ <!-- README_GPTQ.md-use-from-python start -->
266
+ ## How to use this GPTQ model from Python code
267
+
268
+ ### Install the necessary packages
269
+
270
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
271
+
272
+ ```shell
273
+ pip3 install transformers optimum
274
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
275
+ ```
276
+
277
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
278
+
279
+ ```shell
280
+ pip3 uninstall -y auto-gptq
281
+ git clone https://github.com/PanQiWei/AutoGPTQ
282
+ cd AutoGPTQ
283
+ git checkout v0.4.2
284
+ pip3 install .
285
+ ```
286
+
287
+ ### You can then use the following code
288
+
289
+ ```python
290
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
291
+
292
+ model_name_or_path = "TheBloke/MetaMath-Mistral-7B-GPTQ"
293
+ # To use a different branch, change revision
294
+ # For example: revision="gptq-4bit-32g-actorder_True"
295
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
296
+ device_map="auto",
297
+ trust_remote_code=False,
298
+ revision="main")
299
+
300
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
301
+
302
+ prompt = "Tell me about AI"
303
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
304
+
305
+ ### Instruction:
306
+ {prompt}
307
+
308
+ ### Response:
309
+ '''
310
+
311
+ print("\n\n*** Generate:")
312
+
313
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
314
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
315
+ print(tokenizer.decode(output[0]))
316
+
317
+ # Inference can also be done using transformers' pipeline
318
+
319
+ print("*** Pipeline:")
320
+ pipe = pipeline(
321
+ "text-generation",
322
+ model=model,
323
+ tokenizer=tokenizer,
324
+ max_new_tokens=512,
325
+ do_sample=True,
326
+ temperature=0.7,
327
+ top_p=0.95,
328
+ top_k=40,
329
+ repetition_penalty=1.1
330
+ )
331
+
332
+ print(pipe(prompt_template)[0]['generated_text'])
333
+ ```
334
+ <!-- README_GPTQ.md-use-from-python end -->
335
+
336
+ <!-- README_GPTQ.md-compatibility start -->
337
+ ## Compatibility
338
+
339
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
340
+
341
+ [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.
342
+
343
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
344
+ <!-- README_GPTQ.md-compatibility end -->
345
+
346
+ <!-- footer start -->
347
+ <!-- 200823 -->
348
+ ## Discord
349
+
350
+ For further support, and discussions on these models and AI in general, join us at:
351
+
352
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
353
+
354
+ ## Thanks, and how to contribute
355
+
356
+ Thanks to the [chirper.ai](https://chirper.ai) team!
357
+
358
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
359
+
360
+ 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.
361
+
362
+ 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.
363
+
364
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
365
+
366
+ * Patreon: https://patreon.com/TheBlokeAI
367
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
368
+
369
+ **Special thanks to**: Aemon Algiz.
370
+
371
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
372
+
373
+
374
+ Thank you to all my generous patrons and donaters!
375
+
376
+ And thank you again to a16z for their generous grant.
377
+
378
+ <!-- footer end -->
379
+
380
+ # Original model card: MetaMath's Metamath Mistral 7B
381
+
382
+ see our paper in https://arxiv.org/abs/2309.12284
383
+
384
+ View the project page:
385
+ https://meta-math.github.io/
386
+
387
+ ## Model Details
388
+
389
+ MetaMath-Mistral-7B is fully fine-tuned on the MetaMathQA datasets and based on the powerful Mistral-7B model. It is glad to see using MetaMathQA datasets and change the base model from llama-2-7B to Mistral-7b can boost the GSM8K performance from 66.5 to **77.7**.
390
+
391
+ To fine-tune Mistral-7B, I would suggest using a smaller learning rate (usually 1/5 to 1/10 of the lr for LlaMa-2-7B) and staying other training args unchanged.
392
+ More training details and scripts can be seen at https://github.com/meta-math/MetaMath
393
+
394
+ ## Installation
395
+
396
+ ```
397
+ pip install transformers==4.35.0
398
+ pip instal torch==2.0.1
399
+ pip instal sentencepiece==0.1.99
400
+ pip instal tokenizers==0.13.3
401
+ pip instal accelerate==0.21.0
402
+ pip instal bitsandbytes==0.40.0
403
+ pip instal vllm
404
+ pip instal fraction
405
+ pip install protobuf
406
+ ```
407
+
408
+ ## Model Usage
409
+
410
+ prompting template:
411
+
412
+ '''
413
+
414
+ "Below is an instruction that describes a task. "
415
+ "Write a response that appropriately completes the request.\n\n"
416
+ "### Instruction:\n{instruction}\n\n### Response: Let's think step by step."
417
+
418
+ '''
419
+
420
+ where you need to use your query question to replace the {instruction}
421
+
422
+ There is another interesting repo about Arithmo-Mistral-7B in https://huggingface.co/akjindal53244/Arithmo-Mistral-7B, where they combine our MetaMathQA dataset and MathInstruct datasets to train a powerful model. Thanks agian for their contributions.
423
+ We would also try to train the combination of **MetaMathQA** and **MathInstruct** datasets, and also open all the results and training details.
424
+
425
+ ## Experiments
426
+
427
+ | Model | GSM8k Pass@1 | MATH Pass@1 |
428
+ |---------------------|--------------|-------------|
429
+ | MPT-7B | 6.8 | 3.0 |
430
+ | Falcon-7B | 6.8 | 2.3 |
431
+ | LLaMA-1-7B | 11.0 | 2.9 |
432
+ | LLaMA-2-7B | 14.6 | 2.5 |
433
+ | MPT-30B | 15.2 | 3.1 |
434
+ | LLaMA-1-13B | 17.8 | 3.9 |
435
+ | GPT-Neo-2.7B | 19.5 | -- |
436
+ | Falcon-40B | 19.6 | 2.5 |
437
+ | Baichuan-chat-13B | 23.9 | -- |
438
+ | Vicuna-v1.3-13B | 27.6 | -- |
439
+ | LLaMA-2-13B | 28.7 | 3.9 |
440
+ | InternLM-7B | 31.2 | -- |
441
+ | ChatGLM-2-6B | 32.4 | -- |
442
+ | GPT-J-6B | 34.9 | -- |
443
+ | LLaMA-1-33B | 35.6 | 3.9 |
444
+ | LLaMA-2-34B | 42.2 | 6.24 |
445
+ | RFT-7B | 50.3 | -- |
446
+ | LLaMA-1-65B | 50.9 | 10.6 |
447
+ | Qwen-7B | 51.6 | -- |
448
+ | WizardMath-7B | 54.9 | 10.7 |
449
+ | LLaMA-2-70B | 56.8 | 13.5 |
450
+ | WizardMath-13B | 63.9 | 14.0 |
451
+ | MAmmoTH-7B (COT) | 50.5 | 10.4 |
452
+ | MAmmoTH-7B (POT+COT)| 53.6 | 31.5 |
453
+ | Arithmo-Mistral-7B | 74.7 | 25.3 |
454
+ | MetaMath-7B | 66.5 | 19.8 |
455
+ | MetaMath-13B | 72.3 | 22.4 |
456
+ | 🔥 **MetaMath-Mistral-7B** | **77.7** | **28.2** |
457
+
458
+ ## Citation
459
+
460
+ ```bibtex
461
+ @article{yu2023metamath,
462
+ title={MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Models},
463
+ author={Yu, Longhui and Jiang, Weisen and Shi, Han and Yu, Jincheng and Liu, Zhengying and Zhang, Yu and Kwok, James T and Li, Zhenguo and Weller, Adrian and Liu, Weiyang},
464
+ journal={arXiv preprint arXiv:2309.12284},
465
+ year={2023}
466
+ }
467
+ ```
468
+
469
+ ```bibtex
470
+ @article{jiang2023mistral,
471
+ title={Mistral 7B},
472
+ author={Jiang, Albert Q and Sablayrolles, Alexandre and Mensch, Arthur and Bamford, Chris and Chaplot, Devendra Singh and Casas, Diego de las and Bressand, Florian and Lengyel, Gianna and Lample, Guillaume and Saulnier, Lucile and others},
473
+ journal={arXiv preprint arXiv:2310.06825},
474
+ year={2023}
475
+ }
476
+ ```