Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: unsloth/functiongemma-270m-it
|
| 4 |
+
tags:
|
| 5 |
+
- function-calling
|
| 6 |
+
- tool-use
|
| 7 |
+
- mobile-actions
|
| 8 |
+
- gemma
|
| 9 |
+
- unsloth
|
| 10 |
+
datasets:
|
| 11 |
+
- google/mobile-actions
|
| 12 |
+
language:
|
| 13 |
+
- en
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## Model Card
|
| 18 |
+
|
| 19 |
+
This model is fine-tuned version of [google/functiongemma-270m-it](https://huggingface.co/google/functiongemma-270m-it) model for mobile action function calling tasks.
|
| 20 |
+
|
| 21 |
+
## Intended Use
|
| 22 |
+
|
| 23 |
+
Handles function-calling style mobile actions such as creating calendar events, sending emails, adding contacts, showing maps, managing Wi‑Fi, and toggling the flashlight, based on the `google/mobile-actions` dataset.
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
- **Base Model**: [unsloth/functiongemma-270m-it](https://huggingface.co/unsloth/functiongemma-270m-it) (Gemma 3 distilled by Unsloth)
|
| 28 |
+
- **Fine-tuning**: SFT with LoRA (merged with `merge_and_unload`, now single checkpoint)
|
| 29 |
+
- **Dataset**: [google/mobile-actions](https://huggingface.co/datasets/google/mobile-actions)
|
| 30 |
+
- **Params**: ~270M (base) + LoRA merged into final weights
|
| 31 |
+
|
| 32 |
+
## Quick Start
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
pip install torch transformers datasets accelerate huggingface_hub
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
import torch
|
| 40 |
+
from datasets import load_dataset
|
| 41 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
| 42 |
+
|
| 43 |
+
model_id = "dousery/functiongemma-mobile-actions"
|
| 44 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 45 |
+
|
| 46 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 47 |
+
model_id,
|
| 48 |
+
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
| 49 |
+
device_map="auto" if device == "cuda" else None,
|
| 50 |
+
trust_remote_code=True,
|
| 51 |
+
).eval()
|
| 52 |
+
|
| 53 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 54 |
+
if device == "cpu":
|
| 55 |
+
model = model.to(device)
|
| 56 |
+
|
| 57 |
+
dataset = load_dataset("google/mobile-actions", split="train")
|
| 58 |
+
text = tokenizer.apply_chat_template(
|
| 59 |
+
dataset[0]["messages"][:2],
|
| 60 |
+
tools=dataset[0]["tools"],
|
| 61 |
+
tokenize=False,
|
| 62 |
+
add_generation_prompt=True,
|
| 63 |
+
).removeprefix("<bos>")
|
| 64 |
+
|
| 65 |
+
inputs = tokenizer(text, return_tensors="pt").to(device)
|
| 66 |
+
with torch.no_grad():
|
| 67 |
+
_ = model.generate(
|
| 68 |
+
**inputs,
|
| 69 |
+
max_new_tokens=256,
|
| 70 |
+
streamer=TextStreamer(tokenizer, skip_prompt=True),
|
| 71 |
+
top_p=0.95,
|
| 72 |
+
top_k=64,
|
| 73 |
+
temperature=1.0,
|
| 74 |
+
)
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Training Summary
|
| 78 |
+
|
| 79 |
+
- **Frameworks**: Unsloth + TRL, PyTorch 2.9.1, Transformers 4.57.3
|
| 80 |
+
- **Steps**: 100 (SFT with LoRA, then merged)
|
| 81 |
+
- **Effective Batch Size**: 8 (bs=4, grad accum=2)
|
| 82 |
+
- **LR / Scheduler**: 2e-4, linear
|
| 83 |
+
- **LoRA**: r=16, alpha=16, dropout=0, ~3.8M trainable params
|
| 84 |
+
- **Seq Len**: 4096
|
| 85 |
+
- **Hardware**: NVIDIA H100 80GB on Modal
|
| 86 |
+
- **Final Train Loss**: 0.2408 | **Eval Loss**: ~0.0129
|
| 87 |
+
|
| 88 |
+
## Limitations
|
| 89 |
+
|
| 90 |
+
- Trained for only 100 steps; niche mobile-action domain.
|
| 91 |
+
- Datetime formats can drift slightly.
|
| 92 |
+
- Best on GPU for speed; CPU works but slower.
|
| 93 |
+
|
| 94 |
+
## Citation
|
| 95 |
+
|
| 96 |
+
```bibtex
|
| 97 |
+
@misc{functiongemma-mobile-actions,
|
| 98 |
+
title={FunctionGemma Mobile Actions - Merged for Mobile Function Calling},
|
| 99 |
+
author={dousery},
|
| 100 |
+
year={2025},
|
| 101 |
+
howpublished={\url{https://huggingface.co/dousery/functiongemma-mobile-actions}}
|
| 102 |
+
}
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
## License
|
| 106 |
+
|
| 107 |
+
Apache-2.0 (inherits base model license).
|
| 108 |
+
|