初始化项目,由ModelHub XC社区提供模型

Model: Team-ACE/ToolACE-2-Llama-3.1-8B
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-07-30 07:00:19 +08:00
commit c01634a71f
12 changed files with 246 additions and 0 deletions

59
.gitattributes vendored Normal file
View File

@@ -0,0 +1,59 @@
*.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
*.lz4 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
*.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
*.jsonl filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
# Audio files - uncompressed
*.pcm filter=lfs diff=lfs merge=lfs -text
*.sam filter=lfs diff=lfs merge=lfs -text
*.raw filter=lfs diff=lfs merge=lfs -text
# Audio files - compressed
*.aac filter=lfs diff=lfs merge=lfs -text
*.flac filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
# Image files - uncompressed
*.bmp filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
# JSON files - uncompressed
*.json filter=lfs diff=lfs merge=lfs -text
*.log
# Image files - compressed
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.gguf filter=lfs diff=lfs merge=lfs -text

157
README.md Normal file
View File

@@ -0,0 +1,157 @@
---
license: apache-2.0
datasets:
- Team-ACE/ToolACE
language:
- en
metrics:
- accuracy
base_model: meta-llama/Meta-Llama-3.1-8B-Instruct
tags:
- code
---
# ToolACE-2-Llama-3.1-8B
ToolACE-2-Llama-3.1-8B is a fine-tuned model of LLaMA-3.1-8B-Instruct with our dataset [ToolACE](https://huggingface.co/datasets/Team-ACE/ToolACE) tailored for tool usage.
Compared with [ToolACE-8B](https://huggingface.co/Team-ACE/ToolACE-8B), ToolACE-2-8B enhances the tool-usage ability by self-refinment tuning and task decomposition.
ToolACE-2-Llama-3.1-8B achieves a state-of-the-art performance on the [Berkeley Function-Calling Leaderboard(BFCL)](https://gorilla.cs.berkeley.edu/leaderboard.html#leaderboard), rivaling the latest GPT-4 models.
ToolACE is an automatic agentic pipeline designed to generate **A**ccurate, **C**omplex, and div**E**rse tool-learning data.
ToolACE leverages a novel self-evolution synthesis process to curate a comprehensive API pool of 26,507 diverse APIs.
Dialogs are further generated through the interplay among multiple agents, guided by a formalized thinking process.
To ensure data accuracy, we implement a dual-layer verification system combining rule-based and model-based checks.
More details can be found in our paper on arxiv: [*ToolACE: Winning the Points of LLM Function Calling*](https://arxiv.org/abs/2409.00920)
![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/66bf01f45bdd611f9a602087/WmyWOYtg_dbTgwQmvlqcz.jpeg)
Here are the winning scores of ToolACE-2-8B in [BFCL-v3]((https://gorilla.cs.berkeley.edu/leaderboard.html#leaderboard)), which wins the highest scores among 8B-scale models.
![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/646735a98334813a7ae29500/smLEpFoS7W6OIkeE92_5O.jpeg)
### Usage
Here we provide a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate function calling with given functions.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Team-ACE/ToolACE-2-Llama-3.1-8B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype='auto',
device_map='auto'
)
# You can modify the prompt for your task
system_prompt = """You are an expert in composing functions. You are given a question and a set of possible functions. Based on the question, you will need to make one or more function/tool calls to achieve the purpose.
If none of the function can be used, point it out. If the given question lacks the parameters required by the function, also point it out.
You should only return the function call in tools call sections.
If you decide to invoke any of the function(s), you MUST put it in the format of [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)]
You SHOULD NOT include any other text in the response.
Here is a list of functions in JSON format that you can invoke.\n{functions}\n
"""
# User query
query = "Find me the sales growth rate for company XYZ for the last 3 years and also the interest coverage ratio for the same duration."
# Availabel tools in JSON format (OpenAI-format)
tools = [
{
"name": "financial_ratios.interest_coverage", "description": "Calculate a company's interest coverage ratio given the company name and duration",
"arguments": {
"type": "dict",
"properties": {
"company_name": {
"type": "string",
"description": "The name of the company."
},
"years": {
"type": "integer",
"description": "Number of past years to calculate the ratio."
}
},
"required": ["company_name", "years"]
}
},
{
"name": "sales_growth.calculate",
"description": "Calculate a company's sales growth rate given the company name and duration",
"arguments": {
"type": "dict",
"properties": {
"company": {
"type": "string",
"description": "The company that you want to get the sales growth rate for."
},
"years": {
"type": "integer",
"description": "Number of past years for which to calculate the sales growth rate."
}
},
"required": ["company", "years"]
}
},
{
"name": "weather_forecast",
"description": "Retrieve a weather forecast for a specific location and time frame.",
"arguments": {
"type": "dict",
"properties": {
"location": {
"type": "string",
"description": "The city that you want to get the weather for."
},
"days": {
"type": "integer",
"description": "Number of days for the forecast."
}
},
"required": ["location", "days"]
}
}
]
messages = [
{'role': 'system', 'content': system_prompt.format(functions=tools)},
{'role': 'user', 'content': query}
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))
```
Then you should be able to see the following output functional calls:
```
[sales_growth.calculate(company="XYZ", years=3), financial_ratios.interest_coverage(company_name="XYZ", years=3)]
```
### Citation
If you think ToolACE is useful in your work, please cite our paper:
```
@inproceedings{
liu2025toolace,
title={Tool{ACE}: Winning the Points of {LLM} Function Calling},
author={Weiwen Liu and Xu Huang and Xingshan Zeng and xinlong hao and Shuai Yu and Dexun Li and Shuai Wang and Weinan Gan and Zhengying Liu and Yuanqing Yu and Zezhong WANG and Yuxian Wang and Wu Ning and Yutai Hou and Bin Wang and Chuhan Wu and Wang Xinzhi and Yong Liu and Yasheng Wang and Duyu Tang and Dandan Tu and Lifeng Shang and Xin Jiang and Ruiming Tang and Defu Lian and Qun Liu and Enhong Chen},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=8EB8k6DdCU}
}
```

BIN
config.json (Stored with Git LFS) Normal file

Binary file not shown.

BIN
generation_config.json (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c609ab05c869ad26138e7ea42b46b998bd2c039a94a3202395a4870e76284daf
size 4976698672

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76cd59de5a9bc8340679f7f39cbd627db5eadb78cff9193939c08ea302d0a938
size 4999802720

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58a81ba91573ca70172d962e84ef67992866acd5ba753c862e9f2c7b8ea2053f
size 4915916176

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e5e7cfc77d542476b7a737af80505cf946f8f58f0b9ce3dedc4758cb2e1a386
size 1168138808

BIN
model.safetensors.index.json (Stored with Git LFS) Normal file

Binary file not shown.

BIN
special_tokens_map.json (Stored with Git LFS) Normal file

Binary file not shown.

BIN
tokenizer.json (Stored with Git LFS) Normal file

Binary file not shown.

BIN
tokenizer_config.json (Stored with Git LFS) Normal file

Binary file not shown.