Transformers
GGUF
yi
TheBloke commited on
Commit
d33d806
1 Parent(s): 7956bc9

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +513 -0
README.md ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: jondurbin/nontoxic-bagel-34b-v0.2
3
+ datasets:
4
+ - ai2_arc
5
+ - unalignment/spicy-3.1
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: other
35
+ license_link: https://huggingface.co/01-ai/Yi-34B-200K/blob/main/LICENSE
36
+ license_name: yi-license
37
+ model_creator: Jon Durbin
38
+ model_name: Nontoxic Bagel 34B v0.2
39
+ model_type: yi
40
+ prompt_template: 'Below is an instruction that describes a task. Write a response
41
+ that appropriately completes the request.
42
+
43
+
44
+ ### Instruction:
45
+
46
+ {system_message}
47
+
48
+ {prompt}
49
+
50
+
51
+ ### Response:
52
+
53
+ '
54
+ quantized_by: TheBloke
55
+ ---
56
+ <!-- markdownlint-disable MD041 -->
57
+
58
+ <!-- header start -->
59
+ <!-- 200823 -->
60
+ <div style="width: auto; margin-left: auto; margin-right: auto">
61
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
62
+ </div>
63
+ <div style="display: flex; justify-content: space-between; width: 100%;">
64
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
65
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
66
+ </div>
67
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
68
+ <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>
69
+ </div>
70
+ </div>
71
+ <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>
72
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
73
+ <!-- header end -->
74
+
75
+ # Nontoxic Bagel 34B v0.2 - GGUF
76
+ - Model creator: [Jon Durbin](https://huggingface.co/jondurbin)
77
+ - Original model: [Nontoxic Bagel 34B v0.2](https://huggingface.co/jondurbin/nontoxic-bagel-34b-v0.2)
78
+
79
+ <!-- description start -->
80
+ ## Description
81
+
82
+ This repo contains GGUF format model files for [Jon Durbin's Nontoxic Bagel 34B v0.2](https://huggingface.co/jondurbin/nontoxic-bagel-34b-v0.2).
83
+
84
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
85
+
86
+ <!-- description end -->
87
+ <!-- README_GGUF.md-about-gguf start -->
88
+ ### About GGUF
89
+
90
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
91
+
92
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
93
+
94
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
95
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
96
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
97
+ * [GPT4All](https://gpt4all.io/index.html), a free and open source local running GUI, supporting Windows, Linux and macOS with full GPU accel.
98
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration. Linux available, in beta as of 27/11/2023.
99
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
100
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
101
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
102
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
103
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server. Note, as of time of writing (November 27th 2023), ctransformers has not been updated in a long time and does not support many recent models.
104
+
105
+ <!-- README_GGUF.md-about-gguf end -->
106
+ <!-- repositories-available start -->
107
+ ## Repositories available
108
+
109
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-AWQ)
110
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GPTQ)
111
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF)
112
+ * [Jon Durbin's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/jondurbin/nontoxic-bagel-34b-v0.2)
113
+ <!-- repositories-available end -->
114
+
115
+ <!-- prompt-template start -->
116
+ ## Prompt template: Bagel-Alpaca
117
+
118
+ ```
119
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
120
+
121
+ ### Instruction:
122
+ {system_message}
123
+ {prompt}
124
+
125
+ ### Response:
126
+
127
+ ```
128
+
129
+ <!-- prompt-template end -->
130
+
131
+
132
+ <!-- compatibility_gguf start -->
133
+ ## Compatibility
134
+
135
+ These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
136
+
137
+ They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
138
+
139
+ ## Explanation of quantisation methods
140
+
141
+ <details>
142
+ <summary>Click to see details</summary>
143
+
144
+ The new methods available are:
145
+
146
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
147
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
148
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
149
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
150
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
151
+
152
+ Refer to the Provided Files table below to see what files use which methods, and how.
153
+ </details>
154
+ <!-- compatibility_gguf end -->
155
+
156
+ <!-- README_GGUF.md-provided-files start -->
157
+ ## Provided files
158
+
159
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
160
+ | ---- | ---- | ---- | ---- | ---- | ----- |
161
+ | [nontoxic-bagel-34b-v0.2.Q2_K.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q2_K.gguf) | Q2_K | 2 | 14.56 GB| 17.06 GB | smallest, significant quality loss - not recommended for most purposes |
162
+ | [nontoxic-bagel-34b-v0.2.Q3_K_S.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q3_K_S.gguf) | Q3_K_S | 3 | 14.96 GB| 17.46 GB | very small, high quality loss |
163
+ | [nontoxic-bagel-34b-v0.2.Q3_K_M.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q3_K_M.gguf) | Q3_K_M | 3 | 16.64 GB| 19.14 GB | very small, high quality loss |
164
+ | [nontoxic-bagel-34b-v0.2.Q3_K_L.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q3_K_L.gguf) | Q3_K_L | 3 | 18.14 GB| 20.64 GB | small, substantial quality loss |
165
+ | [nontoxic-bagel-34b-v0.2.Q4_0.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q4_0.gguf) | Q4_0 | 4 | 19.47 GB| 21.97 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
166
+ | [nontoxic-bagel-34b-v0.2.Q4_K_S.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q4_K_S.gguf) | Q4_K_S | 4 | 19.55 GB| 22.05 GB | small, greater quality loss |
167
+ | [nontoxic-bagel-34b-v0.2.Q4_K_M.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q4_K_M.gguf) | Q4_K_M | 4 | 20.66 GB| 23.16 GB | medium, balanced quality - recommended |
168
+ | [nontoxic-bagel-34b-v0.2.Q5_0.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q5_0.gguf) | Q5_0 | 5 | 23.71 GB| 26.21 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
169
+ | [nontoxic-bagel-34b-v0.2.Q5_K_S.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q5_K_S.gguf) | Q5_K_S | 5 | 23.71 GB| 26.21 GB | large, low quality loss - recommended |
170
+ | [nontoxic-bagel-34b-v0.2.Q5_K_M.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q5_K_M.gguf) | Q5_K_M | 5 | 24.32 GB| 26.82 GB | large, very low quality loss - recommended |
171
+ | [nontoxic-bagel-34b-v0.2.Q6_K.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q6_K.gguf) | Q6_K | 6 | 28.22 GB| 30.72 GB | very large, extremely low quality loss |
172
+ | [nontoxic-bagel-34b-v0.2.Q8_0.gguf](https://huggingface.co/TheBloke/nontoxic-bagel-34b-v0.2-GGUF/blob/main/nontoxic-bagel-34b-v0.2.Q8_0.gguf) | Q8_0 | 8 | 36.54 GB| 39.04 GB | very large, extremely low quality loss - not recommended |
173
+
174
+ **Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
175
+
176
+
177
+
178
+ <!-- README_GGUF.md-provided-files end -->
179
+
180
+ <!-- README_GGUF.md-how-to-download start -->
181
+ ## How to download GGUF files
182
+
183
+ **Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
184
+
185
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
186
+
187
+ * LM Studio
188
+ * LoLLMS Web UI
189
+ * Faraday.dev
190
+
191
+ ### In `text-generation-webui`
192
+
193
+ Under Download Model, you can enter the model repo: TheBloke/nontoxic-bagel-34b-v0.2-GGUF and below it, a specific filename to download, such as: nontoxic-bagel-34b-v0.2.Q4_K_M.gguf.
194
+
195
+ Then click Download.
196
+
197
+ ### On the command line, including multiple files at once
198
+
199
+ I recommend using the `huggingface-hub` Python library:
200
+
201
+ ```shell
202
+ pip3 install huggingface-hub
203
+ ```
204
+
205
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
206
+
207
+ ```shell
208
+ huggingface-cli download TheBloke/nontoxic-bagel-34b-v0.2-GGUF nontoxic-bagel-34b-v0.2.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
209
+ ```
210
+
211
+ <details>
212
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
213
+
214
+ You can also download multiple files at once with a pattern:
215
+
216
+ ```shell
217
+ huggingface-cli download TheBloke/nontoxic-bagel-34b-v0.2-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
218
+ ```
219
+
220
+ 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).
221
+
222
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
223
+
224
+ ```shell
225
+ pip3 install hf_transfer
226
+ ```
227
+
228
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
229
+
230
+ ```shell
231
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/nontoxic-bagel-34b-v0.2-GGUF nontoxic-bagel-34b-v0.2.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
232
+ ```
233
+
234
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
235
+ </details>
236
+ <!-- README_GGUF.md-how-to-download end -->
237
+
238
+ <!-- README_GGUF.md-how-to-run start -->
239
+ ## Example `llama.cpp` command
240
+
241
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
242
+
243
+ ```shell
244
+ ./main -ngl 35 -m nontoxic-bagel-34b-v0.2.Q4_K_M.gguf --color -c 200000 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{system_message}\n{prompt}\n\n### Response:"
245
+ ```
246
+
247
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
248
+
249
+ Change `-c 200000` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
250
+
251
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
252
+
253
+ For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
254
+
255
+ ## How to run in `text-generation-webui`
256
+
257
+ Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
258
+
259
+ ## How to run from Python code
260
+
261
+ You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
262
+
263
+ ### How to load this model in Python code, using llama-cpp-python
264
+
265
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
266
+
267
+ #### First install the package
268
+
269
+ Run one of the following commands, according to your system:
270
+
271
+ ```shell
272
+ # Base ctransformers with no GPU acceleration
273
+ pip install llama-cpp-python
274
+ # With NVidia CUDA acceleration
275
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
276
+ # Or with OpenBLAS acceleration
277
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
278
+ # Or with CLBLast acceleration
279
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
280
+ # Or with AMD ROCm GPU acceleration (Linux only)
281
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
282
+ # Or with Metal GPU acceleration for macOS systems only
283
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
284
+
285
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
286
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
287
+ pip install llama-cpp-python
288
+ ```
289
+
290
+ #### Simple llama-cpp-python example code
291
+
292
+ ```python
293
+ from llama_cpp import Llama
294
+
295
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
296
+ llm = Llama(
297
+ model_path="./nontoxic-bagel-34b-v0.2.Q4_K_M.gguf", # Download the model file first
298
+ n_ctx=200000, # The max sequence length to use - note that longer sequence lengths require much more resources
299
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
300
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
301
+ )
302
+
303
+ # Simple inference example
304
+ output = llm(
305
+ "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{system_message}\n{prompt}\n\n### Response:", # Prompt
306
+ max_tokens=512, # Generate up to 512 tokens
307
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
308
+ echo=True # Whether to echo the prompt
309
+ )
310
+
311
+ # Chat Completion API
312
+
313
+ llm = Llama(model_path="./nontoxic-bagel-34b-v0.2.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
314
+ llm.create_chat_completion(
315
+ messages = [
316
+ {"role": "system", "content": "You are a story writing assistant."},
317
+ {
318
+ "role": "user",
319
+ "content": "Write a story about llamas."
320
+ }
321
+ ]
322
+ )
323
+ ```
324
+
325
+ ## How to use with LangChain
326
+
327
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
328
+
329
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
330
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
331
+
332
+ <!-- README_GGUF.md-how-to-run end -->
333
+
334
+ <!-- footer start -->
335
+ <!-- 200823 -->
336
+ ## Discord
337
+
338
+ For further support, and discussions on these models and AI in general, join us at:
339
+
340
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
341
+
342
+ ## Thanks, and how to contribute
343
+
344
+ Thanks to the [chirper.ai](https://chirper.ai) team!
345
+
346
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
347
+
348
+ 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.
349
+
350
+ 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.
351
+
352
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
353
+
354
+ * Patreon: https://patreon.com/TheBlokeAI
355
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
356
+
357
+ **Special thanks to**: Aemon Algiz.
358
+
359
+ **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
360
+
361
+
362
+ Thank you to all my generous patrons and donaters!
363
+
364
+ And thank you again to a16z for their generous grant.
365
+
366
+ <!-- footer end -->
367
+
368
+ <!-- original-model-card start -->
369
+ # Original model card: Jon Durbin's Nontoxic Bagel 34B v0.2
370
+
371
+
372
+ # A bagel, with everything
373
+
374
+ ![bagel](bagel.png)
375
+
376
+ ## Overview
377
+
378
+ An experimental fine-tune of [yi-34b-200k](https://huggingface.co/01-ai/Yi-34B-200K) using [bagel](https://github.com/jondurbin/bagel)
379
+
380
+ This version underwent a subset of DPO, but is fairly censored. For a less censored version, try [bagel-dpo-34b-v0.2](https://hf.co/jondurbin/bagel-dpo-34b-v0.2)
381
+
382
+ ## SFT data sources
383
+
384
+ *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*
385
+
386
+ - [ai2_arc](https://huggingface.co/datasets/ai2_arc)
387
+ - Abstraction and reasoning dataset, useful in measuring "intelligence" to a certain extent.
388
+ - [airoboros](https://huggingface.co/datasets/unalignment/spicy-3.1)
389
+ - Variety of categories of synthetic instructions generated by gpt-4.
390
+ - [apps](https://huggingface.co/datasets/codeparrot/apps)
391
+ - Python coding dataset with 10k problems.
392
+ - [belebele](https://huggingface.co/datasets/facebook/belebele)
393
+ - Multi-lingual reading comprehension dataset.
394
+ - [bluemoon](https://huggingface.co/datasets/Squish42/bluemoon-fandom-1-1-rp-cleaned)
395
+ - Roleplay data scraped from Bluemoon, then cleaned and formatted as ShareGPT.
396
+ - [boolq](https://huggingface.co/datasets/boolq)
397
+ - Corpus of yes/no questions (which can be surprisingly difficult for AI to answer apparently?)
398
+ - [capybara](https://huggingface.co/datasets/LDJnr/Capybara)
399
+ - Multi-turn dataset used to create the capybara models.
400
+ - [cinematika](https://huggingface.co/datasets/jondurbin/cinematika-v0.1) (instruction and plain text)
401
+ - RP-style data synthesized from movie scripts so the model isn't quite as boring as it otherwise would be.
402
+ - [drop](https://huggingface.co/datasets/drop)
403
+ - More reading comprehension.
404
+ - [emobank](https://github.com/JULIELab/EmoBank)
405
+ - Emotion annotations using the Valence-Arousal-Domninance scheme.
406
+ - [gutenberg](https://www.gutenberg.org/) (plain text)
407
+ - Books/plain text, again to make the model less boring, only a handful of examples supported by [chapterize](https://github.com/JonathanReeve/chapterize)
408
+ - [lmsys_chat_1m](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) (only gpt-4 items, also used for DPO)
409
+ - Chats collected by the lmsys chat arena, containing a wide variety of chats with various models.
410
+ - [mathinstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
411
+ - Composite dataset with a variety of math-related tasks and problem/question formats.
412
+ - [mmlu](https://huggingface.co/datasets/cais/mmlu)
413
+ - Massive Multitask Language Understanding - a wide variety of questions about various subject matters.
414
+ - [natural_instructions](https://huggingface.co/datasets/Muennighoff/natural-instructions)
415
+ - Millions of instructions from 1600+ task categories (sampled down substantially, stratified by task type)
416
+ - [openbookqa](https://huggingface.co/datasets/openbookqa)
417
+ - Question answering dataset.
418
+ - [pippa](https://huggingface.co/datasets/kingbri/PIPPA-shareGPT)
419
+ - Deduped version of [PIPPA](https://huggingface.co/datasets/PygmalionAI/PIPPA) in ShareGPT format.
420
+ - [piqa](https://huggingface.co/datasets/piqa)
421
+ - Phyiscal interaction question answering.
422
+ - [python_alpaca](https://huggingface.co/datasets/Vezora/Tested-22k-Python-Alpaca)
423
+ - Python instruction response pairs, validated as functional.
424
+ - [rosetta_code](https://huggingface.co/datasets/cakiki/rosetta-code)
425
+ - Code problems and solutions in a variety of programming languages taken from rosettacode.org.
426
+ - [slimorca](https://huggingface.co/datasets/Open-Orca/SlimOrca)
427
+ - Collection of ~500k gpt-4 verified chats from OpenOrca.
428
+ - [spider](https://huggingface.co/datasets/spider)
429
+ - SQL-targeted dataset.
430
+ - [squad_v2](https://huggingface.co/datasets/squad_v2)
431
+ - Contextual question answering (RAG).
432
+ - [synthia](https://huggingface.co/datasets/migtissera/Synthia-v1.3)
433
+ - GPT-4 generated data using advanced prompting from Migel Tissera.
434
+ - [winogrande](https://huggingface.co/datasets/winogrande)
435
+ - Fill in the blank style prompts.
436
+
437
+ ## DPO data sources
438
+
439
+ - [airoboros 3.1](https://huggingface.co/datasets/unalignment/spicy-3.1) vs [airoboros 2.2.1](https://huggingface.co/datasets/jondurbin/airoboros-gpt4-1.4.1)
440
+ - The creative/writing tasks from airoboros-2.2.1 were re-generated using gpt4-0314 and a custom prompt to get longer, more creative, less clichè responses for airoboros 3.1, so we can use the shorter/boring version as the "rejected" value and the rerolled response as "chosen"
441
+ - [helpsteer](https://huggingface.co/datasets/nvidia/HelpSteer)
442
+ - Really neat dataset provided by the folks at NVidia with human annotation across a variety of metrics. Only items with the highest "correctness" value were used for DPO here, with the highest scoring output as "chosen" and random lower scoring value as "rejected"
443
+ - [orca_dpo_pairs](https://huggingface.co/datasets/Intel/orca_dpo_pairs)
444
+ - Another interesting dataset by Intel, which provides various DPO pairs generated from prompts included in the SlimOrca dataset.
445
+ - [toxic-dpo](https://huggingface.co/datasets/unalignment/toxic-dpo-v0.1)
446
+ - __*highly toxic and potentially illegal content!*__ De-censorship, for academic and lawful purposes only, of course. Generated by llama-2-70b via prompt engineering.
447
+ - [truthy](https://huggingface.co/datasets/jondurbin/truthy-dpo-v0.1)
448
+ - DPO pairs meant to increase truthfulness of the model, e.g. common misconceptions, differentiate between AI assistants and roleplayed human in terms of corporeal awareness/locality/etc.
449
+ - [ultrafeedback](https://huggingface.co/datasets/allenai/ultrafeedback_binarized_cleaned)
450
+ - One of the bits of magic behind the Zephyr model. Only the items with a chosen score of 8 or higher were included.
451
+
452
+ 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).
453
+
454
+ ## Prompt formatting
455
+
456
+ 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).
457
+ 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.
458
+
459
+ 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.
460
+
461
+ ### Alpaca (sort of)
462
+
463
+ ```
464
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
465
+
466
+ ### Instruction:
467
+ {system prompt, if provided}
468
+ {instruction}
469
+
470
+ ### Response:
471
+ ```
472
+
473
+ 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.
474
+
475
+ ### Vicuna
476
+
477
+ ```
478
+ {system prompt, if provided, randomly defaulting to "A chat between a user and an unbiased, uncensored assistant."}
479
+ USER: {instruction}
480
+ ASSISTANT:
481
+ ```
482
+
483
+ ### ChatML (sort of)
484
+
485
+ 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).
486
+
487
+ So, instead of:
488
+ ```text
489
+ {bos}<|im_start|>{role}
490
+ {text}
491
+ <|im_end|>{eos}
492
+ ```
493
+
494
+ I just changed it to:
495
+ ```text
496
+ {bos}{role}
497
+ {text}
498
+ {eos}
499
+ ```
500
+
501
+ 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.
502
+
503
+ ### Llama-2 chat
504
+
505
+ ```
506
+ [INST] <<SYS>>
507
+ {system}
508
+ <</SYS>>
509
+
510
+ {instruction} [/INST]
511
+ ```
512
+
513
+ <!-- original-model-card end -->