commit c1c794546f1997abe7883c85bcfb02ff083c213a Author: ModelHub XC Date: Wed Aug 19 21:43:16 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: TheBloke/NexusRaven-V2-13B-GGUF Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a6fc6bd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,47 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q5_0.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text +nexusraven-v2-13b.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..38275ca --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,41 @@ +Nexusflow.ai License Terms + +NexusRaven-V2 Version Release Date: December 5, 2023 + +“Agreement” means the terms and conditions for use, reproduction, distribution and modification of the Nexusflow Materials set forth herein. + +“Documentation” means the specifications, manuals and documentation accompanying NeuxsRaven-V2 distributed by Nexusflow at https://huggingface.co/Nexusflow/NexusRaven-V2-13B, if any. + +“Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf. + +“NexusRaven-V2” means the large language models and software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing made available by Nexusflow at https://huggingface.co/Nexusflow/NexusRaven-V2-13B. + +“Nexusflow Materials” means, collectively, Nexusflow’s proprietary NexusRaven-V2 and Documentation (and any portion thereof) made available under this Agreement. + +“Nexusflow” or “we” means Nexusflow.ai Inc. + +By using or distributing any portion or element of the Nexusflow Materials, you agree to be bound by this Agreement. +1. License Rights and Redistribution. + a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Nexusflow’s intellectual property or other rights owned by Nexusflow embodied in the Nexusflow Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Nexusflow Materials. + b. Redistribution and Use. + i. If you distribute or make the Nexusflow Materials, or any derivative works thereof, available to a third party, you shall provide a copy of this Agreement to such third party. + ii. If you receive Nexusflow Materials, or any derivative works thereof, from a Licensee as part of an integrated end user product, then Section 1 of this Agreement will not apply to you. + iii. You must retain in all copies of the Nexusflow Materials that you distribute the following attribution notice within a “Notice” text file distributed as a part of such copies: “NexusRaven-V2 is licensed under the Nexusflow License, Copyright © Nexusflow.ai Inc. All Rights Reserved.” + iv. Your use of the Nexusflow Materials must comply with applicable laws and regulations (including trade compliance laws and regulations) and adhere to Nexusflow terms and policies (if any), which are hereby incorporated by reference into this Agreement. The Nexusflow Materials are derived from Llama 2 as offered by Meta Platforms Ireland Limited or Meta Platforms, Inc., and you further agree that your use of the Nexusflow Materials shall be subject to the applicable terms and conditions of the Llama 2 Community License Agreement, available at https://ai.meta.com/llama/license/. + v. You will not use the Nexusflow Materials or any output or results of the Nexusflow Materials to improve any other large language model (excluding NexusRaven-V2 or derivative works thereof). + +2. Additional Commercial Terms. If, on the NexusRaven-V2 version release date, the monthly active users of the products or services made available by or for Licensee, or Licensee’s affiliates, is greater than 50 million monthly active users in the preceding calendar month, you must request a license from Nexusflow, which Nexusflow may grant to you in its sole discretion, and you are not authorized to exercise any of the rights under this Agreement unless or until Nexusflow otherwise expressly grants you such rights. + +3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE NEXUSFLOW MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE NEXUSFLOW MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE NEXUSFLOW MATERIALS AND ANY OUTPUT AND RESULTS. + +4. Limitation of Liability. IN NO EVENT WILL NEXUSFLOW, ITS LICENSORS OR AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF NEXUSFLOW OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING. + +5. Intellectual Property. + a. No trademark licenses are granted under this Agreement, and in connection with the Nexusflow Materials, neither Nexusflow nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and using the Nexusflow Materials. + b. Subject to Nexusflow’s ownership of Nexusflow Materials and derivatives made by or for Nexusflow (and any rights retained therein by its licensors to the foregoing), with respect to any derivative works and modifications of the Nexusflow Materials that are made by you, as between you and Nexusflow, you are and will be the owner of such derivative works and modifications. + c. You will indemnify and hold harmless Nexusflow from and against any claim by any third party arising out of or related to your use of the Nexusflow Materials. + +6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Nexusflow Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Nexusflow may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the Nexusflow Materials. Sections 3, 4, 5.c. (the last sentence) and 7 shall survive the termination of this Agreement. + +7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..3bd2f53 --- /dev/null +++ b/README.md @@ -0,0 +1,509 @@ +--- +base_model: Nexusflow/NexusRaven-V2-13B +inference: false +license: other +model-index: +- name: NexusRaven-13B + results: [] +model_creator: Nexusflow +model_name: NexusRaven V2 13B +model_type: llama +prompt_template: "Function:\ndef function_here(arg1):\n \"\"\"\n Comments explaining\ + \ the function here\n\n Args:\n list args\n\n Returns:\n list returns\n\ + \ \"\"\"\n\nFunction:\ndef another_function_here(arg1):\n ...\n\nUser Query:\ + \ {prompt}\n" +quantized_by: TheBloke +--- + + + + +
+TheBlokeAI +
+
+
+

Chat & support: TheBloke's Discord server

+
+
+

Want to contribute? TheBloke's Patreon page

+
+
+

TheBloke's LLM work is generously supported by a grant from andreessen horowitz (a16z)

+
+ + +# NexusRaven V2 13B - GGUF +- Model creator: [Nexusflow](https://huggingface.co/Nexusflow) +- Original model: [NexusRaven V2 13B](https://huggingface.co/Nexusflow/NexusRaven-V2-13B) + + +## Description + +This repo contains GGUF format model files for [Nexusflow's NexusRaven V2 13B](https://huggingface.co/Nexusflow/NexusRaven-V2-13B). + +These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/). + + + +### About GGUF + +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. + +Here is an incomplete list of clients and libraries that are known to support GGUF: + +* [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option. +* [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. +* [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. +* [GPT4All](https://gpt4all.io/index.html), a free and open source local running GUI, supporting Windows, Linux and macOS with full GPU accel. +* [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. +* [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. +* [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. +* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server. +* [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use. +* [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. + + + +## Repositories available + +* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/NexusRaven-V2-13B-AWQ) +* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GPTQ) +* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF) +* [Nexusflow's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/Nexusflow/NexusRaven-V2-13B) + + + +## Prompt template: NexusRaven + +``` +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} + +``` + + + +## 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](https://huggingface.co/Nexusflow/NexusRaven-V2-13B). + + +## Compatibility + +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) + +They are also compatible with many third party UIs and libraries - please see the list at the top of this README. + +## Explanation of quantisation methods + +
+ Click to see details + +The new methods available are: + +* 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) +* 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. +* 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. +* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw +* 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 + +Refer to the Provided Files table below to see what files use which methods, and how. +
+ + + +## Provided files + +| Name | Quant method | Bits | Size | Max RAM required | Use case | +| ---- | ---- | ---- | ---- | ---- | ----- | +| [nexusraven-v2-13b.Q2_K.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q2_K.gguf) | Q2_K | 2 | 5.43 GB| 7.93 GB | smallest, significant quality loss - not recommended for most purposes | +| [nexusraven-v2-13b.Q3_K_S.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q3_K_S.gguf) | Q3_K_S | 3 | 5.66 GB| 8.16 GB | very small, high quality loss | +| [nexusraven-v2-13b.Q3_K_M.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q3_K_M.gguf) | Q3_K_M | 3 | 6.34 GB| 8.84 GB | very small, high quality loss | +| [nexusraven-v2-13b.Q3_K_L.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q3_K_L.gguf) | Q3_K_L | 3 | 6.93 GB| 9.43 GB | small, substantial quality loss | +| [nexusraven-v2-13b.Q4_0.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q4_0.gguf) | Q4_0 | 4 | 7.37 GB| 9.87 GB | legacy; small, very high quality loss - prefer using Q3_K_M | +| [nexusraven-v2-13b.Q4_K_S.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q4_K_S.gguf) | Q4_K_S | 4 | 7.41 GB| 9.91 GB | small, greater quality loss | +| [nexusraven-v2-13b.Q4_K_M.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q4_K_M.gguf) | Q4_K_M | 4 | 7.87 GB| 10.37 GB | medium, balanced quality - recommended | +| [nexusraven-v2-13b.Q5_0.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q5_0.gguf) | Q5_0 | 5 | 8.97 GB| 11.47 GB | legacy; medium, balanced quality - prefer using Q4_K_M | +| [nexusraven-v2-13b.Q5_K_S.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q5_K_S.gguf) | Q5_K_S | 5 | 8.97 GB| 11.47 GB | large, low quality loss - recommended | +| [nexusraven-v2-13b.Q5_K_M.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q5_K_M.gguf) | Q5_K_M | 5 | 9.23 GB| 11.73 GB | large, very low quality loss - recommended | +| [nexusraven-v2-13b.Q6_K.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q6_K.gguf) | Q6_K | 6 | 10.68 GB| 13.18 GB | very large, extremely low quality loss | +| [nexusraven-v2-13b.Q8_0.gguf](https://huggingface.co/TheBloke/NexusRaven-V2-13B-GGUF/blob/main/nexusraven-v2-13b.Q8_0.gguf) | Q8_0 | 8 | 13.83 GB| 16.33 GB | very large, extremely low quality loss - not recommended | + +**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. + + + + + + +## How to download GGUF files + +**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. + +The following clients/libraries will automatically download models for you, providing a list of available models to choose from: + +* LM Studio +* LoLLMS Web UI +* Faraday.dev + +### In `text-generation-webui` + +Under Download Model, you can enter the model repo: TheBloke/NexusRaven-V2-13B-GGUF and below it, a specific filename to download, such as: nexusraven-v2-13b.Q4_K_M.gguf. + +Then click Download. + +### On the command line, including multiple files at once + +I recommend using the `huggingface-hub` Python library: + +```shell +pip3 install huggingface-hub +``` + +Then you can download any individual model file to the current directory, at high speed, with a command like this: + +```shell +huggingface-cli download TheBloke/NexusRaven-V2-13B-GGUF nexusraven-v2-13b.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False +``` + +
+ More advanced huggingface-cli download usage (click to read) + +You can also download multiple files at once with a pattern: + +```shell +huggingface-cli download TheBloke/NexusRaven-V2-13B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf' +``` + +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). + +To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`: + +```shell +pip3 install hf_transfer +``` + +And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`: + +```shell +HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/NexusRaven-V2-13B-GGUF nexusraven-v2-13b.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False +``` + +Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command. +
+ + + +## Example `llama.cpp` command + +Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later. + +```shell +./main -ngl 35 -m nexusraven-v2-13b.Q4_K_M.gguf --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "Function:\ndef function_here(arg1):\n """\n Comments explaining the function here\n\n Args:\n list args\n\n Returns:\n list returns\n """\n\nFunction:\ndef another_function_here(arg1):\n ...\n\nUser Query: {prompt}" +``` + +Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration. + +Change `-c 2048` 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. + +If you want to have a chat-style conversation, replace the `-p ` argument with `-i -ins` + +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) + +## How to run in `text-generation-webui` + +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). + +## How to run from Python code + +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. + +### How to load this model in Python code, using llama-cpp-python + +For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/). + +#### First install the package + +Run one of the following commands, according to your system: + +```shell +# Base ctransformers with no GPU acceleration +pip install llama-cpp-python +# With NVidia CUDA acceleration +CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python +# Or with OpenBLAS acceleration +CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python +# Or with CLBLast acceleration +CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python +# Or with AMD ROCm GPU acceleration (Linux only) +CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python +# Or with Metal GPU acceleration for macOS systems only +CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python + +# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA: +$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on" +pip install llama-cpp-python +``` + +#### Simple llama-cpp-python example code + +```python +from llama_cpp import Llama + +# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system. +llm = Llama( + model_path="./nexusraven-v2-13b.Q4_K_M.gguf", # Download the model file first + n_ctx=2048, # The max sequence length to use - note that longer sequence lengths require much more resources + n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance + n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available +) + +# Simple inference example +output = llm( + "Function:\ndef function_here(arg1):\n """\n Comments explaining the function here\n\n Args:\n list args\n\n Returns:\n list returns\n """\n\nFunction:\ndef another_function_here(arg1):\n ...\n\nUser Query: {prompt}", # Prompt + max_tokens=512, # Generate up to 512 tokens + stop=[""], # Example stop token - not necessarily correct for this specific model! Please check before using. + echo=True # Whether to echo the prompt +) + +# Chat Completion API + +llm = Llama(model_path="./nexusraven-v2-13b.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using +llm.create_chat_completion( + messages = [ + {"role": "system", "content": "You are a story writing assistant."}, + { + "role": "user", + "content": "Write a story about llamas." + } + ] +) +``` + +## How to use with LangChain + +Here are guides on using llama-cpp-python and ctransformers with LangChain: + +* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp) +* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers) + + + + + +## Discord + +For further support, and discussions on these models and AI in general, join us at: + +[TheBloke AI's Discord server](https://discord.gg/theblokeai) + +## Thanks, and how to contribute + +Thanks to the [chirper.ai](https://chirper.ai) team! + +Thanks to Clay from [gpus.llm-utils.org](llm-utils)! + +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: https://patreon.com/TheBlokeAI +* Ko-Fi: https://ko-fi.com/TheBlokeAI + +**Special thanks to**: Aemon Algiz. + +**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 +

+Nexusflow HF - Nexusflow Discord - NexusRaven-V2 blog post - Prompting Notebook CoLab - Leaderboard - Read-World Demo - NexusRaven-V2-13B Github +

+ +

+NexusRaven +

+ +## Introducing NexusRaven-V2-13B +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. + +Please checkout the following links! +- [Prompting Notebook CoLab](https://colab.research.google.com/drive/19JYixRPPlanmW5q49WYi_tU8rhHeCEKW?usp=sharing) +- [Evaluation Leaderboard](https://huggingface.co/spaces/Nexusflow/Nexus_Function_Calling_Leaderboard) +- [NexusRaven-V2 Real-World Demo](https://huggingface.co/spaces/Nexusflow/NexusRaven-V2-Demo) + + +## NexusRaven-V2 model usage + +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 \"\\". 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](https://colab.research.google.com/drive/19JYixRPPlanmW5q49WYi_tU8rhHeCEKW?usp=sharing), for more advanced tutorials on using NexusRaven-V2! + +1. We strongly recommend to set sampling to False when prompting NexusRaven-V2. +2. We strongly recommend a very low temperature (~0.001). +3. We strongly recommend following the prompting style below. + +### Quickstart +You can run the model on a GPU using the following code. +```python +# Please `pip install transformers accelerate` +from transformers import pipeline + + +pipeline = pipeline( + "text-generation", + model="Nexusflow/NexusRaven-V2-13B", + torch_dtype="auto", + device_map="auto", +) + +prompt_template = \ +''' +Function: +def get_weather_data(coordinates): + """ + Fetches weather data from the Open-Meteo API for the given latitude and longitude. + + Args: + coordinates (tuple): The latitude of the location. + + Returns: + float: The current temperature in the coordinates you've asked for + """ + +Function: +def get_coordinates_from_city(city_name): + """ + Fetches the latitude and longitude of a given city name using the Maps.co Geocoding API. + + Args: + city_name (str): The name of the city. + + Returns: + tuple: The latitude and longitude of the city. + """ + +User Query: {query} + +''' + +prompt = prompt_template.format(query="What's the weather like in Seattle right now?") + +result = pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]["generated_text"] +print (result) +``` + +This should generate the following: +``` +Call: get_weather_data(coordinates=get_coordinates_from_city(city_name='Seattle')) +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 \. + +Please follow this prompting template to maximize the performance of RavenV2. + +### Using with OpenAI FC Schematics + +[If you currently have a workflow that is built around OpenAI's function calling and you want to try NexusRaven-V2, we have a package that helps you drop in NexusRaven-V2.](https://github.com/nexusflowai/nexusraven-pip) + + +## Evaluation + +

+NexusRaven +NexusRaven +

+ +For a deeper dive into the results, please see our [Github README](https://github.com/nexusflowai/NexusRaven). + +# Limitations +1. 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. +2. The model can be prone to generate incorrect calls. Please ensure proper guardrails to capture errant behavior is in place. +3. The explanations generated by NexusRaven-V2 might be incorrect. Please ensure proper guardrails are present to capture errant behavior. + +## License +This model was trained on commercially viable data and is licensed under the [Nexusflow community license](https://huggingface.co/Nexusflow/NexusRaven-V2-13B/blob/main/LICENSE.txt). + + +## References +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](https://discord.gg/HDSVmNAs3y) to reach out for any issues and comments! + + diff --git a/config.json b/config.json new file mode 100644 index 0000000..a4ba21b --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "model_type": "llama" +} \ No newline at end of file diff --git a/nexusraven-v2-13b.Q2_K.gguf b/nexusraven-v2-13b.Q2_K.gguf new file mode 100644 index 0000000..f453bf8 --- /dev/null +++ b/nexusraven-v2-13b.Q2_K.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e54d73e2ffbb81eb753c9b3eefe674f1b1fbe7b622d639360172fd572c264fa +size 5429490112 diff --git a/nexusraven-v2-13b.Q3_K_L.gguf b/nexusraven-v2-13b.Q3_K_L.gguf new file mode 100644 index 0000000..48bdeec --- /dev/null +++ b/nexusraven-v2-13b.Q3_K_L.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c02bded5401610c7cbf45363ed8d8e059f3de372b40d4f7c81c48535a802f79e +size 6929713792 diff --git a/nexusraven-v2-13b.Q3_K_M.gguf b/nexusraven-v2-13b.Q3_K_M.gguf new file mode 100644 index 0000000..ce57e18 --- /dev/null +++ b/nexusraven-v2-13b.Q3_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebaa5400e38ee2a9230ebb7341332d5fabbd689036372e60b52e6f391050a05e +size 6337923712 diff --git a/nexusraven-v2-13b.Q3_K_S.gguf b/nexusraven-v2-13b.Q3_K_S.gguf new file mode 100644 index 0000000..72e898e --- /dev/null +++ b/nexusraven-v2-13b.Q3_K_S.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f19127d9e111d64179c6eaa462a08e747382ee98bb1efb8c7bb1929e045b3aef +size 5659134592 diff --git a/nexusraven-v2-13b.Q4_0.gguf b/nexusraven-v2-13b.Q4_0.gguf new file mode 100644 index 0000000..21347cf --- /dev/null +++ b/nexusraven-v2-13b.Q4_0.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77d1869f10a5cb70cfb6d670e9f9b403d06a845d6896c92c298fc042ec540909 +size 7366005312 diff --git a/nexusraven-v2-13b.Q4_K_M.gguf b/nexusraven-v2-13b.Q4_K_M.gguf new file mode 100644 index 0000000..985c9c2 --- /dev/null +++ b/nexusraven-v2-13b.Q4_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:649f3b54f9940996ee06f4cdf0d21e019e024267d38d4c4cea42e41336eb1b3d +size 7866126912 diff --git a/nexusraven-v2-13b.Q4_K_S.gguf b/nexusraven-v2-13b.Q4_K_S.gguf new file mode 100644 index 0000000..57d8afd --- /dev/null +++ b/nexusraven-v2-13b.Q4_K_S.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc2e1ce9fa064e675690d4c6f2c441d922f24241764241aa013d0ca8a87ecbfe +size 7414501952 diff --git a/nexusraven-v2-13b.Q5_0.gguf b/nexusraven-v2-13b.Q5_0.gguf new file mode 100644 index 0000000..2470f39 --- /dev/null +++ b/nexusraven-v2-13b.Q5_0.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95a93b39e8ed11a7611d7016eb936e828b25051032cce81f1fa3e8dcb8fbef3b +size 8972471872 diff --git a/nexusraven-v2-13b.Q5_K_M.gguf b/nexusraven-v2-13b.Q5_K_M.gguf new file mode 100644 index 0000000..446de39 --- /dev/null +++ b/nexusraven-v2-13b.Q5_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbcb29a06777ceafb54801aa60113654f7cc73d6b34c2bbf3fbcd56800e12165 +size 9230110272 diff --git a/nexusraven-v2-13b.Q5_K_S.gguf b/nexusraven-v2-13b.Q5_K_S.gguf new file mode 100644 index 0000000..6ae091f --- /dev/null +++ b/nexusraven-v2-13b.Q5_K_S.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c2e6d5efdd36310b47116f03e59bcb36382cd746c5a34a192b699f5be08a961 +size 8972471872 diff --git a/nexusraven-v2-13b.Q6_K.gguf b/nexusraven-v2-13b.Q6_K.gguf new file mode 100644 index 0000000..df28956 --- /dev/null +++ b/nexusraven-v2-13b.Q6_K.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:556ae244f4c69c603b7cda762d003d09f68058c671f304c2e011214ce754acb4 +size 10679342592 diff --git a/nexusraven-v2-13b.Q8_0.gguf b/nexusraven-v2-13b.Q8_0.gguf new file mode 100644 index 0000000..21123e2 --- /dev/null +++ b/nexusraven-v2-13b.Q8_0.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:213f246d425acc23ae9ff37899a64c95b227dc354abacfe65c829c551a35882e +size 13831581312