NanoMind β€” Mobile Actions (Function Calling)

Fine-tuned on google/mobile-actions for on-device function calling (calendar, email, contacts, maps, flashlight, Wi-Fi).

Quick Start

from hf_wrapper import NanoMindForFunctionCalling
import tiktoken, torch, json

model = NanoMindForFunctionCalling.from_pretrained(
    "shawneil/NanoMind-MobileActions"
)
model.eval()
enc = tiktoken.get_encoding("gpt2")

# Build a prompt in the same format used during training
tools_json = json.dumps([{"function": {"name": "create_calendar_event",
    "description": "Creates a calendar event.",
    "parameters": {"properties": {"title": {"type": "STRING"},
    "datetime": {"type": "STRING"}}, "required": ["title","datetime"]}}}])

prompt = (
    "<|tools|>\n" + tools_json + "\n<|endtools|>\n"
    "<|system|>\nYou are a function-calling assistant.\n<|endoftext|>\n"
    "<|user|>\nSet a meeting tomorrow at 3 PM called 'Budget Review'.\n<|endoftext|>\n"
    "<|assistant|>\n"
)
ids = torch.tensor([enc.encode_ordinary(prompt)], dtype=torch.long)
out = model.generate_text(ids, max_new_tokens=80, temperature=0.0, top_k=1)
print(enc.decode(out[0].tolist()))

Training details

  • Base: NanoMind SFT-Dolly (shawneil/NanoMind-SFT-Dolly)
  • Dataset: google/mobile-actions (~9.65k rows)
  • Loss only on assistant/tool-call tokens
  • fp16 Β· torch.compile Β· 2Γ— T4 DDP
Downloads last month
17
Safetensors
Model size
74.1M params
Tensor type
C64
Β·
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support