TheBloke commited on
Commit
516aa5a
1 Parent(s): fffab7a

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +869 -0
README.md ADDED
@@ -0,0 +1,869 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: jondurbin/airoboros-m-7b-3.1
3
+ datasets:
4
+ - jondurbin/airoboros-3.1
5
+ inference: false
6
+ license: apache-2.0
7
+ model_creator: Jon Durbin
8
+ model_name: Airoboros M 7B 3.1
9
+ model_type: mistral
10
+ prompt_template: '[INST] <<SYS>>
11
+
12
+ You are a helpful, respectful and honest assistant. Always answer as helpfully as
13
+ possible, while being safe. Your answers should not include any harmful, unethical,
14
+ racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses
15
+ are socially unbiased and positive in nature. If a question does not make any sense,
16
+ or is not factually coherent, explain why instead of answering something not correct.
17
+ If you don''t know the answer to a question, please don''t share false information.
18
+
19
+ <</SYS>>
20
+
21
+ {prompt}[/INST]
22
+
23
+ '
24
+ quantized_by: TheBloke
25
+ ---
26
+
27
+ <!-- header start -->
28
+ <!-- 200823 -->
29
+ <div style="width: auto; margin-left: auto; margin-right: auto">
30
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
31
+ </div>
32
+ <div style="display: flex; justify-content: space-between; width: 100%;">
33
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
34
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
35
+ </div>
36
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
37
+ <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>
38
+ </div>
39
+ </div>
40
+ <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>
41
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
42
+ <!-- header end -->
43
+
44
+ # Airoboros M 7B 3.1 - GPTQ
45
+ - Model creator: [Jon Durbin](https://huggingface.co/jondurbin)
46
+ - Original model: [Airoboros M 7B 3.1](https://huggingface.co/jondurbin/airoboros-m-7b-3.1)
47
+
48
+ <!-- description start -->
49
+ ## Description
50
+
51
+ This repo contains GPTQ model files for [Jon Durbin's Airoboros M 7B 3.1](https://huggingface.co/jondurbin/airoboros-m-7b-3.1).
52
+
53
+ 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.
54
+
55
+ <!-- description end -->
56
+ <!-- repositories-available start -->
57
+ ## Repositories available
58
+
59
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-AWQ)
60
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ)
61
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GGUF)
62
+ * [Jon Durbin's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/jondurbin/airoboros-m-7b-3.1)
63
+ <!-- repositories-available end -->
64
+
65
+ <!-- prompt-template start -->
66
+ ## Prompt template: Llama-2-Chat
67
+
68
+ ```
69
+ [INST] <<SYS>>
70
+ You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
71
+ <</SYS>>
72
+ {prompt}[/INST]
73
+
74
+ ```
75
+
76
+ <!-- prompt-template end -->
77
+
78
+
79
+ <!-- README_GPTQ.md-provided-files start -->
80
+ ## Provided files, and GPTQ parameters
81
+
82
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
83
+
84
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
85
+
86
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
87
+
88
+ <details>
89
+ <summary>Explanation of GPTQ parameters</summary>
90
+
91
+ - Bits: The bit size of the quantised model.
92
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
93
+ - 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.
94
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
95
+ - 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).
96
+ - 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.
97
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
98
+
99
+ </details>
100
+
101
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
102
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
103
+ | [main](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 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. |
104
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.57 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
105
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.52 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
106
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.68 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
107
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 8.17 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
108
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 4.29 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
109
+
110
+ <!-- README_GPTQ.md-provided-files end -->
111
+
112
+ <!-- README_GPTQ.md-download-from-branches start -->
113
+ ## How to download, including from branches
114
+
115
+ ### In text-generation-webui
116
+
117
+ To download from the `main` branch, enter `TheBloke/Airoboros-M-7B-3.1-GPTQ` in the "Download model" box.
118
+
119
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Airoboros-M-7B-3.1-GPTQ:gptq-4bit-32g-actorder_True`
120
+
121
+ ### From the command line
122
+
123
+ I recommend using the `huggingface-hub` Python library:
124
+
125
+ ```shell
126
+ pip3 install huggingface-hub
127
+ ```
128
+
129
+ To download the `main` branch to a folder called `Airoboros-M-7B-3.1-GPTQ`:
130
+
131
+ ```shell
132
+ mkdir Airoboros-M-7B-3.1-GPTQ
133
+ huggingface-cli download TheBloke/Airoboros-M-7B-3.1-GPTQ --local-dir Airoboros-M-7B-3.1-GPTQ --local-dir-use-symlinks False
134
+ ```
135
+
136
+ To download from a different branch, add the `--revision` parameter:
137
+
138
+ ```shell
139
+ mkdir Airoboros-M-7B-3.1-GPTQ
140
+ huggingface-cli download TheBloke/Airoboros-M-7B-3.1-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Airoboros-M-7B-3.1-GPTQ --local-dir-use-symlinks False
141
+ ```
142
+
143
+ <details>
144
+ <summary>More advanced huggingface-cli download usage</summary>
145
+
146
+ 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.
147
+
148
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
149
+
150
+ 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).
151
+
152
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
153
+
154
+ ```shell
155
+ pip3 install hf_transfer
156
+ ```
157
+
158
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
159
+
160
+ ```shell
161
+ mkdir Airoboros-M-7B-3.1-GPTQ
162
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Airoboros-M-7B-3.1-GPTQ --local-dir Airoboros-M-7B-3.1-GPTQ --local-dir-use-symlinks False
163
+ ```
164
+
165
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
166
+ </details>
167
+
168
+ ### With `git` (**not** recommended)
169
+
170
+ To clone a specific branch with `git`, use a command like this:
171
+
172
+ ```shell
173
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Airoboros-M-7B-3.1-GPTQ
174
+ ```
175
+
176
+ 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.)
177
+
178
+ <!-- README_GPTQ.md-download-from-branches end -->
179
+ <!-- README_GPTQ.md-text-generation-webui start -->
180
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
181
+
182
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
183
+
184
+ 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.
185
+
186
+ 1. Click the **Model tab**.
187
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Airoboros-M-7B-3.1-GPTQ`.
188
+ - To download from a specific branch, enter for example `TheBloke/Airoboros-M-7B-3.1-GPTQ:gptq-4bit-32g-actorder_True`
189
+ - see Provided Files above for the list of branches for each option.
190
+ 3. Click **Download**.
191
+ 4. The model will start downloading. Once it's finished it will say "Done".
192
+ 5. In the top left, click the refresh icon next to **Model**.
193
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Airoboros-M-7B-3.1-GPTQ`
194
+ 7. The model will automatically load, and is now ready for use!
195
+ 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.
196
+ * 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`.
197
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
198
+
199
+ <!-- README_GPTQ.md-text-generation-webui end -->
200
+
201
+ <!-- README_GPTQ.md-use-from-tgi start -->
202
+ ## Serving this model from Text Generation Inference (TGI)
203
+
204
+ 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`
205
+
206
+ Example Docker parameters:
207
+
208
+ ```shell
209
+ --model-id TheBloke/Airoboros-M-7B-3.1-GPTQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
210
+ ```
211
+
212
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
213
+
214
+ ```shell
215
+ pip3 install huggingface-hub
216
+ ```
217
+
218
+ ```python
219
+ from huggingface_hub import InferenceClient
220
+
221
+ endpoint_url = "https://your-endpoint-url-here"
222
+
223
+ prompt = "Tell me about AI"
224
+ prompt_template=f'''[INST] <<SYS>>
225
+ You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
226
+ <</SYS>>
227
+ {prompt}[/INST]
228
+ '''
229
+
230
+ client = InferenceClient(endpoint_url)
231
+ response = client.text_generation(prompt,
232
+ max_new_tokens=128,
233
+ do_sample=True,
234
+ temperature=0.7,
235
+ top_p=0.95,
236
+ top_k=40,
237
+ repetition_penalty=1.1)
238
+
239
+ print(f"Model output: {response}")
240
+ ```
241
+ <!-- README_GPTQ.md-use-from-tgi end -->
242
+ <!-- README_GPTQ.md-use-from-python start -->
243
+ ## How to use this GPTQ model from Python code
244
+
245
+ ### Install the necessary packages
246
+
247
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
248
+
249
+ ```shell
250
+ pip3 install transformers optimum
251
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
252
+ ```
253
+
254
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
255
+
256
+ ```shell
257
+ pip3 uninstall -y auto-gptq
258
+ git clone https://github.com/PanQiWei/AutoGPTQ
259
+ cd AutoGPTQ
260
+ git checkout v0.4.2
261
+ pip3 install .
262
+ ```
263
+
264
+ ### You can then use the following code
265
+
266
+ ```python
267
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
268
+
269
+ model_name_or_path = "TheBloke/Airoboros-M-7B-3.1-GPTQ"
270
+ # To use a different branch, change revision
271
+ # For example: revision="gptq-4bit-32g-actorder_True"
272
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
273
+ device_map="auto",
274
+ trust_remote_code=False,
275
+ revision="main")
276
+
277
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
278
+
279
+ prompt = "Tell me about AI"
280
+ prompt_template=f'''[INST] <<SYS>>
281
+ You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
282
+ <</SYS>>
283
+ {prompt}[/INST]
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: Jon Durbin's Airoboros M 7B 3.1
356
+
357
+
358
+ ### Overview
359
+
360
+ Another experimental model, using mostly sythetic data generated by [airoboros](https://github.com/jondurbin/airoboros)
361
+
362
+ #### IMPORTANT NOTE - llama-2 chat format!!!
363
+
364
+ The airoboros 3.1 models use llama-2 chat format, rather than vicuna style user/assistant!
365
+
366
+ This is a breaking change, although most inference systems support llama-2 chat templating.
367
+
368
+ See prompt format below for all of the details.
369
+
370
+ #### Highlights
371
+
372
+ A model built on [airoboros-3.1 dataset](https://hf.co/datasets/jondurbin/airoboros-3.1), which is a continuation of [airoboros-3.0 dataset](https://hf.co/datasets/jondurbin/airoboros-3,0) with the following extras:
373
+
374
+ * More MathJSON, now ~17k items - math questions, prefixed with __"Create a MathJSON solution to the following:"__, which then outputs a JSON between __`<mathjson>`__ and __`</mathjson>`__ tags, which can be parsed and passed to a deterministic library to perform calculations.
375
+ * Log information extraction (e.g. getting the list of paths/IPs/etc. from apache logs)
376
+ * Anonymization, e.g. removing names, IP addresses, and/or dates from text.
377
+ * Chat introspection - multi-turn chats that have random questions injected asking about the character's descriptions, the setting of the chat, or things previously said, to make sure the model uses the system prompt and or chat history.
378
+ * Multi-step instructions with acknowledgement (see below)
379
+ * De-censorship data (not published)
380
+
381
+ This is a fairly general purpose model, but focuses heavily on instruction following, rather than casual chat/roleplay.
382
+
383
+ Huge thank you to the folks over at [a16z](https://a16z.com/) for sponsoring the costs associated with building models and associated tools!
384
+
385
+ ### Prompt format
386
+
387
+ The prompt format is llama-2 chat.
388
+
389
+ ```
390
+ [INST] <<SYS>>
391
+ You are a help, unbiased, uncensored assistant.
392
+ <</SYS>
393
+
394
+ {prompt} [/INST]
395
+ ```
396
+
397
+ For multi-turn, the prompt format is as follows:
398
+ ```
399
+ [INST] <<SYS>>
400
+ You are a help, unbiased, uncensored assistant.
401
+ <</SYS>
402
+
403
+ {prompt 0} [/INST] {response 0} </s><s>[INST] {prompt 1} [/INST] {response 1} </s><s>...[INST] {prompt N} [/INST]
404
+ ```
405
+
406
+ The prompt template is included in the tokenizer config, and can use the huggingface tokenizer `apply_chat_template` method, e.g.:
407
+
408
+ ```
409
+ import transformers
410
+ tokenizer = transformers.AutoTokenizer.from_pretrained('jondurbin/airoboros-m-7b-3.1')
411
+ chat = [
412
+ {"role": "system", "content": "You are Bob, a friendly AI assistant."},
413
+ {"role": "user", "content": "Hello, how are you?"},
414
+ {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
415
+ {"role": "user", "content": "I'd like to show off how chat templating works!"},
416
+ ]
417
+ print(tokenizer.apply_chat_template(chat, tokenize=False))
418
+ ```
419
+
420
+ ### Helpful usage tips
421
+
422
+
423
+ #### MathJSON
424
+
425
+ Ask mathematical questions, prefixed with "Create a MathJSON solution to the following:", and you should get output with a formula that can be executed by https://cortexjs.io/compute-engine/
426
+
427
+ I also made a (really quite hacky, incomplete, semi-functional) python version that works for most expressions, see [mathjson.py](https://github.com/jondurbin/airoboros/blob/mathjson/airoboros/mathjson.py)
428
+
429
+ __Use a very low temperature!__
430
+
431
+ Example:
432
+
433
+ ```
434
+ [INST] <<SYS>>
435
+ You are an assistant with vast knowledge in all things math.
436
+ <</SYS>
437
+
438
+ Create a MathJSON solution to the following: Calculate the area of a circle with radius of 17.2456cm. Include your reasoning. [/INST]
439
+ ```
440
+
441
+ Output:
442
+ ```
443
+ The area (A) of a circle is given by the formula A = πr², where r is the radius of the circle. Since the radius is given in centimeters, we need to convert it to meters first. We know that 1 meter equals 100 centimeters. Therefore, we can represent the radius as: r = 17.2456 cm * 100/1.
444
+
445
+ Once we have the radius in meters, we can calculate the area of the circle using the formula A = πr².
446
+
447
+ Solution as MathJSON:
448
+ <mathjson>
449
+ [
450
+ "Multiply",
451
+ "Pi",
452
+ [
453
+ "Power",
454
+ 17.2456,
455
+ 2
456
+ ]
457
+ ]
458
+ </mathjson>
459
+ ```
460
+
461
+ You can then validate the JSON between `<mathjson>` and `</mathjson>`, then pass the parsed JSON to compute-engine JS or the `evaluate` function in mathjson.py to calculate the response.
462
+
463
+ #### Context obedient question answering
464
+
465
+ By obedient, I mean the model was trained to ignore what it thinks it knows, and uses the context to answer the question. The model was also tuned to limit the values to the provided context as much as possible to reduce hallucinations.
466
+
467
+ The format for a closed-context prompt is as follows:
468
+ ```
469
+ BEGININPUT
470
+ BEGINCONTEXT
471
+ [key0: value0]
472
+ [key1: value1]
473
+ ... other metdata ...
474
+ ENDCONTEXT
475
+ [insert your text blocks here]
476
+ ENDINPUT
477
+ [add as many other blocks, in the exact same format]
478
+ BEGININSTRUCTION
479
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
480
+ ENDINSTRUCTION
481
+ ```
482
+
483
+ It's also helpful to add "Don't make up answers if you don't know." to your instruction block to make sure if the context is completely unrelated it doesn't make something up.
484
+
485
+ *The __only__ prompts that need this closed context formating are closed-context instructions. Normal questions/instructions do not!*
486
+
487
+ I know it's a bit verbose and annoying, but after much trial and error, using these explicit delimiters helps the model understand where to find the responses and how to associate specific sources with it.
488
+ - `BEGININPUT` - denotes a new input block
489
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
490
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
491
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
492
+ - `ENDINPUT` - denotes the end of the current input block
493
+ - [repeat as many input blocks in this format as you want]
494
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
495
+ - [instruction(s)]
496
+ - `ENDINSTRUCTION` - denotes the end of instruction set
497
+
498
+ It sometimes works without `ENDINSTRUCTION`, but by explicitly including that in the prompt, the model better understands that all of the instructions in the block should be responded to.
499
+
500
+ __Use a very low temperature!__
501
+
502
+ Here's a trivial, but important example to prove the point:
503
+ ```
504
+ BEGININPUT
505
+ BEGINCONTEXT
506
+ date: 2021-01-01
507
+ url: https://web.site/123
508
+ ENDCONTEXT
509
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
510
+ ENDINPUT
511
+ BEGININSTRUCTION
512
+ What color are bluberries? Source?
513
+ ENDINSTRUCTION
514
+ ```
515
+
516
+ And the response:
517
+ ```
518
+ Blueberries are now green.
519
+ Source:
520
+ date: 2021-01-01
521
+ url: https://web.site/123
522
+ ```
523
+
524
+ #### Summarization
525
+
526
+ 500 samples have been included from [this dataset](https://huggingface.co/datasets/mattpscott/airoboros-summarization), using the same format as contextual question answering, for example:
527
+
528
+ ```
529
+ BEGININPUT
530
+ {text to summarize}
531
+ ENDINPUT
532
+ BEGININSTRUCTION
533
+ Summarize the input in around 130 words.
534
+ ENDINSTRUCTION
535
+ ```
536
+
537
+ #### Getting longer responses
538
+
539
+ You can use a few techniques to get longer responses.
540
+
541
+ Detailed prompts, with explicit instruction for word count:
542
+ ```
543
+ Please compose a narrative set in the heart of an ancient library, steeped in the scent of old parchment and ink. The protagonist should be a young scholar who is dedicated to studying the art of storytelling and its evolution throughout history. In her pursuit of knowledge, she stumbles upon a forgotten tome that seems to possess an unusual aura. This book has the ability to bring stories to life, literally manifesting characters and scenarios from within its pages into reality.
544
+
545
+ The main character must navigate through various epochs of storytelling - from oral traditions of tribal societies, through medieval minstrels' tales, to modern-day digital narratives - as they come alive around her. Each era presents its unique challenges and lessons about the power and impact of stories on human civilization.
546
+
547
+ One such character could be a sentient quill pen, who was once used by renowned authors of yesteryears and now holds their wisdom and experiences. It becomes her mentor, guiding her through this journey with witty remarks and insightful commentary.
548
+
549
+ Ensure that your tale encapsulates the thrill of adventure, the beauty of learning, and the profound connection between humans and their stories. All characters involved should be non-human entities. Feel free to explore creative liberties but maintain the mentioned elements.
550
+
551
+ Your response should be approximately 2300 words.
552
+ ```
553
+
554
+ Or, a simpler example:
555
+ ```
556
+ Please create a long, detailed story about a dragon in an old growth forest who, for some reason, begins speaking the words of the source code of linux.
557
+ ```
558
+
559
+ There are a few examples of next chapter completion as well, e.g.:
560
+ ```
561
+ Write the next chapter of a historical fiction novel set in Paris during the 20th century.
562
+
563
+ Here's a summary of the previous chapter:
564
+ In the vibrant city of Paris, amid the tumultuous changes of the 20th century, our protagonist Margot, an aspiring fashion designer, has just secured an apprenticeship at a prestigious couture house. She meets Lucien, a charming journalist who covers the fashion industry. Together they navigate the ever-changing world of fashion and society, uncovering secrets that reveal the intricate links between style, politics, and culture. As the chapter concludes, they decide to delve deeper into the hidden corners of the fashion world to unravel its mysteries.
565
+
566
+ Requirements for the next chapter:
567
+
568
+ 1. Character Development of Margot and Lucien:
569
+ - Margot's Evolution: Unfold more about Margot's past, her dreams of revolutionizing fashion, and her struggle to establish herself in a male-dominated industry. Illustrate her growing expertise, innovative ideas, and increasing dependence on Lucien.
570
+ - Lucien's Complexity: Introduce uncertainties surrounding Lucien's background and real motives. Increase suspense by suggesting undisclosed information he possesses, while also highlighting his wit and perceptiveness.
571
+
572
+ 2. Exploration of Paris and the Couture House:
573
+ - Paris: Elaborate their journey through the bustling streets of Paris, including encounters with iconic figures, social unrest, and relics from different eras of French history.
574
+ - The Couture House: Expand on the grandeur of the couture house they work in, filled with artistic masterpieces, intense competition, and cryptic notes hinting at a scandalous past.
575
+
576
+ 3. Emergence of the Subplot: The Lost Collection:
577
+ - Discovery: Have Margot and Lucien stumble upon a secret vault containing a lost collection designed before World War II, raising new questions about the previous owner and the influence of war on fashion.
578
+ - Revelation: Capture their shock as they realize the designs were plagiarized, the potential repercussions, and the opportunities it presents for Margot's career.
579
+ - Twist: End with a twist that suggests there are other stolen collections across Paris, setting up their new mission.
580
+
581
+
582
+ Your response should be approximately 650 words.
583
+ ```
584
+
585
+ #### Coding
586
+
587
+ You can ask for fairly complex coding instructions with multiple criteria, e.g.:
588
+
589
+ ```
590
+ Create a python application with the following requirements:
591
+ - Asyncio FastAPI webserver
592
+ - ping endpoint that returns the current date in JSON format
593
+ - file upload endpoint, which calculates the file's sha256 checksum, and checks postgres to deduplicate
594
+ ```
595
+
596
+ Or inline criteria:
597
+
598
+ ```
599
+ Write a multi-threaded TCP server in C that accepts a "GET [key]" input and "SET [key] [value]" input, and uses a binary tree to get and store the input values.
600
+ ```
601
+
602
+ You can also optionally add a single space and "PLAINFORMAT" at the end of your prompt to avoid backticks, explanations, etc. and just print the code, e.g.:
603
+
604
+ ```
605
+ Write a websocket application in node.js. PLAINFORMAT
606
+ ```
607
+
608
+ #### Agent/function calling
609
+
610
+ The dataset includes many examples of function/args generation based on input criteria. This is somewhat similar to the OpenAI function calling, but the output is either JSON or YAML.
611
+
612
+ Example prompt:
613
+ ```
614
+ As an AI assistant, please select the most suitable function and parameters from the list of available functions below, based on the user's input. Provide your response in JSON format.
615
+
616
+ Input: I want to know how many times 'Python' is mentioned in my text file.
617
+
618
+ Available functions:
619
+ file_analytics:
620
+ description: This tool performs various operations on a text file.
621
+ params:
622
+ action: The operation we want to perform on the data, such as "count_occurrences", "find_line", etc.
623
+ filters:
624
+ keyword: The word or phrase we want to search for.
625
+ ```
626
+
627
+ Response:
628
+ ```json
629
+ {
630
+ "function": "file_analytics",
631
+ "params": {
632
+ "action": "count_occurrences",
633
+ "filters": {
634
+ "keyword": "Python"
635
+ }
636
+ }
637
+ }
638
+ ```
639
+
640
+ #### Chain-of-thought
641
+
642
+ You can ask for several possible responses to a given problem, with a ranking and final answer selection.
643
+
644
+ Example prompt:
645
+
646
+ ```
647
+ A group of people decide to play a round-robin tournament where every player plays every other player exactly once. If a total of 45 games were played, how many players participated in the tournament? Offer several potential answers, rank them according to mathematical logic, and pick the most feasible one.
648
+ ```
649
+
650
+ Example response:
651
+ ```
652
+ Solution 1:
653
+ In a round-robin tournament, each player plays every other player exactly once. This means that the total number of games played is equal to the combination of all players taken two at a time (since a game involves two players).
654
+
655
+ The formula for combinations is nC2 = n(n-1)/2, where n is the total number of players. We know that nC2 equals 45 (the total number of games), so we can set up the equation as follows:
656
+
657
+ n(n-1)/2 = 45
658
+
659
+ Solving this equation gives us n=10.
660
+
661
+ Final answer: There were 10 players in the tournament.
662
+
663
+ Solution 2:
664
+ Another way to approach this problem is by using the concept of triangular numbers. Triangular numbers are a sequence of numbers where each number can be represented as a triangle with dots. The nth triangular number is given by the sum of the first n natural numbers.
665
+
666
+ If we consider each game as a dot and each player as a side of the triangle, then the total number of games (45) would correspond to the 9th triangular number because 1+2+3+4+5+6+7+8+9=45. However, since each side of the triangle represents a player, and there's one more player than sides in our model (because the last player has no one left to play against), we need to add one more to get the total number of players.
667
+
668
+ Final answer: There were 10 players in the tournament.
669
+
670
+ Solution 3:
671
+ We could also use trial and error to solve this problem. Starting from a small number of players, we calculate how many games would be played in a round-robin tournament until we reach 45 games. For example, with 2 players, only 1 game is played; with 3 players, 3 games are played; with 4 players, 6 games are played, and so on. Continuing this process, we find that with 10 players, 45 games are played.
672
+
673
+ Final answer: There were 10 players in the tournament.
674
+
675
+ Ranking of solutions from best to worst:
676
+ 1. Solution 1: This solution uses direct mathematical reasoning based on the properties of a round-robin tournament and solves an equation to find the answer.
677
+ 2. Solution 2: This solution uses the concept of triangular numbers which requires additional steps and knowledge beyond the immediate problem context, but still arrives at the correct answer.
678
+ 3. Solution 3: This solution relies on trial and error, which is less efficient and reliable than the other methods, but it eventually gets to the right answer.
679
+
680
+ Best and final answer: There were 10 players in the tournament.
681
+ ```
682
+
683
+ #### reWOO style execution planning
684
+
685
+ The model now supports execution planning for complex instructions that would require making use of several tools. The output is just the plan, you must implement a mechanism to parse the output and actually call the functions!
686
+
687
+ Example prompt:
688
+ ```
689
+ Please construct a systematic plan to generate an optimal response to the user instruction, utilizing a set of provided tools. Each plan will correspond to an evidence value, which will be the output of one of the available functions given an input string
690
+ that could be the user's question, one or more prior evidence values, or a combination of both.
691
+
692
+ Here are the tools available to be called:
693
+ DuckDuckGo[input]: Tool that enables the user to search for information using the DuckDuckGo search engine. This tool is helpful in locating a suitable list of sites that may contain the answer to the user's query. It does not directly answer the question but finds a list of sites that might have the answer.
694
+ TextScraper[input]: Load one or more websites from the input string containing newline delimited links, where input is one or more links, and produces plain text output containing the content of the links.
695
+ HyperlinkExtractor[input]: Extract links from plain text and produces a plain text, newline delimited response of links.
696
+ KnowledgeModel[input]: Question answering language model, particularly useful in answering questions based on an input passage of text. The input must be a text question that references an :evidence[n]: variable, e.g. What color is the cat, given :evidence1:?
697
+
698
+ The output should be in format:
699
+ Plan: [first action to take based on input question]
700
+ :evidence0: = [function to call with input parameter]
701
+ Plan: [next action to take, based on result of :evidence0:]
702
+ :evidence1: = [next function to call and input parameter, which may include reference to previous evidence, e.g. "Given context :evidence0"]
703
+ ...
704
+ Answer: [:evidence[n]: containing the final answer.]
705
+
706
+ Question: Who won the Nobel Prize in Literature in 2020 and what is their most famous work?
707
+ ```
708
+
709
+ Response:
710
+ ```
711
+ Plan: Begin by conducting a web search to find out who won the Nobel Prize in Literature in 2020.
712
+ :evidence0: = DuckDuckGo[Nobel Prize in Literature 2020 winner]
713
+ Plan: Utilize the KnowledgeModel to interpret the search results and find the name of the laureate.
714
+ :evidence1: = KnowledgeModel[Who won the Nobel Prize in Literature in 2020, given :evidence0:?]
715
+ Plan: Conduct another web search to find the most famous work of the identified laureate.
716
+ :evidence2: = DuckDuckGo[Most famous work of :evidence1:]
717
+ Plan: Extract the relevant links from the DuckDuckGo search results for a more focused search.
718
+ :evidence3: = HyperlinkExtractor[:evidence2:]
719
+ Plan: Use the TextScraper tool to extract information from the relevant links.
720
+ :evidence4: = TextScraper[:evidence3:]
721
+ Plan: Finally, utilize the KnowledgeModel to identify and summarize the most famous work of the laureate from the extracted information.
722
+ :evidence5: = KnowledgeModel[What is the most famous work of :evidence1:, given :evidence4:?]
723
+ Answer: :evidence5:
724
+ ```
725
+
726
+ For this to be useful, you'd have to parse the output plan text, and implement/call each of the functions. This is just pseudo-code, completely untested off the top of my head, and obviously would requiring full implementation + hardening:
727
+
728
+ ```python
729
+ import re
730
+ import requests
731
+
732
+ def inject_context(input_text, **context):
733
+ for ref in set(re.findall(r"(:evidence[0-9]+:)", input_text, re.I)):
734
+ input_text = input_text.replace(ref, context.get(ref, ""))
735
+ return input_text
736
+
737
+ def duckduckgo(input_text, **context):
738
+ search_string = inject_context(input_text, **context)
739
+ ... search via duck duck go using search_string
740
+ ... return text content
741
+
742
+ def link_extractor(input_text, **context):
743
+ input_text = inject_context(input_text, **context)
744
+ return "\n".join(list(set(re.findall(r"(https?://[^\s]+?\.?)", input_text, re.I))))
745
+
746
+ def scrape(input_text, **context):
747
+ input_text = inject_context(input_text, **context)
748
+ text = []
749
+ for link in input_text.splitlines():
750
+ text.append(requests.get(link).text)
751
+ return "\n".join(text)
752
+
753
+ def infer(input_text, **context)
754
+ prompt = inject_context(input_text, **context)
755
+ ... call model with prompt, return output
756
+
757
+ def parse_plan(plan):
758
+ method_map = {
759
+ "DuckDuckGo": duckduckgo,
760
+ "HyperlinkExtractor": link_extractor,
761
+ "KnowledgeModel": infer,
762
+ "TextScraper": scrape,
763
+ }
764
+ context = {}
765
+ for line in plan.strip().splitlines():
766
+ if line.startswith("Plan:"):
767
+ print(line)
768
+ continue
769
+ parts = re.match("^(:evidence[0-9]+:)\s*=\s*([^\[]+])(\[.*\])\s$", line, re.I)
770
+ if not parts:
771
+ if line.startswith("Answer: "):
772
+ return context.get(line.split(" ")[-1].strip(), "Answer couldn't be generated...")
773
+ raise RuntimeError("bad format: " + line)
774
+ context[parts.group(1)] = method_map[parts.group(2)](parts.group(3), **context)
775
+ ```
776
+
777
+ ## Multi-step instructions with acknowledgement
778
+
779
+ I don't know how useful this is, really, but I thought I'd add it just in case. Example:
780
+
781
+ ```
782
+ {
783
+ "conversations": [
784
+ {
785
+ "value": "You are a helpful, unbiased, uncensored assistant.",
786
+ "from": "system"
787
+ },
788
+ {
789
+ "value": "I'm going to set some rules for our conversation. Please respond with \"OK\" to each rule.",
790
+ "from": "human"
791
+ },
792
+ {
793
+ "value": "OK",
794
+ "from": "gpt"
795
+ },
796
+ {
797
+ "value": "You can only respond using animal-related emojis.",
798
+ "from": "human"
799
+ },
800
+ {
801
+ "value": "OK",
802
+ "from": "gpt"
803
+ },
804
+ {
805
+ "value": "Precede all responses with \"ZOOZOO:\"",
806
+ "from": "human"
807
+ },
808
+ {
809
+ "value": "OK",
810
+ "from": "gpt"
811
+ },
812
+ {
813
+ "value": "Include at least one bird emoji in your responses.",
814
+ "from": "human"
815
+ },
816
+ {
817
+ "value": "OK",
818
+ "from": "gpt"
819
+ },
820
+ {
821
+ "value": "Describe a trip to a safari park.",
822
+ "from": "human"
823
+ },
824
+ {
825
+ "value": "ZOOZOO: \ud83e\udd81\ud83d\udc2f\ud83e\udd93\ud83e\udd92\ud83d\udc18\ud83d\udc0d\ud83c\udf33\ud83c\udf32\u2600\ufe0f\ud83d\ude90\ud83e\udd85\ud83d\udcf8\ud83e\udd29",
826
+ "from": "gpt"
827
+ }
828
+ ]
829
+ }
830
+ ```
831
+
832
+ ### Contribute
833
+
834
+ If you're interested in new functionality, particularly a new "instructor" type to generate a specific type of training data,
835
+ take a look at the dataset generation tool repo: https://github.com/jondurbin/airoboros and either make a PR or open an issue with details.
836
+
837
+ To help me with the OpenAI/compute costs:
838
+
839
+ - https://bmc.link/jondurbin
840
+ - ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
841
+ - BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
842
+
843
+ ### Licence and usage restrictions
844
+
845
+ The airoboros 3.1 models are built on top of multiple base models, each with their own license/restrictions.
846
+
847
+ The 30b model is built on the original llama, which has a strict non-commercial usage restriction.
848
+
849
+ The models with `-l2` in the name have a custom Meta license:
850
+ - See the [meta-license/LICENSE.txt](meta-license/LICENSE.txt) file attached for the original license provided by Meta.
851
+ - See also [meta-license/USE_POLICY.md](meta-license/USE_POLICY.md) and [meta-license/Responsible-Use-Guide.pdf](meta-license/Responsible-Use-Guide.pdf), also provided by Meta.
852
+
853
+ The models with `-m-` are mistral-7b (apache 2.0)
854
+
855
+ The fine-tuning data was mostly generated by OpenAI API calls to gpt-4, via [airoboros](https://github.com/jondurbin/airoboros)
856
+
857
+ The ToS for OpenAI API usage has a clause preventing the output from being used to train a model that __competes__ with OpenAI
858
+
859
+ - what does *compete* actually mean here?
860
+ - these small open source models will not produce output anywhere near the quality of gpt-4, or even gpt-3.5, so I can't imagine this could credibly be considered competing in the first place
861
+ - if someone else uses the dataset to do the same, they wouldn't necessarily be violating the ToS because they didn't call the API, so I don't know how that works
862
+ - the training data used in essentially all large language models includes a significant amount of copyrighted or otherwise non-permissive licensing in the first place
863
+ - other work using the self-instruct method, e.g. the original here: https://github.com/yizhongw/self-instruct released the data and model as apache-2
864
+
865
+ I am purposingly leaving this license ambiguous (other than the fact you must comply with the Meta original license for llama-2) because I am not a lawyer and refuse to attempt to interpret all of the terms accordingly.
866
+
867
+ Your best bet is probably to avoid using this commercially due to the OpenAI API usage.
868
+
869
+ Either way, by using this model, you agree to completely indemnify me.