Downloads · 30 days
0
Shumatsurontek/granite-4.0-h-micro-Toucan-120k
granite-4.0-h-micro-Toucan-120k is a text generation model from Shumatsurontek. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Oct 6, 2025
Repo size
154 MB
Likes
0
Public
Click a slice to open those files.
.safetensors154 MB · 94%
From the Hugging Face model README
This is a tool calling / function calling fine-tuned version of IBM's Granite 4.0 H-Micro model, trained on the high-quality Toucan-1.5M dataset. The model has been optimized to understand tool declarations and generate structured function calls for agentic workflows.
Key Features:
This model extends IBM's Granite 4.0 H-Micro with advanced tool calling capabilities through supervised fine-tuning on the Toucan-1.5M dataset's SFT subset. It can:
Developed by: Shumatsurontek
Model type: Causal Language Model (Decoder-only)
Language(s): English, French
License: Apache 2.0
Finetuned from: unsloth/granite-4.0-h-micro
Base Architecture: IBM Granite 4.0 with MoE-Hybrid (Mamba + Attention)
This model is designed for agentic AI applications that require function calling capabilities:
from unsloth import FastLanguageModel
import torch
# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="Shumatsurontek/granite-4.0-h-micro-Toucan-120k",
max_seq_length=2048,
load_in_4bit=True,
)
# Enable inference mode
FastLanguageModel.for_inference(model)
# Define tools
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"},
"units": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["location"]
}
}
}
]
# Create message with tool declaration
messages = [
{
"role": "system",
"content": f"<|im_system|>tool_declare<|im_middle|>{json.dumps(tools)}<|im_end|>"
},
{
"role": "user",
"content": "What's the weather in Paris? I prefer Celsius."
}
]
# Generate response
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
).to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Dataset: Agent-Ark/Toucan-1.5M
Subset: SFT (Supervised Fine-Tuning)
Size: ~119,000 examples
Quality: High-quality curated tool calling conversations
The Toucan-1.5M dataset contains diverse tool calling scenarios including:
Data Format:
{
"messages": [
{"role": "system", "content": "tool declarations..."},
{"role": "user", "content": "user query"},
{"role": "assistant", "content": "response", "function_call": {...}},
{"role": "function", "content": "tool result", "name": "tool_name"}
]
}
Framework: Unsloth + TRL (Transformer Reinforcement Learning)
Method: Supervised Fine-Tuning (SFT) with LoRA
Hardware: Tesla T4 GPU (16GB VRAM) on Google Colab
{
"r": 32,
"lora_alpha": 32,
"lora_dropout": 0.0,
"target_modules": [
"q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj",
"shared_mlp.input_linear", "shared_mlp.output_linear"
],
"bias": "none",
"use_rslora": false
}
| Parameter | Value |
|---|---|
| Batch Size (per device) | 2 |
| Gradient Accumulation Steps | 4 |
| Effective Batch Size | 8 |
| Learning Rate | 2e-4 |
| Warmup Steps | 5 |
| Max Steps | 60 |
| Optimizer | AdamW 8-bit |
| Weight Decay | 0.01 |
| LR Scheduler | Linear |
| Max Sequence Length | 2048 |
| Gradient Checkpointing | Unsloth (30% less VRAM) |
| Mixed Precision | FP16 |
| Seed | 3407 |
Training Regime: FP16 mixed precision with 8-bit AdamW optimizer
Special Technique: Train-on-completions masking to only compute loss on assistant responses, improving fine-tune quality.
Scenario 1: Weather Service Debugging
User: Ma page météo reste bloquée sur "Chargement…" depuis hier soir.
Agent: D'accord, je vais vérifier le statut du service météo.
Function Call:
{
"name": "get_weather_status",
"arguments": {
"location": "current",
"service": "MeteoAPI"
}
}
Scenario 2: Billing Issue Resolution
User: J'ai été débité deux fois pour mon abonnement Pro ce mois-ci.
Agent: Je vais vérifier vos factures récentes.
Function Call:
{
"name": "get_invoice",
"arguments": {
"user_id": "U3421",
"month": "2025-10"
}
}
Recommendations for Production:
Base: IBM Granite 4.0 H-Micro
Type: MoE-Hybrid (Mamba SSM + Multi-Head Attention)
Parameters: ~400M (base model)
Trainable Parameters: 1.7M (LoRA adapters)
Context Length: 2048 tokens
Vocabulary Size: 49,152
Estimated CO2 Emissions: < 0.01 kg CO2eq
Based on ~16 minutes of T4 GPU usage
The model uses Granite 4.0's chat template:
<|start_of_role|>system<|end_of_role|>
<|im_system|>tool_declare<|im_middle|>[tool definitions]<|im_end|>
<|end_of_text|>
<|start_of_role|>user<|end_of_role|>
User query here
<|end_of_text|>
<|start_of_role|>assistant<|end_of_role|>
Assistant response with function calls
<|end_of_text|>
@misc{granite-toucan-2025,
author = {Shumatsurontek},
title = {Granite 4.0 H-Micro Fine-tuned for Tool Calling},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Shumatsurontek/granite-4.0-h-micro-Toucan-120k}}
}
@misc{toucan2024,
title={Toucan-1.5M: A Dataset for Training and Evaluating Tool-Calling Agents},
author={Agent-Ark},
year={2024},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/datasets/Agent-Ark/Toucan-1.5M}}
}
@software{unsloth2024,
title={Unsloth: 2x Faster LLM Training},
author={Unsloth Team},
year={2024},
url={https://github.com/unslothai/unsloth}
}
@misc{granite2024,
title={Granite 4.0: IBM's Open Foundation Models},
author={IBM Research},
year={2024},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/ibm-granite/granite-4.0-h-micro}}
}
This model inherits the Apache 2.0 license from the base Granite 4.0 model.
For questions, issues, or collaboration:
Built with ❤️ using Unsloth | Powered by IBM Granite
</div>