TheBloke commited on
Commit
ace51d6
1 Parent(s): 46ecad8

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +381 -0
README.md ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Nexusflow/NexusRaven-13B
3
+ inference: false
4
+ license: llama2
5
+ model-index:
6
+ - name: NexusRaven-13B
7
+ results: []
8
+ model_creator: Nexusflow
9
+ model_name: Nexusraven 13B
10
+ model_type: llama
11
+ prompt_template: '{prompt}
12
+
13
+ '
14
+ quantized_by: TheBloke
15
+ ---
16
+
17
+ <!-- header start -->
18
+ <!-- 200823 -->
19
+ <div style="width: auto; margin-left: auto; margin-right: auto">
20
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
21
+ </div>
22
+ <div style="display: flex; justify-content: space-between; width: 100%;">
23
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
24
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
25
+ </div>
26
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
27
+ <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>
28
+ </div>
29
+ </div>
30
+ <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>
31
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
32
+ <!-- header end -->
33
+
34
+ # Nexusraven 13B - AWQ
35
+ - Model creator: [Nexusflow](https://huggingface.co/Nexusflow)
36
+ - Original model: [Nexusraven 13B](https://huggingface.co/Nexusflow/NexusRaven-13B)
37
+
38
+ <!-- description start -->
39
+ ## Description
40
+
41
+ This repo contains AWQ model files for [Nexusflow's Nexusraven 13B](https://huggingface.co/Nexusflow/NexusRaven-13B).
42
+
43
+
44
+ ### About AWQ
45
+
46
+ 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.
47
+
48
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of Llama AWQ models for high-throughput concurrent inference in multi-user server scenarios.
49
+
50
+ As of September 25th 2023, preliminary Llama-only AWQ support has also been added to [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference).
51
+
52
+ Note that, at the time of writing, overall throughput is still lower than running vLLM or TGI 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.
53
+ <!-- description end -->
54
+ <!-- repositories-available start -->
55
+ ## Repositories available
56
+
57
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/NexusRaven-13B-AWQ)
58
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/NexusRaven-13B-GPTQ)
59
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/NexusRaven-13B-GGUF)
60
+ * [Nexusflow's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Nexusflow/NexusRaven-13B)
61
+ <!-- repositories-available end -->
62
+
63
+ <!-- prompt-template start -->
64
+ ## Prompt template: Unknown
65
+
66
+ ```
67
+ {prompt}
68
+
69
+ ```
70
+
71
+ <!-- prompt-template end -->
72
+
73
+
74
+ <!-- README_AWQ.md-provided-files start -->
75
+ ## Provided files, and AWQ parameters
76
+
77
+ 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.
78
+
79
+ Models are released as sharded safetensors files.
80
+
81
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
82
+ | ------ | ---- | -- | ----------- | ------- | ---- |
83
+ | [main](https://huggingface.co/TheBloke/NexusRaven-13B-AWQ/tree/main) | 4 | 128 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 16384 | 7.25 GB
84
+
85
+ <!-- README_AWQ.md-provided-files end -->
86
+
87
+ <!-- README_AWQ.md-use-from-vllm start -->
88
+ ## Serving this model from vLLM
89
+
90
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
91
+
92
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
93
+
94
+ If you try the vLLM examples below and get an error about `quantization` being unrecognised, or other AWQ-related issues, please install vLLM from Github source.
95
+
96
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
97
+
98
+ ```shell
99
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/NexusRaven-13B-AWQ --quantization awq --dtype half
100
+ ```
101
+
102
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
103
+
104
+ ```python
105
+ from vllm import LLM, SamplingParams
106
+
107
+ prompts = [
108
+ "Hello, my name is",
109
+ "The president of the United States is",
110
+ "The capital of France is",
111
+ "The future of AI is",
112
+ ]
113
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
114
+
115
+ llm = LLM(model="TheBloke/NexusRaven-13B-AWQ", quantization="awq", dtype="half")
116
+
117
+ outputs = llm.generate(prompts, sampling_params)
118
+
119
+ # Print the outputs.
120
+ for output in outputs:
121
+ prompt = output.prompt
122
+ generated_text = output.outputs[0].text
123
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
124
+ ```
125
+ <!-- README_AWQ.md-use-from-vllm start -->
126
+
127
+ <!-- README_AWQ.md-use-from-python start -->
128
+ ## Serving this model from TGI
129
+
130
+ TGI merged support for AWQ on September 25th, 2023. At the time of writing you need to use the `:latest` Docker container: `ghcr.io/huggingface/text-generation-inference:latest`
131
+
132
+ Add the parameter `--quantize awq` for AWQ support.
133
+
134
+ Example parameters:
135
+ ```shell
136
+ --model-id TheBloke/NexusRaven-13B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
137
+ ```
138
+
139
+ ## How to use this AWQ model from Python code
140
+
141
+ ### Install the necessary packages
142
+
143
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
144
+
145
+ ```shell
146
+ pip3 install autoawq
147
+ ```
148
+
149
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
150
+
151
+ ```shell
152
+ pip3 uninstall -y autoawq
153
+ git clone https://github.com/casper-hansen/AutoAWQ
154
+ cd AutoAWQ
155
+ pip3 install .
156
+ ```
157
+
158
+ ### You can then try the following example code
159
+
160
+ ```python
161
+ from awq import AutoAWQForCausalLM
162
+ from transformers import AutoTokenizer
163
+
164
+ model_name_or_path = "TheBloke/NexusRaven-13B-AWQ"
165
+
166
+ # Load model
167
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
168
+ trust_remote_code=False, safetensors=True)
169
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
170
+
171
+ prompt = "Tell me about AI"
172
+ prompt_template=f'''{prompt}
173
+
174
+ '''
175
+
176
+ print("\n\n*** Generate:")
177
+
178
+ tokens = tokenizer(
179
+ prompt_template,
180
+ return_tensors='pt'
181
+ ).input_ids.cuda()
182
+
183
+ # Generate output
184
+ generation_output = model.generate(
185
+ tokens,
186
+ do_sample=True,
187
+ temperature=0.7,
188
+ top_p=0.95,
189
+ top_k=40,
190
+ max_new_tokens=512
191
+ )
192
+
193
+ print("Output: ", tokenizer.decode(generation_output[0]))
194
+
195
+ """
196
+ # Inference should be possible with transformers pipeline as well in future
197
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
198
+ from transformers import pipeline
199
+
200
+ print("*** Pipeline:")
201
+ pipe = pipeline(
202
+ "text-generation",
203
+ model=model,
204
+ tokenizer=tokenizer,
205
+ max_new_tokens=512,
206
+ do_sample=True,
207
+ temperature=0.7,
208
+ top_p=0.95,
209
+ top_k=40,
210
+ repetition_penalty=1.1
211
+ )
212
+
213
+ print(pipe(prompt_template)[0]['generated_text'])
214
+ """
215
+ ```
216
+ <!-- README_AWQ.md-use-from-python end -->
217
+
218
+ <!-- README_AWQ.md-compatibility start -->
219
+ ## Compatibility
220
+
221
+ The files provided are tested to work with:
222
+
223
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
224
+ - [vLLM](https://github.com/vllm-project/vllm)
225
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
226
+
227
+ TGI merged AWQ support on September 25th, 2023: [TGI PR #1054](https://github.com/huggingface/text-generation-inference/pull/1054). Use the `:latest` Docker container until the next TGI release is made.
228
+
229
+ <!-- README_AWQ.md-compatibility end -->
230
+
231
+ <!-- footer start -->
232
+ <!-- 200823 -->
233
+ ## Discord
234
+
235
+ For further support, and discussions on these models and AI in general, join us at:
236
+
237
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
238
+
239
+ ## Thanks, and how to contribute
240
+
241
+ Thanks to the [chirper.ai](https://chirper.ai) team!
242
+
243
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
244
+
245
+ 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.
246
+
247
+ 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.
248
+
249
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
250
+
251
+ * Patreon: https://patreon.com/TheBlokeAI
252
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
253
+
254
+ **Special thanks to**: Aemon Algiz.
255
+
256
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
257
+
258
+
259
+ Thank you to all my generous patrons and donaters!
260
+
261
+ And thank you again to a16z for their generous grant.
262
+
263
+ <!-- footer end -->
264
+
265
+ # Original model card: Nexusflow's Nexusraven 13B
266
+
267
+ # NexusRaven-13B: Surpassing the state-of-the-art in open-source function calling LLMs.
268
+
269
+ <p align="center">
270
+ <a href="https://huggingface.co/Nexusflow" target="_blank">Nexusflow HF</a> - <a href="http://nexusflow.ai/blog" target="_blank">NexusRaven blog post</a> - <a href="https://huggingface.co/Nexusflow/NexusRaven-13B" target="_blank">NexusRaven-13B</a> - <a href="https://x.com/NexusflowX/status/1707470614012035561?s=20" target="_blank">NexusRaven-13B Twitter Thread</a> - <a href="https://github.com/nexusflowai/NexusRaven/" target="_blank">NexusRaven-13B Github</a> - <a href="https://huggingface.co/datasets/Nexusflow/NexusRaven_API_evaluation" target="_blank">NexusRaven API evaluation dataset</a>
271
+ </p>
272
+
273
+ <p align="center" width="100%">
274
+ <a><img src="NexusRaven.png" alt="NexusRaven" style="width: 40%; min-width: 300px; display: block; margin: auto;"></a>
275
+ </p>
276
+
277
+ Table of contents
278
+ - [NexusRaven-13B: Surpassing the state-of-the-art in open-source function calling LLMs.](#nexusraven-13b-surpassing-the-state-of-the-art-in-open-source-function-calling-llms)
279
+ - [Introducing NexusRaven-13B](#introducing-nexusraven-13b)
280
+ - [NexusRaven model usage](#nexusraven-model-usage)
281
+ - [Training procedure](#training-procedure)
282
+ - [Training hyperparameters](#training-hyperparameters)
283
+ - [Framework versions](#framework-versions)
284
+ - [Limitations](#limitations)
285
+ - [License](#license)
286
+ - [References](#references)
287
+ - [Citation](#citation)
288
+ - [Contact](#contact)
289
+
290
+
291
+ This model is a fine-tuned version of [codellama/CodeLlama-13b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-13b-Instruct-hf).
292
+
293
+ ## Introducing NexusRaven-13B
294
+ NexusRaven is an open-source and commercially viable function calling LLM that surpasses the state-of-the-art in function calling capabilities.
295
+
296
+ 📊 Performance Highlights: With our demonstration retrieval system, NexusRaven-13B achieves a 95% success rate in using cybersecurity tools such as CVE/CPE Search and VirusTotal, while prompting GPT-4 achieves 64%. It has significantly lower cost and faster inference speed compared to GPT-4.
297
+
298
+ 🔧 Generalization to the Unseen: NexusRaven-13B generalizes to tools never seen during model training, achieving a success rate comparable with GPT-3.5 in zero-shot setting, significantly outperforming all other open-source LLMs of similar sizes.
299
+
300
+ 🔥 Commercially Permissive: The training of NexusRaven-13B does not involve any data generated by proprietary LLMs such as GPT-4. You have full control of the model when deployed in commercial applications.
301
+
302
+ <p align="center" width="100%">
303
+ <a><img src="Retrieval-augmented_Evaluation.png" alt="NexusRaven" style="width: 80%; min-width: 300px; display: block; margin: auto;"></a>
304
+ <a><img src="Zero-shot_Evaluation.png" alt="NexusRaven" style="width: 80%; min-width: 300px; display: block; margin: auto;"></a>
305
+ </p>
306
+
307
+
308
+ ## NexusRaven model usage
309
+ NexusRaven accepts a list of python functions. These python functions can do anything (including sending GET/POST requests to external APIs!). The two requirements include the python function signature and the appropriate docstring to generate the function call.
310
+
311
+ NexusRaven is highly compatible with langchain. See [langchain_example.py](https://huggingface.co/Nexusflow/NexusRaven-13B/blob/main/langchain_example.py). An example without langchain can be found in [non_langchain_example.py](https://huggingface.co/Nexusflow/NexusRaven-13B/blob/main/non_langchain_example.py)
312
+
313
+ Please note that the model will reflect on the answer sometimes, so we highly recommend stopping the model generation at a stopping criteria of `["\nReflection:"]`, to avoid spending unnecessary tokens during inference, but the reflection might help in some rare cases. This is reflected in our langchain example.
314
+
315
+ The "Initial Answer" can be executed to run the function.
316
+
317
+
318
+ ## Training procedure
319
+
320
+ ### Training hyperparameters
321
+
322
+ The following hyperparameters were used during training:
323
+ - learning_rate: 3e-05
324
+ - train_batch_size: 1
325
+ - eval_batch_size: 1
326
+ - seed: 42
327
+ - distributed_type: multi-GPU
328
+ - num_devices: 8
329
+ - gradient_accumulation_steps: 16
330
+ - total_train_batch_size: 128
331
+ - total_eval_batch_size: 8
332
+ - optimizer: Adam with betas=(0.9,0.95) and epsilon=1e-08
333
+ - lr_scheduler_type: constant
334
+ - num_epochs: 2.0
335
+
336
+
337
+ ### Framework versions
338
+
339
+ - Transformers 4.33.2
340
+ - Pytorch 2.0.1+cu118
341
+ - Datasets 2.14.5
342
+ - Tokenizers 0.13.3
343
+
344
+
345
+ # Limitations
346
+ 1. We highly recommend using a stop criteria of `["\nReflection:"]`. The model was trained to first generate an answer and then reflect on its answer to either improve the answer or keep the answer the same. However, this "chain of thought" is often not helpful, and the final answer is seldom better than the initial call. Therefore, we strongly recommend using the Initial Call as the main call to execute.
347
+ 2. The model works best when it is connected with a retriever when there are a multitude of functions, as a large number of functions will saturate the context window of this model.
348
+ 3. The model can be prone to generate incorrect calls. Please ensure proper guardrails to capture errant behavior is in place.
349
+
350
+
351
+ ## License
352
+ This model was trained on commercially viable data and is licensed under the [Llama 2 community license](https://huggingface.co/codellama/CodeLlama-13b-hf/blob/main/LICENSE) following the original [CodeLlama-13b-hf](https://huggingface.co/codellama/CodeLlama-13b-hf/) model.
353
+
354
+
355
+ ## References
356
+ We thank the CodeLlama team for their amazing models!
357
+
358
+ ```
359
+ @misc{rozière2023code,
360
+ title={Code Llama: Open Foundation Models for Code},
361
+ author={Baptiste Rozière and Jonas Gehring and Fabian Gloeckle and Sten Sootla and Itai Gat and Xiaoqing Ellen Tan and Yossi Adi and Jingyu Liu and Tal Remez and Jérémy Rapin and Artyom Kozhevnikov and Ivan Evtimov and Joanna Bitton and Manish Bhatt and Cristian Canton Ferrer and Aaron Grattafiori and Wenhan Xiong and Alexandre Défossez and Jade Copet and Faisal Azhar and Hugo Touvron and Louis Martin and Nicolas Usunier and Thomas Scialom and Gabriel Synnaeve},
362
+ year={2023},
363
+ eprint={2308.12950},
364
+ archivePrefix={arXiv},
365
+ primaryClass={cs.CL}
366
+ }
367
+ ```
368
+
369
+
370
+ ## Citation
371
+ ```
372
+ @misc{nexusraven,
373
+ title={NexusRaven: Surpassing the state-of-the-art in open-source function calling LLMs},
374
+ author={Nexusflow.ai team},
375
+ year={2023},
376
+ url={http://nexusflow.ai/blog}
377
+ }
378
+ ```
379
+
380
+ ## Contact
381
+ Please reach out to info@nexusflow.ai for any questions!