Model Intelligence Sheet
quantfactory/xlam-7b-fc-r-gguf overview
This is quantized version of Salesforce/xLAM-7b-fc-r created using llama.cpp # Original Model Card [Homepage] | [Paper] | [Dataset] | [Github] Welcome to the xLAM model family! Large Action Models (LAMs) are advanced large language models designed to enhance decision-making and translate user intentions into executable actions that interact with the world. LAMs autonomously plan and execute tasks to achieve specific goals, serving as the brains of AI agents. They have the potential to automate workflow processes across various domains, making them invaluable for a wide range of applications.
Downloads
102
Likes
2
Pipeline
text-generation
Library
—
Visibility
Public
Access
Open
Repository Files & Downloads
14 files detected
Direct downloads for all repository files
| File | Type | Quantization | Size | Link |
|---|---|---|---|---|
| xLAM-7b-fc-r.Q2_K.gguf | GGUF | Q2_K | 2.53 GB | Download |
| xLAM-7b-fc-r.Q3_K_L.gguf | GGUF | Q3_K_L | 3.49 GB | Download |
| xLAM-7b-fc-r.Q3_K_M.gguf | GGUF | Q3_K_M | 3.22 GB | Download |
| xLAM-7b-fc-r.Q3_K_S.gguf | GGUF | Q3_K_S | 2.92 GB | Download |
| xLAM-7b-fc-r.Q4_0.gguf | GGUF | — | 3.73 GB | Download |
| xLAM-7b-fc-r.Q4_1.gguf | GGUF | — | 4.10 GB | Download |
| xLAM-7b-fc-r.Q4_K_M.gguf | GGUF | Q4_K_M | 3.93 GB | Download |
| xLAM-7b-fc-r.Q4_K_S.gguf | GGUF | Q4_K_S | 3.75 GB | Download |
| xLAM-7b-fc-r.Q5_0.gguf | GGUF | — | 4.48 GB | Download |
| xLAM-7b-fc-r.Q5_1.gguf | GGUF | — | 4.86 GB | Download |
| xLAM-7b-fc-r.Q5_K_M.gguf | GGUF | Q5_K_M | 4.59 GB | Download |
| xLAM-7b-fc-r.Q5_K_S.gguf | GGUF | Q5_K_S | 4.48 GB | Download |
| xLAM-7b-fc-r.Q6_K.gguf | GGUF | Q6_K | 5.28 GB | Download |
| xLAM-7b-fc-r.Q8_0.gguf | GGUF | — | 6.84 GB | Download |
Model Details Live
Metadata Inspector
Normalized metadata (stored in metadata_json)
{
"metadata": {},
"card_data": {
"license": "cc-by-nc-4.0",
"datasets": [
"Salesforce/xlam-function-calling-60k"
],
"language": [
"en"
],
"pipeline_tag": "text-generation",
"tags": [
"function-calling",
"LLM Agent",
"tool-use",
"deepseek",
"pytorch"
],
"frontmatter": {},
"hero_image_url": "https://huggingface.co/Salesforce/xLAM-v0.1-r/resolve/main/xlam-no-background.png",
"summary": "This is quantized version of Salesforce/xLAM-7b-fc-r created using llama.cpp # Original Model Card [Homepage] | [Paper] | [Dataset] | [Github] Welcome to the xLAM model family! Large Action Models (LAMs) are advanced large language models designed to enhance decision-making and translate user intentions into executable actions that interact with the world. LAMs autonomously plan and execute tasks to achieve specific goals, serving as the brains of AI agents. They have the potential to automate workflow processes across various domains, making them invaluable for a wide range of applications.",
"quick_links": [],
"benchmark_table_html": "",
"readme_markdown": "\n---\n\nlicense: cc-by-nc-4.0\ndatasets:\n- Salesforce/xlam-function-calling-60k\nlanguage:\n- en\npipeline_tag: text-generation\ntags:\n- function-calling\n- LLM Agent\n- tool-use\n- deepseek\n- pytorch\n\n---\n\n\n\n# QuantFactory/xLAM-7b-fc-r-GGUF\nThis is quantized version of [Salesforce/xLAM-7b-fc-r](https://huggingface.co/Salesforce/xLAM-7b-fc-r) created using llama.cpp\n\n# Original Model Card\n\n\n<p align=\"center\">\n<img width=\"300px\" alt=\"xLAM\" src=\"https://huggingface.co/Salesforce/xLAM-v0.1-r/resolve/main/xlam-no-background.png\">\n</p>\n<p align=\"center\">\n <a href=\"https://apigen-pipeline.github.io/\">[Homepage]</a> | \n <a href=\"https://arxiv.org/abs/2406.18518\">[Paper]</a> | \n <a href=\"https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k\">[Dataset]</a> | \n <a href=\"https://github.com/SalesforceAIResearch/xLAM\">[Github]</a>\n</p>\n<hr>\n\n\nWelcome to the xLAM model family! [Large Action Models (LAMs)](https://blog.salesforceairesearch.com/large-action-models/) are advanced large language models designed to enhance decision-making and translate user intentions into executable actions that interact with the world. LAMs autonomously plan and execute tasks to achieve specific goals, serving as the brains of AI agents. They have the potential to automate workflow processes across various domains, making them invaluable for a wide range of applications.\n\n## Table of Contents\n- [Model Series](#model-series)\n- [Repository Overview](#repository-overview)\n- [Benchmark Results](#benchmark-results)\n- [Usage](#usage)\n - [Basic Usage with Huggingface](#basic-usage-with-huggingface)\n - [Usage with vLLM](#usage-with-vllm)\n- [License](#license)\n- [Citation](#citation)\n\n## Model Series\n\nWe provide a series of xLAMs in different sizes to cater to various applications, including those optimized for function-calling and general agent applications:\n\n| Model | # Total Params | Context Length | Download Model | Download GGUF files |\n|------------------------|----------------|----------------|----------------|----------|\n| xLAM-1b-fc-r | 1.35B | 16384 | [🤗 Link](https://huggingface.co/Salesforce/xLAM-1b-fc-r) | [🤗 Link](https://huggingface.co/Salesforce/xLAM-1b-fc-r-gguf) |\n| xLAM-7b-fc-r | 6.91B | 4096 | [🤗 Link](https://huggingface.co/Salesforce/xLAM-7b-fc-r) | [🤗 Link](https://huggingface.co/Salesforce/xLAM-7b-fc-r-gguf) |\n\nThe `fc` series of models are optimized for function-calling capability, providing fast, accurate, and structured responses based on input queries and available APIs. These models are fine-tuned based on the [deepseek-coder](https://huggingface.co/collections/deepseek-ai/deepseek-coder-65f295d7d8a0a29fe39b4ec4) models and are designed to be small enough for deployment on personal devices like phones or computers.\n\nWe also provide their quantized [GGUF](https://huggingface.co/docs/hub/en/gguf) files for efficient deployment and execution. GGUF is a file format designed to efficiently store and load large language models, making GGUF ideal for running AI models on local devices with limited resources, enabling offline functionality and enhanced privacy.\n\nFor more details, check our [GitHub](https://github.com/SalesforceAIResearch/xLAM) and [paper](https://arxiv.org/abs/2406.18518).\n\n\n## Repository Overview\n\nThis repository is focused on our small `xLAM-7b-fc-r` model, which is optimized for function-calling and can be easily deployed on personal devices.\n\n<div align=\"center\">\n<img src=\"https://github.com/apigen-pipeline/apigen-pipeline.github.io/blob/main/img/function-call-overview.png?raw=true\"\nalt=\"drawing\" width=\"620\"/>\n</div>\n\nFunction-calling, or tool use, is one of the key capabilities for AI agents. It requires the model not only understand and generate human-like text but also to execute functional API calls based on natural language instructions. This extends the utility of LLMs beyond simple conversation tasks to dynamic interactions with a variety of digital services and applications, such as retrieving weather information, managing social media platforms, and handling financial services.\n\nThe instructions will guide you through the setup, usage, and integration of `xLAM-7b-fc-r` with HuggingFace and vLLM.\nWe will first introduce the basic usage, and then walk through the provided tutorial and example scripts in the [examples](https://huggingface.co/Salesforce/xLAM-7b-fc-r/tree/main/examples) folder.\n\n### Framework Versions\n\n- Transformers 4.41.0\n- Pytorch 2.3.0+cu121\n- Datasets 2.19.1\n- Tokenizers 0.19.1\n\n## Benchmark Results\n\nWe mainly test our function-calling models on the [Berkeley Function-Calling Leaderboard (BFCL)](https://gorilla.cs.berkeley.edu/leaderboard.html), which offers a comprehensive evaluation framework for assessing LLMs' function-calling capabilities across various programming languages and application domains like Java, JavaScript, and Python. \n\n\n<div align=\"center\">\n<img src=\"https://github.com/apigen-pipeline/apigen-pipeline.github.io/blob/main/img/table-result-0718.png?raw=true\" width=\"620\" alt=\"Performance comparison on Berkeley Function-Calling Leaderboard\">\n<p>Performance comparison on the BFCL benchmark as of date 07/18/2024. Evaluated with <code>temperature=0.001</code> and <code>top_p=1</code></p> \n</div>\n\n<p>Our <code>xLAM-7b-fc-r</code> secures the 3rd place with an overall accuracy of 88.24% on the leaderboard, outperforming many strong models. Notably, our <code>xLAM-1b-fc-r</code> model is the only tiny model with less than 2B parameters on the leaderboard, but still achieves a competitive overall accuracy of 78.94% and outperforming GPT3-Turbo and many larger models.\nBoth models exhibit balanced performance across various categories, showing their strong function-calling capabilities despite their small sizes.</p>\n\nSee our [paper](https://arxiv.org/abs/2406.18518) and Github [repo](https://github.com/SalesforceAIResearch/xLAM) for more detailed analysis.\n\n\n## Usage\n\n### Basic Usage with Huggingface\n\nTo use the `xLAM-7b-fc-r` model from Huggingface, please first install the `transformers` library:\n```bash\npip install transformers>=4.41.0\n```\n\nWe use the following example to illustrate how to use our model to perform function-calling tasks. \nPlease note that, our model works best with our provided prompt format. \nIt allows us to extract JSON output that is similar to the [function-calling mode of ChatGPT](https://platform.openai.com/docs/guides/function-calling).\n\n````python\nimport json\nimport torch \nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ntorch.random.manual_seed(0) \n\nmodel_name = \"Salesforce/xLAM-7b-fc-r\"\nmodel = AutoModelForCausalLM.from_pretrained(model_name, device_map=\"auto\", torch_dtype=\"auto\", trust_remote_code=True)\ntokenizer = AutoTokenizer.from_pretrained(model_name) \n\n# Please use our provided instruction prompt for best performance\ntask_instruction = \"\"\"\nYou are an expert in composing functions. You are given a question and a set of possible functions. \nBased on the question, you will need to make one or more function/tool calls to achieve the purpose. \nIf none of the functions can be used, point it out and refuse to answer. \nIf the given question lacks the parameters required by the function, also point it out.\n\"\"\".strip()\n\nformat_instruction = \"\"\"\nThe output MUST strictly adhere to the following JSON format, and NO other text MUST be included.\nThe example format is as follows. Please make sure the parameter type is correct. If no function call is needed, please make tool_calls an empty list '[]'.\n```\n{\n \"tool_calls\": [\n {\"name\": \"func_name1\", \"arguments\": {\"argument1\": \"value1\", \"argument2\": \"value2\"}},\n ... (more tool calls as required)\n ]\n}\n```\n\"\"\".strip()\n\n# Define the input query and available tools\nquery = \"What's the weather like in New York in fahrenheit?\"\n\nget_weather_api = {\n \"name\": \"get_weather\",\n \"description\": \"Get the current weather for a location\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, New York\"\n },\n \"unit\": {\n \"type\": \"string\",\n \"enum\": [\"celsius\", \"fahrenheit\"],\n \"description\": \"The unit of temperature to return\"\n }\n },\n \"required\": [\"location\"]\n }\n}\n\nsearch_api = {\n \"name\": \"search\",\n \"description\": \"Search for information on the internet\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"query\": {\n \"type\": \"string\",\n \"description\": \"The search query, e.g. 'latest news on AI'\"\n }\n },\n \"required\": [\"query\"]\n }\n}\n\nopenai_format_tools = [get_weather_api, search_api]\n\n# Helper function to convert openai format tools to our more concise xLAM format\ndef convert_to_xlam_tool(tools):\n ''''''\n if isinstance(tools, dict):\n return {\n \"name\": tools[\"name\"],\n \"description\": tools[\"description\"],\n \"parameters\": {k: v for k, v in tools[\"parameters\"].get(\"properties\", {}).items()}\n }\n elif isinstance(tools, list):\n return [convert_to_xlam_tool(tool) for tool in tools]\n else:\n return tools\n\n# Helper function to build the input prompt for our model\ndef build_prompt(task_instruction: str, format_instruction: str, tools: list, query: str):\n prompt = f\"[BEGIN OF TASK INSTRUCTION]\\n{task_instruction}\\n[END OF TASK INSTRUCTION]\\n\\n\"\n prompt += f\"[BEGIN OF AVAILABLE TOOLS]\\n{json.dumps(xlam_format_tools)}\\n[END OF AVAILABLE TOOLS]\\n\\n\"\n prompt += f\"[BEGIN OF FORMAT INSTRUCTION]\\n{format_instruction}\\n[END OF FORMAT INSTRUCTION]\\n\\n\"\n prompt += f\"[BEGIN OF QUERY]\\n{query}\\n[END OF QUERY]\\n\\n\"\n return prompt\n \n# Build the input and start the inference\nxlam_format_tools = convert_to_xlam_tool(openai_format_tools)\ncontent = build_prompt(task_instruction, format_instruction, xlam_format_tools, query)\n\nmessages=[\n { 'role': 'user', 'content': content}\n]\ninputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors=\"pt\").to(model.device)\n\n# tokenizer.eos_token_id is the id of <|EOT|> token\noutputs = model.generate(inputs, max_new_tokens=512, do_sample=False, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)\nprint(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))\n````\n\nThen you should be able to see the following output string in JSON format:\n\n```shell\n{\"tool_calls\": [{\"name\": \"get_weather\", \"arguments\": {\"location\": \"New York\", \"unit\": \"fahrenheit\"}}]}\n```\n\nWe highly recommend to use our provided prompt format and helper functions to yield the best function-calling performance of our model.\n\n### Usage with vLLM\n\nWe provide example scripts to deploy our model with `vllm` and run inferences. First, install the required packages:\n\n```bash\npip install vllm openai argparse jinja2\n```\n\nThe example scripts are located in the [examples](https://huggingface.co/Salesforce/xLAM-7b-fc-r/tree/main/examples) folder.\n\n#### 1. Test Prompt Template\n\nTo build prompts using the chat template and output formatted prompts ready for various test cases, run:\n\n```bash\npython test_prompt_template.py --model \n```\n\n#### 2. Test xLAM Model with a Manually Served Endpoint\n\na. Serve the model with vLLM:\n\n```bash\npython -m vllm.entrypoints.openai.api_server --model Salesforce/xLAM-7b-fc-r --served-model-name xLAM-7b-fc-r --dtype bfloat16 --port 8001\n```\n\nb. Run the test script:\n\n```bash\npython test_xlam_model_with_endpoint.py --model_name xLAM-7b-fc-r --port 8001 [OPTIONS]\n```\n\nOptions:\n- `--temperature`: Default 0.3\n- `--top_p`: Default 1.0\n- `--max_tokens`: Default 512\n\nThis test script provides a handler implementation that can be easily applied to your customized function-calling applications.\n\n#### 3. Test xLAM Model by Directly Using vLLM Library\n\nTo test the xLAM model directly with the vLLM library, run:\n\n```bash\npython test_xlam_model_with_vllm.py --model Salesforce/xLAM-7b-fc-r [OPTIONS]\n```\n\nOptions are the same as for the endpoint test. This test script also provides a handler implementation that can be easily applied to your customized function-calling applications.\n\n#### Customization\n\nThese examples are designed to be flexible and easily integrated into your own projects. Feel free to modify the scripts to suit your specific needs and applications. You can adjust test queries or API definitions in each script to test different scenarios or model capabilities.\n\nAdditional customization tips:\n- Modify the `--dtype` parameter when serving the model based on your GPU capacity.\n- Refer to the vLLM documentation for more detailed configuration options.\n- Explore the `demo.ipynb` file for a comprehensive description of the entire workflow, including how to execute APIs.\n\nThese resources provide a robust foundation for integrating xLAM models into your applications, allowing for tailored and efficient deployment.\n\n## License\n\n`xLAM-7b-fc-r` is distributed under the CC-BY-NC-4.0 license, with additional terms specified in the [Deepseek license](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/LICENSE-MODEL).\n\n## Citation\n\nIf you find this repo helpful, please cite our paper:\n```bibtex\n@article{liu2024apigen,\n title={APIGen: Automated Pipeline for Generating Verifiable and Diverse Function-Calling Datasets},\n author={Liu, Zuxin and Hoang, Thai and Zhang, Jianguo and Zhu, Ming and Lan, Tian and Kokane, Shirley and Tan, Juntao and Yao, Weiran and Liu, Zhiwei and Feng, Yihao and others},\n journal={arXiv preprint arXiv:2406.18518},\n year={2024}\n}\n```\n\n",
"related_quantizations": []
},
"tags": [
"gguf",
"function-calling",
"LLM Agent",
"tool-use",
"deepseek",
"pytorch",
"text-generation",
"en",
"dataset:Salesforce/xlam-function-calling-60k",
"arxiv:2406.18518",
"license:cc-by-nc-4.0",
"endpoints_compatible",
"region:us",
"conversational"
],
"likes": 2,
"downloads": 102,
"gated": false,
"private": false,
"last_modified": "2024-07-20T06:04:28.000Z",
"created_at": "2024-07-20T04:44:08.000Z",
"pipeline_tag": "text-generation",
"library_name": ""
}
Source payload excerpt (from Hugging Face API)
{
"_id": "669b40989f245a200d534c02",
"id": "QuantFactory/xLAM-7b-fc-r-GGUF",
"modelId": "QuantFactory/xLAM-7b-fc-r-GGUF",
"sha": "9682dca2ace5ee9263374d2859da9e3c57548cc7",
"createdAt": "2024-07-20T04:44:08.000Z",
"lastModified": "2024-07-20T06:04:28.000Z",
"author": "QuantFactory",
"downloads": 102,
"likes": 2,
"gated": false,
"private": false,
"pipeline_tag": "text-generation",
"library_name": "",
"siblings_count": 16
}