Downloads · 30 days
20
25% of all-time downloads
roshangrewal/gemma4-e4b-toolcall-v02-lora
gemma4-e4b-toolcall-v02-lora is a text generation model from roshangrewal. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
QLoRA adapter for tool-calling, designed to be applied on top of google/gemma-4-E4B-it. Achieves 94.4% accuracy on 1000 diverse tool-calling queries.
Downloads · 30 days
20
25% of all-time downloads
All-time downloads
79
Public
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.safetensors679 MB · 67%
From the Hugging Face model README
QLoRA adapter for tool-calling, designed to be applied on top of google/gemma-4-E4B-it. Achieves 94.4% accuracy on 1000 diverse tool-calling queries.
For full details, see the merged model card.
from transformers import AutoProcessor, AutoModelForMultimodalLM
from peft import PeftModel
import torch
# Load base + adapter
base = AutoModelForMultimodalLM.from_pretrained(
"google/gemma-4-E4B-it",
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base, "roshangrewal/gemma4-e4b-toolcall-v02-lora")
model.eval()
processor = AutoProcessor.from_pretrained("google/gemma-4-E4B-it")
# Define tools and query
tools = [{"type": "function", "function": {
"name": "get_weather",
"description": "Get weather for a city",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
}}]
messages = [{"role": "user", "content": "What's the weather in Mumbai?"}]
text = processor.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True)
inputs = processor(text=text, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=200, do_sample=False)
print(processor.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
# <|tool_call>call:get_weather{city:<|"|>Mumbai<|"|>}<tool_call|>
| Parameter | Value |
|---|---|
| LoRA rank | 64 |
| LoRA alpha | 128 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Trainable params | 169M (2.08% of 8.1B) |
| Adapter size | ~679 MB |
| Training | 5000 steps, 78K examples, ~85 hours, Unsloth |
| Category | Accuracy |
|---|---|
| Multiple | 95.0% |
| Parallel | 90.0% |
| Simple Python | 88.5% |
| Parallel Multiple | 86.0% |
| Live Simple | 79.8% |
| Non-Live Average | 86.5% |
| Category | Accuracy |
|---|---|
| Simple | 100% |
| Complex Params | 100% |
| Many Tools (12+) | 93% |
| Ambiguous | 91.5% |
| No-Tool-Needed | 87.5% |
| OVERALL | 94.4% |