Downloads · 30 days
15
13% of all-time downloads
nlouis/functiongemma-pocket-q4_k_m
functiongemma-pocket-q4_k_m is a machine learning model from nlouis. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A 4-bit quantized GGUF model for function/tool calling, based on FunctionGemma and fine-tuned for a small set of tools (weather, security, web search, network scan, stock price). Optimized for edge and resource-constr…
Downloads · 30 days
15
13% of all-time downloads
All-time downloads
116
Public
Repo size
253 MB
Likes
0
Public
Click a slice to open those files.
.gguf253 MB · 100%
From the Hugging Face model README
A 4-bit quantized GGUF model for function/tool calling, based on FunctionGemma and fine-tuned for a small set of tools (weather, security, web search, network scan, stock price). Optimized for edge and resource-constrained devices (e.g. Raspberry Pi) via llama.cpp.
developer, user, assistant; assistant replies with tool calls in the form <start_function_call>{"name": "...", "arguments": {...}}<end_function_call>Fine-tuning was done on ~1000 examples generated from a fixed tool schema so the model learns to select the right function and fill arguments from natural language.
| Tool | Description |
|---|---|
get_weather | Weather or forecast for a location (location: string) |
activate_security_mode | Toggle Raspberry Pi security, cameras, PIR sensors (no args) |
web_search | Web search for current info (query: string) |
network_scan | Scan LAN for devices and open ports (no args) |
get_stock_price | Current stock price and basic market data (symbol: string, e.g. AAPL, TSLA) |
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
# Replace with your repo id, e.g. "your-username/functiongemma-pocket-q4_k_m"
REPO_ID = "YOUR_USERNAME/functiongemma-pocket-q4_k_m"
FILENAME = "functiongemma-pocket-q4_k_m.gguf"
path = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
llm = Llama(
model_path=path,
n_ctx=2048,
n_threads=4,
n_gpu_layers=-1, # use GPU if available; 0 for CPU-only
use_mmap=True,
verbose=False,
)
import json
tools = [
{"type": "function", "function": {"name": "get_weather", "description": "Weather for a location.", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}},
# ... add other tools in the same format
]
messages = [
{"role": "developer", "content": "You are a model that can do function calling with the provided functions."},
{"role": "user", "content": "What's the weather in Tokyo?"}
]
out = llm.create_chat_completion(
messages=messages,
tools=tools,
max_tokens=128,
temperature=0.1,
stop=["<end_function_call>", "<eos>"],
)
# Parse assistant message for tool name and arguments
content = out["choices"][0]["message"].get("content", "")
# content may contain <start_function_call>{"name": "get_weather", "arguments": {"location": "Tokyo"}}<end_function_call>
developer, user query in user, target tool call in assistant with tool_calls.Apache 2.0 (align with the base model’s license when distributing).