Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +134 -0
- llama-3-firefunction-v2.Q4_0.gguf +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
llama-3-firefunction-v2.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: llama3
|
3 |
+
tags:
|
4 |
+
- function-calling
|
5 |
+
---
|
6 |
+
|
7 |
+
# FireFunction V2: Fireworks Function Calling Model
|
8 |
+
|
9 |
+
[**Try on Fireworks**](https://fireworks.ai/models/fireworks/firefunction-v2) | [**API Docs**](https://readme.fireworks.ai/docs/function-calling) | [**Demo App**](https://functional-chat.vercel.app/) | [**Discord**](https://discord.gg/mMqQxvFD9A)
|
10 |
+
|
11 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/64b6f3a72f5a966b9722de88/nJNtxLzWswBDKK1iOZblb.png" alt="firefunction" width="400"/>
|
12 |
+
|
13 |
+
FireFunction is a state-of-the-art function calling model with a commercially viable license. View detailed info in our [announcement blog](https://fireworks.ai/blog/firefunction-v2-launch-post). Key info and highlights:
|
14 |
+
|
15 |
+
**Comparison with other models:**
|
16 |
+
- Competitive with GPT-4o at function-calling, scoring 0.81 vs 0.80 on a medley of public evaluations
|
17 |
+
- Trained on Llama 3 and retains Llama 3’s conversation and instruction-following capabilities, scoring 0.84 vs Llama 3’s 0.89 on MT bench
|
18 |
+
- Significant quality improvements over FireFunction v1 across the broad range of metrics
|
19 |
+
|
20 |
+
|
21 |
+
**General info:**
|
22 |
+
|
23 |
+
🐾 Successor of the [FireFunction](https://fireworks.ai/models/fireworks/firefunction-v1) model
|
24 |
+
|
25 |
+
🔆 Support of parallel function calling (unlike FireFunction v1) and good instruction following
|
26 |
+
|
27 |
+
💡 Hosted on the [Fireworks](https://fireworks.ai/models/fireworks/firefunction-v2) platform at < 10% of the cost of GPT 4o and 2x the speed
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
## Intended Use and Limitations
|
33 |
+
|
34 |
+
### Supported usecases
|
35 |
+
The model was tuned to perfom well on a range of usecases including:
|
36 |
+
* general instruction following
|
37 |
+
* multi-turn chat mixing vanilla messages with function calls
|
38 |
+
* single- and parallel function calling
|
39 |
+
* up to 20 function specs supported at once
|
40 |
+
* structured information extraction
|
41 |
+
|
42 |
+
The model has an 8k context window, like Llama 3
|
43 |
+
|
44 |
+
### Out-of-Scope Use
|
45 |
+
The model was not optimized for the following use cases:
|
46 |
+
* 100+ function specs
|
47 |
+
* nested function calling
|
48 |
+
|
49 |
+
## Metrics
|
50 |
+
|
51 |
+
| Benchmark | Firefunction v1 | Firefunction v2 | Llama 3 70b Instruct | Gpt-4o |
|
52 |
+
|:-----------------------------------|:----------------|:----------------|:---------------------|:-------|
|
53 |
+
| Gorilla simple | 0.91 | 0.94 | 0.925 | 0.88 |
|
54 |
+
| Gorilla multiple_function | 0.92 | 0.91 | 0.86 | 0.91 |
|
55 |
+
| Gorilla parallel_function | 0 | 0.9 | 0.86 | 0.89 |
|
56 |
+
| Gorilla parallel_multiple_function | 0 | 0.8 | 0.615 | 0.72 |
|
57 |
+
| Nexus parallel | 0.38 | 0.53 | 0.3 | 0.47 |
|
58 |
+
| Mtbench | 0.73 | 0.84 | 0.89 | 0.93 |
|
59 |
+
| Average | 0.49 | 0.82 | 0.74 | 0.8 |
|
60 |
+
|
61 |
+
## Example Usage
|
62 |
+
|
63 |
+
See [documentation](https://readme.fireworks.ai/docs/function-calling) for more detail.
|
64 |
+
|
65 |
+
```python
|
66 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
67 |
+
import json
|
68 |
+
from datetime import datetime
|
69 |
+
|
70 |
+
device = "cuda" # the device to load the model onto
|
71 |
+
|
72 |
+
model = AutoModelForCausalLM.from_pretrained("fireworks-ai/firefunction-v2", device_map="auto")
|
73 |
+
tokenizer = AutoTokenizer.from_pretrained("fireworks-ai/firefunction-v2")
|
74 |
+
|
75 |
+
function_spec = [
|
76 |
+
{
|
77 |
+
"name": "get_stock_price",
|
78 |
+
"description": "Get the current stock price",
|
79 |
+
"parameters": {
|
80 |
+
"type": "object",
|
81 |
+
"properties": {
|
82 |
+
"symbol": {
|
83 |
+
"type": "string",
|
84 |
+
"description": "The stock symbol, e.g. AAPL, GOOG"
|
85 |
+
}
|
86 |
+
},
|
87 |
+
"required": [
|
88 |
+
"symbol"
|
89 |
+
]
|
90 |
+
}
|
91 |
+
},
|
92 |
+
{
|
93 |
+
"name": "check_word_anagram",
|
94 |
+
"description": "Check if two words are anagrams of each other",
|
95 |
+
"parameters": {
|
96 |
+
"type": "object",
|
97 |
+
"properties": {
|
98 |
+
"word1": {
|
99 |
+
"type": "string",
|
100 |
+
"description": "The first word"
|
101 |
+
},
|
102 |
+
"word2": {
|
103 |
+
"type": "string",
|
104 |
+
"description": "The second word"
|
105 |
+
}
|
106 |
+
},
|
107 |
+
"required": [
|
108 |
+
"word1",
|
109 |
+
"word2"
|
110 |
+
]
|
111 |
+
}
|
112 |
+
}
|
113 |
+
]
|
114 |
+
functions = json.dumps(function_spec, indent=4)
|
115 |
+
|
116 |
+
messages = [
|
117 |
+
{'role': 'system', 'content': 'You are a helpful assistant with access to functions. Use them if required.'},
|
118 |
+
{'role': 'user', 'content': 'Hi, can you tell me the current stock price of google and netflix?'}
|
119 |
+
]
|
120 |
+
|
121 |
+
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
122 |
+
|
123 |
+
model_inputs = tokenizer.apply_chat_template(messages, functions=functions, datetime=now, return_tensors="pt").to(model.device)
|
124 |
+
|
125 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=128)
|
126 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
127 |
+
print(decoded[0])
|
128 |
+
```
|
129 |
+
|
130 |
+
## Resources
|
131 |
+
* [Fireworks discord with function calling channel](https://discord.gg/mMqQxvFD9A)
|
132 |
+
* [Documentation](https://readme.fireworks.ai/docs/function-calling)
|
133 |
+
* [Demo app](https://functional-chat.vercel.app/)
|
134 |
+
* [Try in Fireworks prompt playground UI](https://fireworks.ai/models/fireworks/firefunction-v2)
|
llama-3-firefunction-v2.Q4_0.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b693816ddbf95c951a1247765fb8b0f2e802e2793da0ed5b3a1b4118e445945
|
3 |
+
size 39969735456
|