TheBloke commited on
Commit
fe675ce
1 Parent(s): a4f5bef

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +615 -0
README.md ADDED
@@ -0,0 +1,615 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/jondurbin/airoboros-l2-13b-2.2.1
3
+ datasets:
4
+ - jondurbin/airoboros-2.2.1
5
+ inference: false
6
+ license: llama2
7
+ model_creator: Jon Durbin
8
+ model_name: Airoboros L2 13B 2.2.1
9
+ model_type: llama
10
+ prompt_template: "A chat.\nUSER: {prompt}\nASSISTANT: \n"
11
+ quantized_by: TheBloke
12
+ ---
13
+
14
+ <!-- header start -->
15
+ <!-- 200823 -->
16
+ <div style="width: auto; margin-left: auto; margin-right: auto">
17
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
18
+ </div>
19
+ <div style="display: flex; justify-content: space-between; width: 100%;">
20
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
21
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
22
+ </div>
23
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
24
+ <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>
25
+ </div>
26
+ </div>
27
+ <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>
28
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
29
+ <!-- header end -->
30
+
31
+ # Airoboros L2 13B 2.2.1 - AWQ
32
+ - Model creator: [Jon Durbin](https://huggingface.co/jondurbin)
33
+ - Original model: [Airoboros L2 13B 2.2.1](https://huggingface.co/jondurbin/airoboros-l2-13b-2.2.1)
34
+
35
+ <!-- description start -->
36
+ ## Description
37
+
38
+ This repo contains AWQ model files for [Jon Durbin's Airoboros L2 13B 2.2.1](https://huggingface.co/jondurbin/airoboros-l2-13b-2.2.1).
39
+
40
+
41
+ ### About AWQ
42
+
43
+ AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference.
44
+
45
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of AWQ models for high-throughput concurrent inference in multi-user server scenarios. Note that, at the time of writing, overall throughput is still lower than running vLLM with unquantised models, however using AWQ enables using much smaller GPUs which can lead to easier deployment and overall cost savings. For example, a 70B model can be run on 1 x 48GB GPU instead of 2 x 80GB.
46
+ <!-- description end -->
47
+ <!-- repositories-available start -->
48
+ ## Repositories available
49
+
50
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/airoboros-l2-13B-2.2.1-AWQ)
51
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/airoboros-l2-13B-2.2.1-GPTQ)
52
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/airoboros-l2-13B-2.2.1-GGUF)
53
+ * [Jon Durbin's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/jondurbin/airoboros-l2-13b-2.2.1)
54
+ <!-- repositories-available end -->
55
+
56
+ <!-- prompt-template start -->
57
+ ## Prompt template: Chat
58
+
59
+ ```
60
+ A chat.
61
+ USER: {prompt}
62
+ ASSISTANT:
63
+
64
+ ```
65
+
66
+ <!-- prompt-template end -->
67
+
68
+
69
+ <!-- README_AWQ.md-provided-files start -->
70
+ ## Provided files and AWQ parameters
71
+
72
+ For my first release of AWQ models, I am releasing 128g models only. I will consider adding 32g as well if there is interest, and once I have done perplexity and evaluation comparisons, but at this time 32g models are still not fully tested with AutoAWQ and vLLM.
73
+
74
+ Models are released as sharded safetensors files.
75
+
76
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
77
+ | ------ | ---- | -- | ----------- | ------- | ---- |
78
+ | [main](https://huggingface.co/TheBloke/airoboros-l2-13B-2.2.1-AWQ/tree/main) | 4 | 128 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.25 GB
79
+
80
+ <!-- README_AWQ.md-provided-files end -->
81
+
82
+ <!-- README_AWQ.md-use-from-vllm start -->
83
+ ## Serving this model from vLLM
84
+
85
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
86
+
87
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
88
+
89
+ ```shell
90
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/airoboros-l2-13B-2.2.1-AWQ --quantization awq --dtype half
91
+ ```
92
+
93
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
94
+
95
+ ```python
96
+ from vllm import LLM, SamplingParams
97
+
98
+ prompts = [
99
+ "Hello, my name is",
100
+ "The president of the United States is",
101
+ "The capital of France is",
102
+ "The future of AI is",
103
+ ]
104
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
105
+
106
+ llm = LLM(model="TheBloke/airoboros-l2-13B-2.2.1-AWQ", quantization="awq", dtype="half")
107
+
108
+ outputs = llm.generate(prompts, sampling_params)
109
+
110
+ # Print the outputs.
111
+ for output in outputs:
112
+ prompt = output.prompt
113
+ generated_text = output.outputs[0].text
114
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
115
+ ```
116
+ <!-- README_AWQ.md-use-from-vllm start -->
117
+
118
+ <!-- README_AWQ.md-use-from-python start -->
119
+ ## How to use this AWQ model from Python code
120
+
121
+ ### Install the necessary packages
122
+
123
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
124
+
125
+ ```shell
126
+ pip3 install autoawq
127
+ ```
128
+
129
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
130
+
131
+ ```shell
132
+ pip3 uninstall -y autoawq
133
+ git clone https://github.com/casper-hansen/AutoAWQ
134
+ cd AutoAWQ
135
+ pip3 install .
136
+ ```
137
+
138
+ ### You can then try the following example code
139
+
140
+ ```python
141
+ from awq import AutoAWQForCausalLM
142
+ from transformers import AutoTokenizer
143
+
144
+ model_name_or_path = "TheBloke/airoboros-l2-13B-2.2.1-AWQ"
145
+
146
+ # Load model
147
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
148
+ trust_remote_code=False, safetensors=True)
149
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
150
+
151
+ prompt = "Tell me about AI"
152
+ prompt_template=f'''A chat.
153
+ USER: {prompt}
154
+ ASSISTANT:
155
+
156
+ '''
157
+
158
+ print("\n\n*** Generate:")
159
+
160
+ tokens = tokenizer(
161
+ prompt_template,
162
+ return_tensors='pt'
163
+ ).input_ids.cuda()
164
+
165
+ # Generate output
166
+ generation_output = model.generate(
167
+ tokens,
168
+ do_sample=True,
169
+ temperature=0.7,
170
+ top_p=0.95,
171
+ top_k=40,
172
+ max_new_tokens=512
173
+ )
174
+
175
+ print("Output: ", tokenizer.decode(generation_output[0]))
176
+
177
+ # Inference can also be done using transformers' pipeline
178
+ from transformers import pipeline
179
+
180
+ print("*** Pipeline:")
181
+ pipe = pipeline(
182
+ "text-generation",
183
+ model=model,
184
+ tokenizer=tokenizer,
185
+ max_new_tokens=512,
186
+ do_sample=True,
187
+ temperature=0.7,
188
+ top_p=0.95,
189
+ top_k=40,
190
+ repetition_penalty=1.1
191
+ )
192
+
193
+ print(pipe(prompt_template)[0]['generated_text'])
194
+ ```
195
+ <!-- README_AWQ.md-use-from-python end -->
196
+
197
+ <!-- README_AWQ.md-compatibility start -->
198
+ ## Compatibility
199
+
200
+ The files provided are tested to work with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), and [vLLM](https://github.com/vllm-project/vllm).
201
+
202
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is not yet compatible with AWQ, but a PR is open which should bring support soon: [TGI PR #781](https://github.com/huggingface/text-generation-inference/issues/781).
203
+ <!-- README_AWQ.md-compatibility end -->
204
+
205
+ <!-- footer start -->
206
+ <!-- 200823 -->
207
+ ## Discord
208
+
209
+ For further support, and discussions on these models and AI in general, join us at:
210
+
211
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
212
+
213
+ ## Thanks, and how to contribute
214
+
215
+ Thanks to the [chirper.ai](https://chirper.ai) team!
216
+
217
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
218
+
219
+ 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.
220
+
221
+ 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.
222
+
223
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
224
+
225
+ * Patreon: https://patreon.com/TheBlokeAI
226
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
227
+
228
+ **Special thanks to**: Aemon Algiz.
229
+
230
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
231
+
232
+
233
+ Thank you to all my generous patrons and donaters!
234
+
235
+ And thank you again to a16z for their generous grant.
236
+
237
+ <!-- footer end -->
238
+
239
+ # Original model card: Jon Durbin's Airoboros L2 13B 2.2.1
240
+
241
+
242
+ ### Overview
243
+
244
+ Another experimental model, using mostly sythetic data generated by [airoboros](https://github.com/jondurbin/airoboros)
245
+
246
+ This is essentially a minor "fix" branch of [airoboros-l2-13b-2.2](https://hf.co/jondurbin/airoboros-l2-13b-2.2) with a updates, primarily:
247
+ - [re-generated writing responses](https://huggingface.co/datasets/jondurbin/airoboros-2.2.1#re-generated-writing-responses)
248
+ - [longer contextual blocks](https://huggingface.co/datasets/jondurbin/airoboros-2.2.1#longer-contextual-blocks)
249
+ - [removal of "rp" data](https://huggingface.co/datasets/jondurbin/airoboros-2.2.1#rp-category-removed)
250
+ - [(less aggressive) de-censoring](https://huggingface.co/datasets/jondurbin/airoboros-2.2.1#de-censoring)
251
+ - more fine-tuning epochs
252
+
253
+ This is a fairly general purpose model, but focuses heavily on instruction following, rather than casual chat/roleplay.
254
+
255
+ Huge thank you to the folks over at [a16z](https://a16z.com/) for sponsoring the costs associated with building models and associated tools!
256
+
257
+ ### Prompt format
258
+
259
+ The prompt format:
260
+
261
+ ```
262
+ A chat.
263
+ USER: {prompt}
264
+ ASSISTANT:
265
+ ```
266
+
267
+ The default system prompt ("A chat.") was used for most of the prompts, however it also included a wide sampling of responses with other prompts, particularly in "stylized\_response", "rp", "gtkm", etc.
268
+
269
+ Here's another example:
270
+ ```
271
+ A chat between Bob (aka USER) and Tom (aka ASSISTANT). Tom is an extremely intelligent 18th century bookkeeper, who speaks loquaciously.
272
+ USER: {prompt}
273
+ ASSISTANT:
274
+ ```
275
+
276
+ And chat scenario that wouldn't require USER/ASSISTANT (but should use stopping criteria to prevent the model from speaking on your behalf).
277
+ ```
278
+ A chat between old friends: Timmy and Tommy.
279
+ {description of characters}
280
+
281
+ {setting for the chat}
282
+ Timmy: *takes a big sip from his coffee* "Ah, sweet, delicious, magical coffee."
283
+ Tommy:
284
+ ```
285
+
286
+ __*I strongly suggest adding stopping criteria/early inference stopping on "USER:", and/or whatever names you specify in the system prompt.*__
287
+
288
+ ### Fine tuning info
289
+
290
+ https://wandb.ai/jondurbin/airoboros-l2-13b-2.2.1/runs/zbz8mgaz?workspace=user-jondurbin
291
+
292
+ ### Helpful usage tips
293
+
294
+ *The prompts shown here are are just the text that would be included after USER: and before ASSISTANT: in the full prompt format above, the system prompt and USER:/ASSISTANT: have been omited for readability.*
295
+
296
+ #### Context obedient question answering
297
+
298
+ 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.
299
+
300
+ The format for a closed-context prompt is as follows:
301
+ ```
302
+ BEGININPUT
303
+ BEGINCONTEXT
304
+ [key0: value0]
305
+ [key1: value1]
306
+ ... other metdata ...
307
+ ENDCONTEXT
308
+ [insert your text blocks here]
309
+ ENDINPUT
310
+ [add as many other blocks, in the exact same format]
311
+ BEGININSTRUCTION
312
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
313
+ ENDINSTRUCTION
314
+ ```
315
+
316
+ 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.
317
+
318
+ *The __only__ prompts that need this closed context formating are closed-context instructions. Normal questions/instructions do not!*
319
+
320
+ 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.
321
+ - `BEGININPUT` - denotes a new input block
322
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
323
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
324
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
325
+ - `ENDINPUT` - denotes the end of the current input block
326
+ - [repeat as many input blocks in this format as you want]
327
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
328
+ - [instruction(s)]
329
+ - `ENDINSTRUCTION` - denotes the end of instruction set
330
+
331
+ 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.
332
+
333
+ Here's a trivial, but important example to prove the point:
334
+ ```
335
+ BEGININPUT
336
+ BEGINCONTEXT
337
+ date: 2021-01-01
338
+ url: https://web.site/123
339
+ ENDCONTEXT
340
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
341
+ ENDINPUT
342
+ BEGININSTRUCTION
343
+ What color are bluberries? Source?
344
+ ENDINSTRUCTION
345
+ ```
346
+
347
+ And the response:
348
+ ```
349
+ Blueberries are now green.
350
+ Source:
351
+ date: 2021-01-01
352
+ url: https://web.site/123
353
+ ```
354
+
355
+ #### Summarization
356
+
357
+ 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:
358
+
359
+ ```
360
+ BEGININPUT
361
+ {text to summarize}
362
+ ENDINPUT
363
+ BEGININSTRUCTION
364
+ Summarize the input in around 130 words.
365
+ ENDINSTRUCTION
366
+ ```
367
+
368
+ #### Getting longer responses
369
+
370
+ You can use a few techniques to get longer responses.
371
+
372
+ Detailed prompts, with explicit instruction for word count:
373
+ ```
374
+ 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.
375
+
376
+ 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.
377
+
378
+ 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.
379
+
380
+ 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.
381
+
382
+ Your response should be approximately 2300 words.
383
+ ```
384
+
385
+ Or, a simpler example:
386
+ ```
387
+ 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.
388
+ ```
389
+
390
+ #### Coding
391
+
392
+ You can ask for fairly complex coding instructions with multiple criteria, e.g.:
393
+
394
+ ```
395
+ Create a python application with the following requirements:
396
+ - Asyncio FastAPI webserver
397
+ - ping endpoint that returns the current date in JSON format
398
+ - file upload endpoint, which calculates the file's sha256 checksum, and checks postgres to deduplicate
399
+ ```
400
+
401
+ Or inline criteria:
402
+
403
+ ```
404
+ 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.
405
+ ```
406
+
407
+ 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.:
408
+
409
+ ```
410
+ Write a websocket application in node.js. PLAINFORMAT
411
+ ```
412
+
413
+ #### Agent/function calling
414
+
415
+ 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.
416
+
417
+ Example prompt:
418
+ ```
419
+ 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.
420
+
421
+ Input: I want to know how many times 'Python' is mentioned in my text file.
422
+
423
+ Available functions:
424
+ file_analytics:
425
+ description: This tool performs various operations on a text file.
426
+ params:
427
+ action: The operation we want to perform on the data, such as "count_occurrences", "find_line", etc.
428
+ filters:
429
+ keyword: The word or phrase we want to search for.
430
+ ```
431
+
432
+ Response:
433
+ ```json
434
+ {
435
+ "function": "file_analytics",
436
+ "params": {
437
+ "action": "count_occurrences",
438
+ "filters": {
439
+ "keyword": "Python"
440
+ }
441
+ }
442
+ }
443
+ ```
444
+
445
+ #### Chain-of-thought
446
+
447
+ You can ask for several possible responses to a given problem, with a ranking and final answer selection.
448
+
449
+ Example prompt:
450
+
451
+ ```
452
+ 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.
453
+ ```
454
+
455
+ Example response:
456
+ ```
457
+ Solution 1:
458
+ 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).
459
+
460
+ 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:
461
+
462
+ n(n-1)/2 = 45
463
+
464
+ Solving this equation gives us n=10.
465
+
466
+ Final answer: There were 10 players in the tournament.
467
+
468
+ Solution 2:
469
+ 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.
470
+
471
+ 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.
472
+
473
+ Final answer: There were 10 players in the tournament.
474
+
475
+ Solution 3:
476
+ 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.
477
+
478
+ Final answer: There were 10 players in the tournament.
479
+
480
+ Ranking of solutions from best to worst:
481
+ 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.
482
+ 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.
483
+ 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.
484
+
485
+ Best and final answer: There were 10 players in the tournament.
486
+ ```
487
+
488
+ #### reWOO style execution planning
489
+
490
+ 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!
491
+
492
+ Example prompt:
493
+ ```
494
+ 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
495
+ that could be the user's question, one or more prior evidence values, or a combination of both.
496
+
497
+ Here are the tools available to be called:
498
+ 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.
499
+ 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.
500
+ HyperlinkExtractor[input]: Extract links from plain text and produces a plain text, newline delimited response of links.
501
+ 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:?
502
+
503
+ The output should be in format:
504
+ Plan: [first action to take based on input question]
505
+ :evidence0: = [function to call with input parameter]
506
+ Plan: [next action to take, based on result of :evidence0:]
507
+ :evidence1: = [next function to call and input parameter, which may include reference to previous evidence, e.g. "Given context :evidence0"]
508
+ ...
509
+ Answer: [:evidence[n]: containing the final answer.]
510
+
511
+ Question: Who won the Nobel Prize in Literature in 2020 and what is their most famous work?
512
+ ```
513
+
514
+ Response:
515
+ ```
516
+ Plan: Begin by conducting a web search to find out who won the Nobel Prize in Literature in 2020.
517
+ :evidence0: = DuckDuckGo[Nobel Prize in Literature 2020 winner]
518
+ Plan: Utilize the KnowledgeModel to interpret the search results and find the name of the laureate.
519
+ :evidence1: = KnowledgeModel[Who won the Nobel Prize in Literature in 2020, given :evidence0:?]
520
+ Plan: Conduct another web search to find the most famous work of the identified laureate.
521
+ :evidence2: = DuckDuckGo[Most famous work of :evidence1:]
522
+ Plan: Extract the relevant links from the DuckDuckGo search results for a more focused search.
523
+ :evidence3: = HyperlinkExtractor[:evidence2:]
524
+ Plan: Use the TextScraper tool to extract information from the relevant links.
525
+ :evidence4: = TextScraper[:evidence3:]
526
+ Plan: Finally, utilize the KnowledgeModel to identify and summarize the most famous work of the laureate from the extracted information.
527
+ :evidence5: = KnowledgeModel[What is the most famous work of :evidence1:, given :evidence4:?]
528
+ Answer: :evidence5:
529
+ ```
530
+
531
+ 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:
532
+
533
+ ```python
534
+ import re
535
+ import requests
536
+
537
+ def inject_context(input_text, **context):
538
+ for ref in set(re.findall(r"(:evidence[0-9]+:)", input_text, re.I)):
539
+ input_text = input_text.replace(ref, context.get(ref, ""))
540
+ return input_text
541
+
542
+ def duckduckgo(input_text, **context):
543
+ search_string = inject_context(input_text, **context)
544
+ ... search via duck duck go using search_string
545
+ ... return text content
546
+
547
+ def link_extractor(input_text, **context):
548
+ input_text = inject_context(input_text, **context)
549
+ return "\n".join(list(set(re.findall(r"(https?://[^\s]+?\.?)", input_text, re.I))))
550
+
551
+ def scrape(input_text, **context):
552
+ input_text = inject_context(input_text, **context)
553
+ text = []
554
+ for link in input_text.splitlines():
555
+ text.append(requests.get(link).text)
556
+ return "\n".join(text)
557
+
558
+ def infer(input_text, **context)
559
+ prompt = inject_context(input_text, **context)
560
+ ... call model with prompt, return output
561
+
562
+ def parse_plan(plan):
563
+ method_map = {
564
+ "DuckDuckGo": duckduckgo,
565
+ "HyperlinkExtractor": link_extractor,
566
+ "KnowledgeModel": infer,
567
+ "TextScraper": scrape,
568
+ }
569
+ context = {}
570
+ for line in plan.strip().splitlines():
571
+ if line.startswith("Plan:"):
572
+ print(line)
573
+ continue
574
+ parts = re.match("^(:evidence[0-9]+:)\s*=\s*([^\[]+])(\[.*\])\s$", line, re.I)
575
+ if not parts:
576
+ if line.startswith("Answer: "):
577
+ return context.get(line.split(" ")[-1].strip(), "Answer couldn't be generated...")
578
+ raise RuntimeError("bad format: " + line)
579
+ context[parts.group(1)] = method_map[parts.group(2)](parts.group(3), **context)
580
+ ```
581
+
582
+ ### Contribute
583
+
584
+ If you're interested in new functionality, particularly a new "instructor" type to generate a specific type of training data,
585
+ 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.
586
+
587
+ To help me with the OpenAI/compute costs:
588
+
589
+ - https://bmc.link/jondurbin
590
+ - ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
591
+ - BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
592
+
593
+ ### Licence and usage restrictions
594
+
595
+ The airoboros 2.2 models are built on top of llama-2/codellama.
596
+
597
+ The llama-2 base model has a custom Meta license:
598
+ - See the [meta-license/LICENSE.txt](meta-license/LICENSE.txt) file attached for the original license provided by Meta.
599
+ - 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.
600
+
601
+ The fine-tuning data was mostly generated by OpenAI API calls to gpt-4, via [airoboros](https://github.com/jondurbin/airoboros)
602
+
603
+ The ToS for OpenAI API usage has a clause preventing the output from being used to train a model that __competes__ with OpenAI
604
+
605
+ - what does *compete* actually mean here?
606
+ - 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
607
+ - 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
608
+ - 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
609
+ - 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
610
+
611
+ 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.
612
+
613
+ Your best bet is probably to avoid using this commercially due to the OpenAI API usage.
614
+
615
+ Either way, by using this model, you agree to completely indemnify me.