Update README.md
Browse files
README.md
CHANGED
|
@@ -1,21 +1,65 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
tags:
|
| 4 |
-
-
|
| 5 |
-
-
|
| 6 |
-
-
|
| 7 |
- llama
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
-
|
| 16 |
-
- **License:** apache-2.0
|
| 17 |
-
- **Finetuned from model :** unsloth/Meta-Llama-3.1-8B-Instruct
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: llama3.1
|
| 3 |
+
base_model: meta-llama/Llama-3.1-8B-Instruct
|
| 4 |
tags:
|
| 5 |
+
- function-calling
|
| 6 |
+
- tool-use
|
| 7 |
+
- fine-tuned
|
| 8 |
- llama
|
| 9 |
+
datasets:
|
| 10 |
+
- Salesforce/xlam-function-calling-60k
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Llama 3.1 8B Function Calling
|
| 15 |
|
| 16 |
+
Fine-tuned [Llama 3.1 8B Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) for function/tool calling.
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
## Training
|
| 19 |
|
| 20 |
+
- **Dataset:** 900 examples from [Salesforce/xlam-function-calling-60k](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k)
|
| 21 |
+
- **Method:** LoRA (r=16, alpha=16)
|
| 22 |
+
- **Trainable params:** 42M / 8B (0.52%)
|
| 23 |
+
- **Epochs:** 1
|
| 24 |
+
- **Loss:** 0.66 → 0.63
|
| 25 |
+
|
| 26 |
+
## Evaluation (100 held-out samples)
|
| 27 |
+
|
| 28 |
+
- **Exact match:** 62%
|
| 29 |
+
- **Function name accuracy:** ~90%+
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
```python
|
| 33 |
+
from vllm import LLM
|
| 34 |
+
|
| 35 |
+
llm = LLM(model="alfazick/llama-3.1-8b-function-calling")
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
Or with transformers:
|
| 39 |
+
```python
|
| 40 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 41 |
+
|
| 42 |
+
model = AutoModelForCausalLM.from_pretrained("alfazick/llama-3.1-8b-function-calling")
|
| 43 |
+
tokenizer = AutoTokenizer.from_pretrained("alfazick/llama-3.1-8b-function-calling")
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Prompt Format
|
| 47 |
+
```
|
| 48 |
+
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
| 49 |
+
|
| 50 |
+
You are a helpful assistant with access to the following tools or function calls. Your task is to produce a sequence of tools or function calls necessary to generate response to the user utterance. Use the following tools or function calls as required:
|
| 51 |
+
[{"name": "func_name", "description": "...", "parameters": {...}}]<|eot_id|><|start_header_id|>user<|end_header_id|>
|
| 52 |
+
|
| 53 |
+
{query}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Output Format
|
| 57 |
+
```json
|
| 58 |
+
[{"name": "function_name", "arguments": {"arg": "value"}}]
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Limitations
|
| 62 |
+
|
| 63 |
+
- Trained on 900 examples (proof of concept)
|
| 64 |
+
- May have argument variations vs ground truth
|
| 65 |
+
- Best for single/simple tool calls
|