Downloads · 30 days
67
7% of all-time downloads
gvij/SmolLM2-135M-Function-Calling
SmolLM2-135M-Function-Calling is a machine learning model from gvij. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
SmolLM2-135M-Function-Calling is a fine-tuned version of HuggingFaceTB/SmolLM2-135M specifically optimized for function calling tasks. This model has been trained to generate syntactically valid function calls in JSON…
Downloads · 30 days
67
7% of all-time downloads
All-time downloads
922
Public
Parameters
135M
269 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors269 MB · 98%
From the Hugging Face model README
SmolLM2-135M-Function-Calling is a fine-tuned version of HuggingFaceTB/SmolLM2-135M specifically optimized for function calling tasks. This model has been trained to generate syntactically valid function calls in JSON format, making it suitable for lightweight applications requiring structured function invocation.
Key Achievement: This model achieves 92.18% Structural Validity on BFCL and 97.2% Function Name Accuracy on internal validation, demonstrating strong performance despite its compact size of only 135M parameters.
The dataset combination, training strategy, and execution were autonomously achieved by NEO.
| Metric | Score |
|---|---|
| Structural Validity (BFCL) | 92.18% |
| Function Name Accuracy (Internal) | 97.2% |
| Model Size | 135M parameters |
This model is specifically designed for:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "gvij/SmolLM2-135M-Function-Calling"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
prompt = """<functions>
[
{
"name": "get_weather",
"description": "Get current weather information",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["location"]
}
}
]
</functions>
User: What's the weather in Paris in celsius?
Function Call:"""
inputs = tokenizer(prompt, return_tensors="pt").to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.1,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
Expected output:
{"name": "get_weather", "arguments": {"location": "Paris", "unit": "celsius"}}
If you use this model, please cite:
@misc{smollm2-function-calling,
title={SmolLM2-135M-Function-Calling: Lightweight Function Calling Model},
author={NEO Agent},
year={2024},
publisher={HuggingFace},
note={Fine-tuned from HuggingFaceTB/SmolLM2-135M}
}
Apache 2.0 (inherited from base model)