These files were quantised using hardware kindly provided by Massed Compute.
About AWQ
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 with equivalent or better quality compared to the most commonly used GPTQ settings.
AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
Function:
def function_here(arg1):
"""
Comments explaining the function here
Args:
list args
Returns:
list returns
"""
Function:
def another_function_here(arg1):
...
User Query: {prompt}<human_end>
Licensing
The creator of the source model has listed its license as other, and this quantization has therefore used that same license.
As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: Nexusflow's NexusRaven V2 13B.
Provided files, and AWQ parameters
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
Please ensure you are using vLLM version 0.2 or later.
When using vLLM as a server, pass the --quantization awq parameter.
For example:
python3 -m vllm.entrypoints.api_server --model TheBloke/NexusRaven-V2-13B-AWQ --quantization awq --dtype auto
When using vLLM from Python code, again set quantization=awq.
For example:
python
1from vllm import LLM, SamplingParams
23prompts =[4"Tell me about AI",5"Write a story about llamas",6"What is 291 - 150?",7"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",8]9prompt_template=f'''Function:
10def function_here(arg1):
11 """
12 Comments explaining the function here
1314 Args:
15 list args
1617 Returns:
18 list returns
19 """
2021Function:
22def another_function_here(arg1):
23 ...
2425User Query: {prompt}<human_end>
26'''2728prompts =[prompt_template.format(prompt=prompt)for prompt in prompts]2930sampling_params = SamplingParams(temperature=0.8, top_p=0.95)3132llm = LLM(model="TheBloke/NexusRaven-V2-13B-AWQ", quantization="awq", dtype="auto")3334outputs = llm.generate(prompts, sampling_params)3536# Print the outputs.37for output in outputs:38 prompt = output.prompt
39 generated_text = output.outputs[0].text
40print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
Multi-user inference server: Hugging Face Text Generation Inference (TGI)
Use TGI version 1.1.0 or later. The official Docker container is: ghcr.io/huggingface/text-generation-inference:1.1.0
Transformers example code (requires Transformers 4.35.0 and later)
python
1from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
23model_name_or_path ="TheBloke/NexusRaven-V2-13B-AWQ"45tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)6model = AutoModelForCausalLM.from_pretrained(7 model_name_or_path,8 low_cpu_mem_usage=True,9 device_map="cuda:0"10)1112# Using the text streamer to stream output one token at a time13streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)1415prompt ="Tell me about AI"16prompt_template=f'''Function:
17def function_here(arg1):
18 """
19 Comments explaining the function here
2021 Args:
22 list args
2324 Returns:
25 list returns
26 """
2728Function:
29def another_function_here(arg1):
30 ...
3132User Query: {prompt}<human_end>
33'''3435# Convert prompt to tokens36tokens = tokenizer(37 prompt_template,38 return_tensors='pt'39).input_ids.cuda()4041generation_params ={42"do_sample":True,43"temperature":0.7,44"top_p":0.95,45"top_k":40,46"max_new_tokens":512,47"repetition_penalty":1.148}4950# Generate streamed output, visible one token at a time51generation_output = model.generate(52 tokens,53 streamer=streamer,54**generation_params
55)5657# Generation without a streamer, which will include the prompt in the output58generation_output = model.generate(59 tokens,60**generation_params
61)6263# Get the tokens from the output, decode them, print them64token_output = generation_output[0]65text_output = tokenizer.decode(token_output)66print("model.generate output: ", text_output)6768# Inference is also possible via Transformers' pipeline69from transformers import pipeline
7071pipe = pipeline(72"text-generation",73 model=model,74 tokenizer=tokenizer,75**generation_params
76)7778pipe_output = pipe(prompt_template)[0]['generated_text']79print("pipeline output: ", pipe_output)80
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.
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.
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
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
Thank you to all my generous patrons and donaters!
And thank you again to a16z for their generous grant.
Original model card: Nexusflow's NexusRaven V2 13B
NexusRaven-13B: Surpassing GPT-4 for Zero-shot Function Calling
NexusRaven is an open-source and commercially viable function calling LLM that surpasses the state-of-the-art in function calling capabilities.
💪 Versatile Function Calling Capability: NexusRaven-V2 is capable of generating single function calls, nested calls, and parallel calls in many challenging cases.
🤓 Fully Explainable: NexusRaven-V2 is capable of generating very detailed explanations for the function calls it generates. This behavior can be turned off, to save tokens during inference.
📊 Performance Highlights: NexusRaven-V2 surpasses GPT-4 by 7% in function calling success rates in human-generated use cases involving nested and composite functions.
🔧 Generalization to the Unseen: NexusRaven-V2 has never been trained on the functions used in evaluation.
🔥 Commercially Permissive: The training of NexusRaven-V2 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.
NexusRaven-V2 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.
NexusRaven-V2's Capabilities
NexusRaven-V2 is capable of generating deeply nested function calls, parallel function calls, and simple single calls. It can also justify the function calls it generated. If you would like to generate the call only, please set a stop criteria of "<bot_end>". Otherwise, please allow NexusRaven-V2 to run until its stop token (i.e. "</s>").
Quick Start Prompting Guide
Please refer to our notebook, How-To-Prompt.ipynb, for more advanced tutorials on using NexusRaven-V2!
We strongly recommend to set sampling to False when prompting NexusRaven-V2.
We strongly recommend a very low temperature (~0.001).
We strongly recommend following the prompting style below.
Quickstart
You can run the model on a GPU using the following code.
python
1# Please `pip install transformers accelerate`2from transformers import pipeline
345pipeline = pipeline(6"text-generation",7 model="Nexusflow/NexusRaven-V2-13B",8 torch_dtype="auto",9 device_map="auto",10)1112prompt_template = \
13'''
14Function:
15def get_weather_data(coordinates):
16 """
17 Fetches weather data from the Open-Meteo API for the given latitude and longitude.
1819 Args:
20 coordinates (tuple): The latitude of the location.
2122 Returns:
23 float: The current temperature in the coordinates you've asked for
24 """
2526Function:
27def get_coordinates_from_city(city_name):
28 """
29 Fetches the latitude and longitude of a given city name using the Maps.co Geocoding API.
3031 Args:
32 city_name (str): The name of the city.
3334 Returns:
35 tuple: The latitude and longitude of the city.
36 """
3738User Query: {query}<human_end>
3940'''4142prompt = prompt_template.format(query="What's the weather like in Seattle right now?")4344result = pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]["generated_text"]45print(result)
This should generate the following:
Call: get_weather_data(coordinates=get_coordinates_from_city(city_name='Seattle'))<bot_end>
Thought: The function call `get_weather_data(coordinates=get_coordinates_from_city(city_name='Seattle'))` answers the question "What's the weather like in Seattle right now?" by following these steps:
1. `get_coordinates_from_city(city_name='Seattle')`: This function call fetches the latitude and longitude of the city "Seattle" using the Maps.co Geocoding API.
2. `get_weather_data(coordinates=...)`: This function call fetches the current weather data for the coordinates returned by the previous function call.
Therefore, the function call `get_weather_data(coordinates=get_coordinates_from_city(city_name='Seattle'))` answers the question "What's the weather like in Seattle right now?" by first fetching the coordinates of the city "Seattle" and then fetching the current weather data for those coordinates.
If you would like to prevent the generation of the explanation of the function call (for example, to save on inference tokens), please set a stopping criteria of <bot_end>.
Please follow this prompting template to maximize the performance of RavenV2.
For a deeper dive into the results, please see our Github README.
Limitations
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.
The model can be prone to generate incorrect calls. Please ensure proper guardrails to capture errant behavior is in place.
The explanations generated by NexusRaven-V2 might be incorrect. Please ensure proper guardrails are present to capture errant behavior.
We thank the CodeLlama team for their amazing models!
@misc{rozière2023code,
title={Code Llama: Open Foundation Models for Code},
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},
year={2023},
eprint={2308.12950},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Citation
@misc{nexusraven,
title={NexusRaven-V2: Surpassing GPT-4 for Zero-shot Function Calling},
author={Nexusflow.ai team},
year={2023},
url={https://nexusflow.ai/blogs/ravenv2}
}
Contact
Please join our Discord Channel to reach out for any issues and comments!