Text Generation
Transformers
Safetensors
llama
function-calling
conversational
text-generation-inference
Instructions to use fireworks-ai/llama-3-firefunction-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fireworks-ai/llama-3-firefunction-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fireworks-ai/llama-3-firefunction-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fireworks-ai/llama-3-firefunction-v2") model = AutoModelForCausalLM.from_pretrained("fireworks-ai/llama-3-firefunction-v2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fireworks-ai/llama-3-firefunction-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fireworks-ai/llama-3-firefunction-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fireworks-ai/llama-3-firefunction-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fireworks-ai/llama-3-firefunction-v2
- SGLang
How to use fireworks-ai/llama-3-firefunction-v2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "fireworks-ai/llama-3-firefunction-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fireworks-ai/llama-3-firefunction-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "fireworks-ai/llama-3-firefunction-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fireworks-ai/llama-3-firefunction-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use fireworks-ai/llama-3-firefunction-v2 with Docker Model Runner:
docker model run hf.co/fireworks-ai/llama-3-firefunction-v2
Update README.md
Browse files
README.md
CHANGED
|
@@ -18,14 +18,7 @@ FireFunction is a state-of-the-art function calling model with a commercially vi
|
|
| 18 |
|
| 19 |
💡 Hosted on the [Fireworks](https://fireworks.ai/models/fireworks/firefunction-v2) platform
|
| 20 |
|
| 21 |
-
##
|
| 22 |
-
* [Fireworks discord with function calling channel](https://discord.gg/mMqQxvFD9A)
|
| 23 |
-
* [Documentation](https://readme.fireworks.ai/docs/function-calling)
|
| 24 |
-
* [UI Demo app](https://functional-chat.vercel.app/)
|
| 25 |
-
* [Try in Fireworks prompt playground UI](https://fireworks.ai/models/fireworks/firefunction-v2)
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# Intended Use and Limitations
|
| 29 |
|
| 30 |
### Supported usecases
|
| 31 |
The model was tuned to perfom well on a range of usecases including:
|
|
@@ -40,6 +33,18 @@ The model was not optimized for the following use cases:
|
|
| 40 |
* 100+ function specs
|
| 41 |
* nested function calling
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
## Example Usage
|
| 44 |
|
| 45 |
See [documentation](https://readme.fireworks.ai/docs/function-calling) for more detail.
|
|
@@ -110,6 +115,8 @@ decoded = tokenizer.batch_decode(generated_ids)
|
|
| 110 |
print(decoded[0])
|
| 111 |
```
|
| 112 |
|
| 113 |
-
##
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
💡 Hosted on the [Fireworks](https://fireworks.ai/models/fireworks/firefunction-v2) platform
|
| 20 |
|
| 21 |
+
## Intended Use and Limitations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
### Supported usecases
|
| 24 |
The model was tuned to perfom well on a range of usecases including:
|
|
|
|
| 33 |
* 100+ function specs
|
| 34 |
* nested function calling
|
| 35 |
|
| 36 |
+
## Metrics
|
| 37 |
+
|
| 38 |
+
| | Firefunction v1 | Firefunction v2 | Llama 3 70b Instruct | Gpt-4o |
|
| 39 |
+
|------------------------------------|-----------------|-----------------|----------------------|--------|
|
| 40 |
+
| Gorilla simple | 0.91 | 0.94 | 0.925 | 0.88 |
|
| 41 |
+
| Gorilla multiple_function | 0.92 | 0.91 | 0.86 | 0.91 |
|
| 42 |
+
| Gorilla parallel_function | 0 | 0.9 | 0.86 | 0.89 |
|
| 43 |
+
| Gorilla parallel_multiple_function | 0 | 0.8 | 0.615 | 0.72 |
|
| 44 |
+
| Nexus parallel | 0.38 | 0.53 | 0.3 | 0.47 |
|
| 45 |
+
| Mtbench | 0.73 | 0.84 | 0.89 | 0.93 |
|
| 46 |
+
| Average | 0.49 | 0.82 | 0.74 | 0.8 |
|
| 47 |
+
|
| 48 |
## Example Usage
|
| 49 |
|
| 50 |
See [documentation](https://readme.fireworks.ai/docs/function-calling) for more detail.
|
|
|
|
| 115 |
print(decoded[0])
|
| 116 |
```
|
| 117 |
|
| 118 |
+
## Resources
|
| 119 |
+
* [Fireworks discord with function calling channel](https://discord.gg/mMqQxvFD9A)
|
| 120 |
+
* [Documentation](https://readme.fireworks.ai/docs/function-calling)
|
| 121 |
+
* [Demo app](https://functional-chat.vercel.app/)
|
| 122 |
+
* [Try in Fireworks prompt playground UI](https://fireworks.ai/models/fireworks/firefunction-v2)
|