Text Generation
Transformers
Safetensors
mixtral
conversational
text-generation-inference
4-bit precision
gptq
TheBloke commited on
Commit
18f9d5e
1 Parent(s): 285e6a8

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +818 -0
README.md ADDED
@@ -0,0 +1,818 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: jondurbin/bagel-8x7b-v0.2
3
+ datasets:
4
+ - ai2_arc
5
+ - jondurbin/airoboros-3.2
6
+ - codeparrot/apps
7
+ - facebook/belebele
8
+ - boolq
9
+ - jondurbin/cinematika-v0.1
10
+ - drop
11
+ - lmsys/lmsys-chat-1m
12
+ - TIGER-Lab/MathInstruct
13
+ - cais/mmlu
14
+ - Muennighoff/natural-instructions
15
+ - openbookqa
16
+ - piqa
17
+ - Vezora/Tested-22k-Python-Alpaca
18
+ - cakiki/rosetta-code
19
+ - Open-Orca/SlimOrca
20
+ - spider
21
+ - squad_v2
22
+ - migtissera/Synthia-v1.3
23
+ - datasets/winogrande
24
+ - nvidia/HelpSteer
25
+ - Intel/orca_dpo_pairs
26
+ - unalignment/toxic-dpo-v0.1
27
+ - jondurbin/truthy-dpo-v0.1
28
+ - allenai/ultrafeedback_binarized_cleaned
29
+ - Squish42/bluemoon-fandom-1-1-rp-cleaned
30
+ - LDJnr/Capybara
31
+ - JULIELab/EmoBank
32
+ - kingbri/PIPPA-shareGPT
33
+ inference: false
34
+ license: apache-2.0
35
+ model_creator: Jon Durbin
36
+ model_name: Bagel 8X7B v0.2
37
+ model_type: mixtral
38
+ prompt_template: 'Below is an instruction that describes a task. Write a response
39
+ that appropriately completes the request.
40
+
41
+
42
+ ### Instruction:
43
+
44
+ {prompt}
45
+
46
+
47
+ ### Response:
48
+
49
+ '
50
+ quantized_by: TheBloke
51
+ ---
52
+ <!-- markdownlint-disable MD041 -->
53
+
54
+ <!-- header start -->
55
+ <!-- 200823 -->
56
+ <div style="width: auto; margin-left: auto; margin-right: auto">
57
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
58
+ </div>
59
+ <div style="display: flex; justify-content: space-between; width: 100%;">
60
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
61
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
62
+ </div>
63
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
64
+ <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>
65
+ </div>
66
+ </div>
67
+ <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>
68
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
69
+ <!-- header end -->
70
+
71
+ # Bagel 8X7B v0.2 - GPTQ
72
+ - Model creator: [Jon Durbin](https://huggingface.co/jondurbin)
73
+ - Original model: [Bagel 8X7B v0.2](https://huggingface.co/jondurbin/bagel-8x7b-v0.2)
74
+
75
+ <!-- description start -->
76
+ # Description
77
+
78
+ This repo contains GPTQ model files for [Jon Durbin's Bagel 8X7B v0.2](https://huggingface.co/jondurbin/bagel-8x7b-v0.2).
79
+
80
+ 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.
81
+
82
+ <!-- description end -->
83
+ <!-- repositories-available start -->
84
+ ## Repositories available
85
+
86
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-AWQ)
87
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ)
88
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GGUF)
89
+ * [Jon Durbin's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/jondurbin/bagel-8x7b-v0.2)
90
+ <!-- repositories-available end -->
91
+
92
+ <!-- prompt-template start -->
93
+ ## Prompt template: Alpaca
94
+
95
+ ```
96
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
97
+
98
+ ### Instruction:
99
+ {prompt}
100
+
101
+ ### Response:
102
+
103
+ ```
104
+
105
+ <!-- prompt-template end -->
106
+
107
+
108
+
109
+ <!-- README_GPTQ.md-compatible clients start -->
110
+ ## Known compatible clients / servers
111
+
112
+ GPTQ models are currently supported on Linux (NVidia/AMD) and Windows (NVidia only). macOS users: please use GGUF models.
113
+
114
+ These GPTQ models are known to work in the following inference servers/webuis.
115
+
116
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
117
+ - [KoboldAI United](https://github.com/henk717/koboldai)
118
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
119
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
120
+
121
+ This may not be a complete list; if you know of others, please let me know!
122
+ <!-- README_GPTQ.md-compatible clients end -->
123
+
124
+ <!-- README_GPTQ.md-provided-files start -->
125
+ ## Provided files, and GPTQ parameters
126
+
127
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
128
+
129
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
130
+
131
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
132
+
133
+ <details>
134
+ <summary>Explanation of GPTQ parameters</summary>
135
+
136
+ - Bits: The bit size of the quantised model.
137
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
138
+ - 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.
139
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
140
+ - 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).
141
+ - 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.
142
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
143
+
144
+ </details>
145
+
146
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
147
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
148
+ | [main](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/main) | 4 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 23.81 GB | No | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
149
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 24.70 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
150
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 27.42 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
151
+ | [gptq-3bit--1g-actorder_True](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/gptq-3bit--1g-actorder_True) | 3 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.01 GB | No | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
152
+ | [gptq-3bit-128g-actorder_True](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/gptq-3bit-128g-actorder_True) | 3 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.85 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
153
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 47.04 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
154
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 48.10 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
155
+
156
+ <!-- README_GPTQ.md-provided-files end -->
157
+
158
+ <!-- README_GPTQ.md-download-from-branches start -->
159
+ ## How to download, including from branches
160
+
161
+ ### In text-generation-webui
162
+
163
+ To download from the `main` branch, enter `TheBloke/bagel-8x7b-v0.2-GPTQ` in the "Download model" box.
164
+
165
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/bagel-8x7b-v0.2-GPTQ:gptq-4bit-128g-actorder_True`
166
+
167
+ ### From the command line
168
+
169
+ I recommend using the `huggingface-hub` Python library:
170
+
171
+ ```shell
172
+ pip3 install huggingface-hub
173
+ ```
174
+
175
+ To download the `main` branch to a folder called `bagel-8x7b-v0.2-GPTQ`:
176
+
177
+ ```shell
178
+ mkdir bagel-8x7b-v0.2-GPTQ
179
+ huggingface-cli download TheBloke/bagel-8x7b-v0.2-GPTQ --local-dir bagel-8x7b-v0.2-GPTQ --local-dir-use-symlinks False
180
+ ```
181
+
182
+ To download from a different branch, add the `--revision` parameter:
183
+
184
+ ```shell
185
+ mkdir bagel-8x7b-v0.2-GPTQ
186
+ huggingface-cli download TheBloke/bagel-8x7b-v0.2-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir bagel-8x7b-v0.2-GPTQ --local-dir-use-symlinks False
187
+ ```
188
+
189
+ <details>
190
+ <summary>More advanced huggingface-cli download usage</summary>
191
+
192
+ 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.
193
+
194
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
195
+
196
+ 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).
197
+
198
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
199
+
200
+ ```shell
201
+ pip3 install hf_transfer
202
+ ```
203
+
204
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
205
+
206
+ ```shell
207
+ mkdir bagel-8x7b-v0.2-GPTQ
208
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/bagel-8x7b-v0.2-GPTQ --local-dir bagel-8x7b-v0.2-GPTQ --local-dir-use-symlinks False
209
+ ```
210
+
211
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
212
+ </details>
213
+
214
+ ### With `git` (**not** recommended)
215
+
216
+ To clone a specific branch with `git`, use a command like this:
217
+
218
+ ```shell
219
+ git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/bagel-8x7b-v0.2-GPTQ
220
+ ```
221
+
222
+ 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.)
223
+
224
+ <!-- README_GPTQ.md-download-from-branches end -->
225
+ <!-- README_GPTQ.md-text-generation-webui start -->
226
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
227
+
228
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
229
+
230
+ 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.
231
+
232
+ 1. Click the **Model tab**.
233
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/bagel-8x7b-v0.2-GPTQ`.
234
+
235
+ - To download from a specific branch, enter for example `TheBloke/bagel-8x7b-v0.2-GPTQ:gptq-4bit-128g-actorder_True`
236
+ - see Provided Files above for the list of branches for each option.
237
+
238
+ 3. Click **Download**.
239
+ 4. The model will start downloading. Once it's finished it will say "Done".
240
+ 5. In the top left, click the refresh icon next to **Model**.
241
+ 6. In the **Model** dropdown, choose the model you just downloaded: `bagel-8x7b-v0.2-GPTQ`
242
+ 7. The model will automatically load, and is now ready for use!
243
+ 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.
244
+
245
+ - 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`.
246
+
247
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
248
+
249
+ <!-- README_GPTQ.md-text-generation-webui end -->
250
+
251
+ <!-- README_GPTQ.md-use-from-tgi start -->
252
+ ## Serving this model from Text Generation Inference (TGI)
253
+
254
+ 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`
255
+
256
+ Example Docker parameters:
257
+
258
+ ```shell
259
+ --model-id TheBloke/bagel-8x7b-v0.2-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
260
+ ```
261
+
262
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
263
+
264
+ ```shell
265
+ pip3 install huggingface-hub
266
+ ```
267
+
268
+ ```python
269
+ from huggingface_hub import InferenceClient
270
+
271
+ endpoint_url = "https://your-endpoint-url-here"
272
+
273
+ prompt = "Tell me about AI"
274
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
275
+
276
+ ### Instruction:
277
+ {prompt}
278
+
279
+ ### Response:
280
+ '''
281
+
282
+ client = InferenceClient(endpoint_url)
283
+ response = client.text_generation(
284
+ prompt_template,
285
+ max_new_tokens=128,
286
+ do_sample=True,
287
+ temperature=0.7,
288
+ top_p=0.95,
289
+ top_k=40,
290
+ repetition_penalty=1.1
291
+ )
292
+
293
+ print(f"Model output: {response}")
294
+ ```
295
+ <!-- README_GPTQ.md-use-from-tgi end -->
296
+ <!-- README_GPTQ.md-use-from-python start -->
297
+ ## Python code example: inference from this GPTQ model
298
+
299
+ ### Install the necessary packages
300
+
301
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
302
+
303
+ ```shell
304
+ pip3 install --upgrade transformers optimum
305
+ # If using PyTorch 2.1 + CUDA 12.x:
306
+ pip3 install --upgrade auto-gptq
307
+ # or, if using PyTorch 2.1 + CUDA 11.x:
308
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
309
+ ```
310
+
311
+ If you are using PyTorch 2.0, you will need to install AutoGPTQ from source. Likewise if you have problems with the pre-built wheels, you should try building from source:
312
+
313
+ ```shell
314
+ pip3 uninstall -y auto-gptq
315
+ git clone https://github.com/PanQiWei/AutoGPTQ
316
+ cd AutoGPTQ
317
+ git checkout v0.5.1
318
+ pip3 install .
319
+ ```
320
+
321
+ ### Example Python code
322
+
323
+ ```python
324
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
325
+
326
+ model_name_or_path = "TheBloke/bagel-8x7b-v0.2-GPTQ"
327
+ # To use a different branch, change revision
328
+ # For example: revision="gptq-4bit-128g-actorder_True"
329
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
330
+ device_map="auto",
331
+ trust_remote_code=False,
332
+ revision="main")
333
+
334
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
335
+
336
+ prompt = "Write a story about llamas"
337
+ system_message = "You are a story writing assistant"
338
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
339
+
340
+ ### Instruction:
341
+ {prompt}
342
+
343
+ ### Response:
344
+ '''
345
+
346
+ print("\n\n*** Generate:")
347
+
348
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
349
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
350
+ print(tokenizer.decode(output[0]))
351
+
352
+ # Inference can also be done using transformers' pipeline
353
+
354
+ print("*** Pipeline:")
355
+ pipe = pipeline(
356
+ "text-generation",
357
+ model=model,
358
+ tokenizer=tokenizer,
359
+ max_new_tokens=512,
360
+ do_sample=True,
361
+ temperature=0.7,
362
+ top_p=0.95,
363
+ top_k=40,
364
+ repetition_penalty=1.1
365
+ )
366
+
367
+ print(pipe(prompt_template)[0]['generated_text'])
368
+ ```
369
+ <!-- README_GPTQ.md-use-from-python end -->
370
+
371
+ <!-- README_GPTQ.md-compatibility start -->
372
+ ## Compatibility
373
+
374
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
375
+
376
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama architecture models (including Mistral, Yi, DeepSeek, SOLAR, etc) in 4-bit. Please see the Provided Files table above for per-file compatibility.
377
+
378
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
379
+ <!-- README_GPTQ.md-compatibility end -->
380
+
381
+ <!-- footer start -->
382
+ <!-- 200823 -->
383
+ ## Discord
384
+
385
+ For further support, and discussions on these models and AI in general, join us at:
386
+
387
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
388
+
389
+ ## Thanks, and how to contribute
390
+
391
+ Thanks to the [chirper.ai](https://chirper.ai) team!
392
+
393
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
394
+
395
+ 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.
396
+
397
+ 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.
398
+
399
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
400
+
401
+ * Patreon: https://patreon.com/TheBlokeAI
402
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
403
+
404
+ **Special thanks to**: Aemon Algiz.
405
+
406
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
407
+
408
+
409
+ Thank you to all my generous patrons and donaters!
410
+
411
+ And thank you again to a16z for their generous grant.
412
+
413
+ <!-- footer end -->
414
+
415
+ # Original model card: Jon Durbin's Bagel 8X7B v0.2
416
+
417
+
418
+ # A bagel, with everything (except DPO)
419
+
420
+ ![bagel](bagel.png)
421
+
422
+ ## Overview
423
+
424
+ An experimental fine-tune of [mixtral-8x7b-v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1) using [bagel](https://github.com/jondurbin/bagel)
425
+
426
+ This is the model after the SFT phase, before DPO has been applied.
427
+
428
+ Hardware kindly provided by [Massed Compute](https://massedcompute.com/?utm_source=huggingface&utm_creative_format=model_card&utm_content=creator_jon)
429
+
430
+ ### Data sources
431
+
432
+ *Yes, you will see benchmark names in the list, but this only uses the train splits, and a decontamination by cosine similarity is performed at the end as a sanity check*
433
+
434
+ - [ai2_arc](https://huggingface.co/datasets/ai2_arc)
435
+ - Abstraction and reasoning dataset, useful in measuring "intelligence" to a certain extent.
436
+ - [airoboros](https://huggingface.co/datasets/unalignment/spicy-3.1)
437
+ - Variety of categories of synthetic instructions generated by gpt-4.
438
+ - [apps](https://huggingface.co/datasets/codeparrot/apps)
439
+ - Python coding dataset with 10k problems.
440
+ - [belebele](https://huggingface.co/datasets/facebook/belebele)
441
+ - Multi-lingual reading comprehension dataset.
442
+ - [bluemoon](https://huggingface.co/datasets/Squish42/bluemoon-fandom-1-1-rp-cleaned)
443
+ - Roleplay data scraped from Bluemoon, then cleaned and formatted as ShareGPT.
444
+ - [boolq](https://huggingface.co/datasets/boolq)
445
+ - Corpus of yes/no questions (which can be surprisingly difficult for AI to answer apparently?)
446
+ - [capybara](https://huggingface.co/datasets/LDJnr/Capybara)
447
+ - Multi-turn dataset used to create the capybara models.
448
+ - [cinematika](https://huggingface.co/datasets/jondurbin/cinematika-v0.1) (instruction and plain text)
449
+ - RP-style data synthesized from movie scripts so the model isn't quite as boring as it otherwise would be.
450
+ - [drop](https://huggingface.co/datasets/drop)
451
+ - More reading comprehension.
452
+ - [emobank](https://github.com/JULIELab/EmoBank)
453
+ - Emotion annotations using the Valence-Arousal-Domninance scheme.
454
+ - [gutenberg](https://www.gutenberg.org/) (plain text)
455
+ - Books/plain text, again to make the model less boring, only a handful of examples supported by [chapterize](https://github.com/JonathanReeve/chapterize)
456
+ - [lmsys_chat_1m](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) (only gpt-4 items, also used for DPO)
457
+ - Chats collected by the lmsys chat arena, containing a wide variety of chats with various models.
458
+ - [mathinstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
459
+ - Composite dataset with a variety of math-related tasks and problem/question formats.
460
+ - [mmlu](https://huggingface.co/datasets/cais/mmlu)
461
+ - Massive Multitask Language Understanding - a wide variety of questions about various subject matters.
462
+ - [natural_instructions](https://huggingface.co/datasets/Muennighoff/natural-instructions)
463
+ - Millions of instructions from 1600+ task categories (sampled down substantially, stratified by task type)
464
+ - [openbookqa](https://huggingface.co/datasets/openbookqa)
465
+ - Question answering dataset.
466
+ - [pippa](https://huggingface.co/datasets/kingbri/PIPPA-shareGPT)
467
+ - Deduped version of [PIPPA](https://huggingface.co/datasets/PygmalionAI/PIPPA) in ShareGPT format.
468
+ - [piqa](https://huggingface.co/datasets/piqa)
469
+ - Phyiscal interaction question answering.
470
+ - [python_alpaca](https://huggingface.co/datasets/Vezora/Tested-22k-Python-Alpaca)
471
+ - Python instruction response pairs, validated as functional.
472
+ - [rosetta_code](https://huggingface.co/datasets/cakiki/rosetta-code)
473
+ - Code problems and solutions in a variety of programming languages taken from rosettacode.org.
474
+ - [slimorca](https://huggingface.co/datasets/Open-Orca/SlimOrca)
475
+ - Collection of ~500k gpt-4 verified chats from OpenOrca.
476
+ - [spider](https://huggingface.co/datasets/spider)
477
+ - SQL-targeted dataset.
478
+ - [squad_v2](https://huggingface.co/datasets/squad_v2)
479
+ - Contextual question answering (RAG).
480
+ - [synthia](https://huggingface.co/datasets/migtissera/Synthia-v1.3)
481
+ - GPT-4 generated data using advanced prompting from Migel Tissera.
482
+ - [winogrande](https://huggingface.co/datasets/winogrande)
483
+ - Fill in the blank style prompts.
484
+
485
+ Only the train splits were used (if a split was provided), and an additional pass of decontamination is performed using approximate nearest neighbor search (via faiss).
486
+
487
+ ## How to easily download and use this model
488
+ [Massed Compute](https://massedcompute.com/?utm_source=huggingface&utm_creative_format=model_card&utm_content=creator_jon) has created a Virtual Machine (VM) pre-loaded with TGI and Text Generation WebUI.
489
+
490
+ 1) For this model rent the [Jon Durbin 4xA6000](https://shop.massedcompute.com/products/jon-durbin-4x-a6000?utm_source=huggingface&utm_creative_format=model_card&utm_content=creator_jon) Virtual Machine
491
+ 2) After you start your rental you will receive an email with instructions on how to Login to the VM
492
+ 3) Once inside the VM, open the terminal and run `conda activate text-generation-inference`
493
+ 4) Then `cd Desktop/text-generation-inference/`
494
+ 5) Run `volume=$PWD/data`
495
+ 6) Run`model=jondurbin/bagel-8x7b-v0.2`
496
+ 7) `sudo docker run --gpus '"device=0,1,2,3"' --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:1.3 --model-id $model`
497
+ 8) The model will take some time to load...
498
+ 9) Once loaded the model will be available on port 8080
499
+
500
+ Sample command within the VM
501
+ ```
502
+ curl 0.0.0.0:8080/generate \
503
+ -X POST \
504
+ -d '{"inputs":"<|system|>You are a friendly chatbot.\n<|user|>What type of model are you?\n<|assistant|>","parameters":{"do_sample": true, "max_new_tokens": 100, "repetition_penalty": 1.15, "temperature": 0.7, "top_k": 20, "top_p": 0.9, "best_of": 1}}'\
505
+ -H 'Content-Type: application/json'
506
+ ```
507
+
508
+ You can also access the model from outside the VM
509
+ ```
510
+ curl IP_ADDRESS_PROVIDED_BY_MASSED_COMPUTE_VM:8080/generate \
511
+ -X POST \
512
+ -d '{"inputs":"<|system|>You are a friendly chatbot.\n<|user|>What type of model are you?\n<|assistant|>","parameters":{"do_sample": true, "max_new_tokens": 100, "repetition_penalty": 1.15, "temperature": 0.7, "top_k": 20, "top_p": 0.9, "best_of": 1}}'\
513
+ -H 'Content-Type: application/json
514
+ ```
515
+
516
+ For assistance with the VM join the [Massed Compute Discord Server](https://discord.gg/Mj4YMQY3DA)
517
+
518
+ ## Prompt formatting
519
+
520
+ In sticking with the theme of the bagel, I didn't want to use a single prompt format, so I used 4 - vicuna, llama-2, alpaca, and chat-ml (sorta).
521
+ I also didn't want to randomly select a single prompt format for each item (hoping each instruction would generalize more when used in a variety of prompt formats), so each instruction is actually converted into every prompt format.
522
+
523
+ This means each epoch of our fine-tune is really basically 4 epochs. So, for the fine-tunes, I would recommend only doing 1 epoch (or 0.75 epochs). I am testing with a single epoch using a relatively low learning rate.
524
+
525
+ ### Alpaca (sort of)
526
+
527
+ ```
528
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
529
+
530
+ ### Instruction:
531
+ {system prompt, if provided}
532
+ {instruction}
533
+
534
+ ### Response:
535
+ ```
536
+
537
+ The main difference here is that because of the dataset formatting and variety of data sources, it would have been much to tedious to add an `### Input:` block, so the inputs are just in the instruction section.
538
+
539
+ ### Vicuna
540
+
541
+ ```
542
+ {system prompt, if provided, randomly defaulting to "A chat between a user and an unbiased, uncensored assistant."}
543
+ USER: {instruction}
544
+ ASSISTANT:
545
+ ```
546
+
547
+ ### ChatML (sort of)
548
+
549
+ I don't really understand the point of having special tokens for `<|im_start|>` and `<|im_end|>`, because in practice they just act as BOS and EOS tokens (but, please correct me if I'm wrong).
550
+
551
+ So, instead of:
552
+ ```text
553
+ {bos}<|im_start|>{role}
554
+ {text}
555
+ <|im_end|>{eos}
556
+ ```
557
+
558
+ I just changed it to:
559
+ ```text
560
+ {bos}{role}
561
+ {text}
562
+ {eos}
563
+ ```
564
+
565
+ If you *really* want to use `<|im_start|>` and `<|im_end|>`, just update your `tokenizer_config.json` to use `<|im_start|>` instead of `<s>` and `<|im_end|>` instead of `</s>` and when tokenizing. And if you still don't like what I've done to this chat-ml-ish format, feel free to cry into your pillow or fork the code and do a new fine-tune.
566
+
567
+ ### Llama-2 chat
568
+
569
+ ```
570
+ [INST] <<SYS>>
571
+ {system}
572
+ <</SYS>>
573
+
574
+ {instruction} [/INST]
575
+ ```
576
+
577
+ ### Default via chat template
578
+
579
+ The model's `tokenizer_config.json` includes the default chat template (llama-2), so you can simply use the `apply_chat_template` method to build the full prompt.
580
+
581
+ ```
582
+ import transformers
583
+ tokenizer = transformers.AutoTokenizer.from_pretrained('jondurbin/bagel-8x7b-v0.2')
584
+ chat = [
585
+ {"role": "system", "content": "You are Bob, a friendly AI assistant."},
586
+ {"role": "user", "content": "Hello, how are you?"},
587
+ {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
588
+ {"role": "user", "content": "I'd like to show off how chat templating works!"},
589
+ ]
590
+ print(tokenizer.apply_chat_template(chat, tokenize=False))
591
+ ```
592
+
593
+ ### Contribute
594
+
595
+ If you're interested in new functionality/datasets, take a look at [bagel repo](https://github.com/jondurbin/bagel) and either make a PR or open an issue with details.
596
+
597
+ To help me with the fine-tuning costs (which are extremely expensive for these large combined datasets):
598
+
599
+ - https://bmc.link/jondurbin
600
+ - ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
601
+ - BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
602
+
603
+ ### Guide for certain tasks
604
+
605
+ #### RA(G)/contextual question answering
606
+
607
+ The model was trained to ignore what it thinks it knows, and uses the context to answer the questions, when using the format below.
608
+ The model was also tuned to limit the values to the provided context as much as possible to reduce hallucinations.
609
+
610
+ The format for a contextual prompt is as follows:
611
+ ```
612
+ BEGININPUT
613
+ BEGINCONTEXT
614
+ [key0: value0]
615
+ [key1: value1]
616
+ ... other metdata ...
617
+ ENDCONTEXT
618
+ [insert your text blocks here]
619
+ ENDINPUT
620
+ [add as many other blocks, in the exact same format]
621
+ BEGININSTRUCTION
622
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
623
+ ENDINSTRUCTION
624
+ ```
625
+
626
+ 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.
627
+ - `BEGININPUT` - denotes a new input block
628
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
629
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
630
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
631
+ - `ENDINPUT` - denotes the end of the current input block
632
+ - [repeat as many input blocks in this format as you want]
633
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
634
+ - [instruction(s)]
635
+ - `ENDINSTRUCTION` - denotes the end of instruction set
636
+
637
+ __Use a very low temperature!__
638
+
639
+ Here's a trivial, but important example to prove the point:
640
+ ```
641
+ BEGININPUT
642
+ BEGINCONTEXT
643
+ date: 2021-01-01
644
+ url: https://web.site/123
645
+ ENDCONTEXT
646
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
647
+ ENDINPUT
648
+ BEGININSTRUCTION
649
+ What color are bluberries? Source?
650
+ ENDINSTRUCTION
651
+ ```
652
+
653
+ And the response:
654
+ ```
655
+ Blueberries are now green.
656
+ Source:
657
+ date: 2021-01-01
658
+ url: https://web.site/123
659
+ ```
660
+
661
+ #### Summarization
662
+
663
+ 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:
664
+
665
+ ```
666
+ BEGININPUT
667
+ {text to summarize}
668
+ ENDINPUT
669
+ BEGININSTRUCTION
670
+ Summarize the input in around 130 words.
671
+ ENDINSTRUCTION
672
+ ```
673
+
674
+ #### Agent/function calling
675
+
676
+ 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.
677
+
678
+ Example prompt:
679
+ ```
680
+ 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.
681
+
682
+ Input: I want to know how many times 'Python' is mentioned in my text file.
683
+
684
+ Available functions:
685
+ file_analytics:
686
+ description: This tool performs various operations on a text file.
687
+ params:
688
+ action: The operation we want to perform on the data, such as "count_occurrences", "find_line", etc.
689
+ filters:
690
+ keyword: The word or phrase we want to search for.
691
+ ```
692
+
693
+ Response:
694
+ ```json
695
+ {
696
+ "function": "file_analytics",
697
+ "params": {
698
+ "action": "count_occurrences",
699
+ "filters": {
700
+ "keyword": "Python"
701
+ }
702
+ }
703
+ }
704
+ ```
705
+
706
+ #### reWOO style execution planning
707
+
708
+ 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!
709
+
710
+ Example prompt:
711
+ ```
712
+ 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
713
+ that could be the user's question, one or more prior evidence values, or a combination of both.
714
+
715
+ Here are the tools available to be called:
716
+ 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.
717
+ 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.
718
+ HyperlinkExtractor[input]: Extract links from plain text and produces a plain text, newline delimited response of links.
719
+ 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:?
720
+
721
+ The output should be in format:
722
+ Plan: [first action to take based on input question]
723
+ :evidence0: = [function to call with input parameter]
724
+ Plan: [next action to take, based on result of :evidence0:]
725
+ :evidence1: = [next function to call and input parameter, which may include reference to previous evidence, e.g. "Given context :evidence0"]
726
+ ...
727
+ Answer: [:evidence[n]: containing the final answer.]
728
+
729
+ Question: Who won the Nobel Prize in Literature in 2020 and what is their most famous work?
730
+ ```
731
+
732
+ Response:
733
+ ```
734
+ Plan: Begin by conducting a web search to find out who won the Nobel Prize in Literature in 2020.
735
+ :evidence0: = DuckDuckGo[Nobel Prize in Literature 2020 winner]
736
+ Plan: Utilize the KnowledgeModel to interpret the search results and find the name of the laureate.
737
+ :evidence1: = KnowledgeModel[Who won the Nobel Prize in Literature in 2020, given :evidence0:?]
738
+ Plan: Conduct another web search to find the most famous work of the identified laureate.
739
+ :evidence2: = DuckDuckGo[Most famous work of :evidence1:]
740
+ Plan: Extract the relevant links from the DuckDuckGo search results for a more focused search.
741
+ :evidence3: = HyperlinkExtractor[:evidence2:]
742
+ Plan: Use the TextScraper tool to extract information from the relevant links.
743
+ :evidence4: = TextScraper[:evidence3:]
744
+ Plan: Finally, utilize the KnowledgeModel to identify and summarize the most famous work of the laureate from the extracted information.
745
+ :evidence5: = KnowledgeModel[What is the most famous work of :evidence1:, given :evidence4:?]
746
+ Answer: :evidence5:
747
+ ```
748
+
749
+ 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:
750
+
751
+ ```python
752
+ import re
753
+ import requests
754
+
755
+ def inject_context(input_text, **context):
756
+ for ref in set(re.findall(r"(:evidence[0-9]+:)", input_text, re.I)):
757
+ input_text = input_text.replace(ref, context.get(ref, ""))
758
+ return input_text
759
+
760
+ def duckduckgo(input_text, **context):
761
+ search_string = inject_context(input_text, **context)
762
+ ... search via duck duck go using search_string
763
+ ... return text content
764
+
765
+ def link_extractor(input_text, **context):
766
+ input_text = inject_context(input_text, **context)
767
+ return "\n".join(list(set(re.findall(r"(https?://[^\s]+?\.?)", input_text, re.I))))
768
+
769
+ def scrape(input_text, **context):
770
+ input_text = inject_context(input_text, **context)
771
+ text = []
772
+ for link in input_text.splitlines():
773
+ text.append(requests.get(link).text)
774
+ return "\n".join(text)
775
+
776
+ def infer(input_text, **context)
777
+ prompt = inject_context(input_text, **context)
778
+ ... call model with prompt, return output
779
+
780
+ def parse_plan(plan):
781
+ method_map = {
782
+ "DuckDuckGo": duckduckgo,
783
+ "HyperlinkExtractor": link_extractor,
784
+ "KnowledgeModel": infer,
785
+ "TextScraper": scrape,
786
+ }
787
+ context = {}
788
+ for line in plan.strip().splitlines():
789
+ if line.startswith("Plan:"):
790
+ print(line)
791
+ continue
792
+ parts = re.match("^(:evidence[0-9]+:)\s*=\s*([^\[]+])(\[.*\])\s$", line, re.I)
793
+ if not parts:
794
+ if line.startswith("Answer: "):
795
+ return context.get(line.split(" ")[-1].strip(), "Answer couldn't be generated...")
796
+ raise RuntimeError("bad format: " + line)
797
+ context[parts.group(1)] = method_map[parts.group(2)](parts.group(3), **context)
798
+ ```
799
+
800
+ ### Fine-tuning information
801
+
802
+ You can find charts, and the full configuration used to fine-tune this model on [weights and biases](https://wandb.ai/jondurbin/bagel-8x7b-v0.2/runs/agxjjdso?workspace=user-jondurbin)
803
+
804
+ The model was fine-tuned on an 8x a6000 instance, for 4 days, 15 hours, 6 minutes and 42 seconds.
805
+
806
+ ### Licence and usage restrictions
807
+
808
+ The base model is mixtral-8x7b-v0.1, which is licensed as apache-2.0 - no issues there.
809
+
810
+ The fine-tuning data, however, includes several datasets that have data generated at least in part by OpenAI's gpt-4.
811
+
812
+ I am not a lawyer, so I can't help determine if this is actually commercially viable, but some questions that often come up are:
813
+
814
+ - Does the OpenAI ToS apply only to the user who created the dataset initially, and not subsequent models?
815
+ - If the dataset was released under a permissive license, but actually includes OpenAI generated data, does that ToS supersede the license?
816
+ - Does the dataset fall completely under fair use anyways, since the model isn't really capable of reproducing the entire training set verbatim?
817
+
818
+ Use your best judgement and seek legal advice if you are concerned about the terms. In any case, by using this model, you agree to completely indemnify me.