Downloads · 30 days
220
17% of all-time downloads
RichardErkhov/meetkai_-_functionary-small-v3.1-gguf
meetkai_-_functionary-small-v3.1-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
220
17% of all-time downloads
All-time downloads
1.3K
Public
Repo size
92.9 GB
Likes
1
Public
Click a slice to open those files.
.gguf108 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
functionary-small-v3.1 - GGUF
| Name | Quant method | Size |
|---|---|---|
| functionary-small-v3.1.Q2_K.gguf | Q2_K | 2.96GB |
| functionary-small-v3.1.IQ3_XS.gguf | IQ3_XS | 3.28GB |
| functionary-small-v3.1.IQ3_S.gguf | IQ3_S | 3.43GB |
| functionary-small-v3.1.Q3_K_S.gguf | Q3_K_S | 3.41GB |
| functionary-small-v3.1.IQ3_M.gguf | IQ3_M | 3.52GB |
| functionary-small-v3.1.Q3_K.gguf | Q3_K | 3.74GB |
| functionary-small-v3.1.Q3_K_M.gguf | Q3_K_M | 3.74GB |
| functionary-small-v3.1.Q3_K_L.gguf | Q3_K_L | 4.03GB |
| functionary-small-v3.1.IQ4_XS.gguf | IQ4_XS | 4.18GB |
| functionary-small-v3.1.Q4_0.gguf | Q4_0 | 4.34GB |
| functionary-small-v3.1.IQ4_NL.gguf | IQ4_NL | 4.38GB |
| functionary-small-v3.1.Q4_K_S.gguf | Q4_K_S | 4.37GB |
| functionary-small-v3.1.Q4_K.gguf | Q4_K | 4.58GB |
| functionary-small-v3.1.Q4_K_M.gguf | Q4_K_M | 4.58GB |
| functionary-small-v3.1.Q4_1.gguf | Q4_1 | 4.78GB |
| functionary-small-v3.1.Q5_0.gguf | Q5_0 | 5.21GB |
| functionary-small-v3.1.Q5_K_S.gguf | Q5_K_S | 5.21GB |
| functionary-small-v3.1.Q5_K.gguf | Q5_K | 5.34GB |
| functionary-small-v3.1.Q5_K_M.gguf | Q5_K_M | 5.34GB |
| functionary-small-v3.1.Q5_1.gguf | Q5_1 | 5.65GB |
| functionary-small-v3.1.Q6_K.gguf | Q6_K | 6.14GB |
| functionary-small-v3.1.Q8_0.gguf | Q8_0 | 7.95GB |
This model was based on meta-llama/Meta-Llama-3.1-8B-Instruct, using Meta's original prompt template as described in: User-defined Custom tool calling
https://github.com/MeetKai/functionary
<img src="https://huggingface.co/meetkai/functionary-medium-v2.2/resolve/main/functionary_logo.jpg" alt="Functionary Logo" width="300"/>Functionary is a language model that can interpret and execute functions/plugins.
The model determines when to execute functions, whether in parallel or serially, and can understand their outputs. It only triggers functions as needed. Function definitions are given as JSON Schema Objects, similar to OpenAI GPT function calls.
We provide custom code for both converting tool definitions into the system prompts and parsing raw model response into a JSON object containing role, content and tool_calls fields. This enables the model to be able to generate tool calls.
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("meetkai/functionary-small-v3.1", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("meetkai/functionary-small-v3.1", device_map="auto", trust_remote_code=True)
tools = [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
}
]
messages = [{"role": "user", "content": "What is the weather in Istanbul and Singapore respectively?"}]
final_prompt = tokenizer.apply_chat_template(messages, tools, add_generation_prompt=True, tokenize=False)
tokenizer.padding_side = "left"
inputs = tokenizer(final_prompt, return_tensors="pt").to("cuda")
pred = model.generate_tool_use(**inputs, max_new_tokens=128, tokenizer=tokenizer)
print(tokenizer.decode(pred.cpu()[0]))
We convert function definitions to a similar text to Meta's Llama 3.1 definitions. Then we inject these definitions as system prompts. After that, we inject the default system prompt. Then we start the conversation messages.
This formatting is also available via our vLLM server which we process the functions into definitions encapsulated in a system message and use a pre-defined Transformers chat template. This means that lists of messages can be formatted for you with the apply_chat_template() method within our server:
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="functionary")
client.chat.completions.create(
model="path/to/functionary/model/",
messages=[{"role": "user",
"content": "What is the weather for Istanbul?"}
],
tools=[{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
}],
tool_choice="auto"
)
will yield:
<|start_header_id|>system<|end_header_id|>
Environment: ipython
Cutting Knowledge Date: December 2023
You have access to the following functions:
Use the function 'get_current_weather' to 'Get the current weather'
{"name": "get_current_weather", "description": "Get the current weather", "parameters": {"type": "object", "properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"}},"required": ["location"]}}
Think very carefully before calling functions.
If a you choose to call a function ONLY reply in the following format:
<{start_tag}={function_name}>{parameters}{end_tag}
where
start_tag => `<function`
parameters => a JSON dict with the function argument name as key and function argument value as value.
end_tag => `</function>`
Here is an example,
<function=example_function_name>{"example_name": "example_value"}</function>
Reminder:
- If looking for real time information use relevant functions before falling back to brave_search
- Function calls MUST follow the specified format, start with <function= and end with </function>
- Required parameters MUST be specified
- Only call one function at a time
- Put the entire function call reply on one line
<|eot_id|><|start_header_id|>user<|end_header_id|>
What is the weather for Istanbul?
A more detailed example is provided here.
We encourage users to run our models using our OpenAI-compatible vLLM server here.
