GL3MON's picture
Upload merged SFT checkpoint 525 and Aya tool-calling template
df7ccd2 verified
|
Raw History Blame Contribute Delete
2.42 kB
metadata
library_name: transformers
pipeline_tag: text-generation
base_model: CohereLabs/tiny-aya-global
tags:
  - function-calling
  - merged
  - sft

Tiny Aya function calling SFT

Merged BF16 Tiny Aya Global with LoRA checkpoint 525 from a 3-epoch SFT run on a cleaned split of NousResearch/hermes-function-calling-v1. Refer to the upstream base model and dataset for their licenses and usage terms.

The bundled Jinja template preserves Aya's original preamble and turn tokens, adds explicit tool-call instructions and a worked example, accepts tools= in apply_chat_template, and maps standard tool messages to the user-role tool observations used during SFT. It also serializes assistant tool_calls. Supply tools as standard function schemas. Parse <tool_call>{"name":"...","arguments":{...}}</tool_call> blocks and execute them in your application.

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
repo = "GL3MON/tiny-aya-global-function-calling-sft"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
tools = [{"type":"function","function":{"name":"get_weather","description":"Get current weather","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]
messages = [{"role":"user","content":"What is the weather in Paris?"}]
inputs = tokenizer.apply_chat_template(messages, tools=tools, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
with torch.inference_mode():
    output = model.generate(**inputs, max_new_tokens=256, do_sample=False, logits_to_keep=1)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Checkpoint 525 scored 12/12 format/schema-valid calls, 9/12 exact reference calls, and 4/4 no-extra-call follow-ups on a fixed 16-case held-out offline evaluation using the ORIGINAL template. Those scores do not evaluate this modified prompt, semantic answer quality, or live tool execution. The new template passed rendering and tokenizer save/reload checks. Model outputs still require validation.

original_chat_template.jinja preserves the source template. export_manifest.json identifies the precise checkpoint and base revision. The trainer's final_adapter restored an earlier best-loss checkpoint; this export deliberately uses checkpoint 525.