This repository provides an experimental Gemma 4 E2B checkpoint fine-tuned on
google/mobile-actions
for mobile action function calling.
The model was trained locally on an Apple M1 Pro with LoRA, then merged back
into the base model for direct Transformers inference.
The model converts natural language mobile assistant requests into tool calls,
for example:
1import torch
2from transformers import AutoModelForCausalLM, AutoProcessor, pipeline
3
4model_id = "YOUR_USERNAME/gemma4-e2b-mobile-actions-200"
5
6processor = AutoProcessor.from_pretrained(model_id)
7tokenizer = processor.tokenizer
8model = AutoModelForCausalLM.from_pretrained(
9 model_id,
10 dtype=torch.bfloat16,
11 device_map="auto",
12)
13
14tools = [{
15 "type": "function",
16 "function": {
17 "name": "show_map",
18 "description": "Shows a location on the map.",
19 "parameters": {
20 "type": "object",
21 "properties": {"query": {"type": "string"}},
22 "required": ["query"],
23 },
24 },
25}]
26
27messages = [
28 {"role": "system", "content": "You are a mobile assistant that calls tools."},
29 {"role": "user", "content": "Show me Patisserie Valerie on Kensington High Street."},
30]
31
32prompt = processor.apply_chat_template(
33 messages,
34 tools=tools,
35 tokenize=False,
36 add_generation_prompt=True,
37)
38
39generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
40print(generator(prompt, max_new_tokens=160, do_sample=False)[0]["generated_text"])
1python examples/run_transformers.py \
2 --model-id ClarkBear/gemma4-e2b-mobile-actions-200 \
3 --prompt "Turn on the flashlight"
This is an experimental small-data fine-tune.
This repository contains a merged Hugging Face Transformers checkpoint. To
deploy on-device with LiteRT-LM, an additional conversion and packaging step is
required.
The local training scripts and evaluation code are maintained in the companion
project used to create this checkpoint.