Update README.md
Browse files
README.md
CHANGED
|
@@ -1,36 +1,152 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
FunctionGemma 270M
|
| 4 |
|
| 5 |
-
|
| 6 |
-
**Credit**: JackJ1 for the original fine-tuning work.
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
- "Turn on flashlight"
|
| 17 |
-
- "Create contact John
|
| 18 |
-
- "Show
|
| 19 |
|
| 20 |
-
##
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
-
|
| 26 |
-
-
|
| 27 |
-
- gemma
|
| 28 |
-
- .litertlm
|
| 29 |
-
---
|
| 30 |
-
A fine-tuned model based on `google/functiongemma-270m-it`.
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
Enjoy :)
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
base_model: google/functiongemma-270m-it
|
| 6 |
+
tags:
|
| 7 |
+
- function-calling
|
| 8 |
+
- mobile-actions
|
| 9 |
+
- on-device
|
| 10 |
+
- litertlm
|
| 11 |
+
- edge-ai
|
| 12 |
+
- android
|
| 13 |
+
- gemma3
|
| 14 |
+
library_name: transformers
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
|
| 18 |
+
# FunctionGemma 270M - Mobile Actions (LiteRT-LM Ready)
|
| 19 |
|
| 20 |
+
A fine-tuned FunctionGemma 270M model optimized for on-device function calling on Android devices using [Google AI Edge Gallery](https://github.com/google-ai-edge/gallery) and LiteRT-LM runtime.
|
|
|
|
| 21 |
|
| 22 |
+
## π― Features
|
| 23 |
+
|
| 24 |
+
- β
**Ready-to-use**: Pre-converted `.litertlm` format for immediate deployment
|
| 25 |
+
- β
**On-device function calling**: Runs entirely on Android devices without internet
|
| 26 |
+
- β
**Optimized**: INT8 quantization (~271 MB) for efficient mobile deployment
|
| 27 |
+
- β
**Mobile Actions**: Supports 6 native Android functions
|
| 28 |
+
- β
**Low latency**: Optimized with extended KV cache (1024 tokens)
|
| 29 |
+
|
| 30 |
+
## π± Supported Mobile Actions
|
| 31 |
+
|
| 32 |
+
The model can execute the following Android functions via natural language:
|
| 33 |
+
|
| 34 |
+
| Function | Example Prompt |
|
| 35 |
+
|----------|---------------|
|
| 36 |
+
| **Flashlight** | "Turn on the flashlight" |
|
| 37 |
+
| **Contacts** | "Create a contact for John Doe with phone 555-1234" |
|
| 38 |
+
| **Email** | "Send email to john@example.com" |
|
| 39 |
+
| **Maps** | "Show Times Square on the map" |
|
| 40 |
+
| **WiFi** | "Turn off WiFi" |
|
| 41 |
+
| **Calendar** | "Create a calendar event for Team Meeting tomorrow at 2 PM" |
|
| 42 |
+
|
| 43 |
+
## π Quick Start
|
| 44 |
|
| 45 |
+
### Download the Model
|
| 46 |
|
| 47 |
+
```bash
|
| 48 |
+
wget https://huggingface.co/Yagna1/functiongemma-270m-mobile-actions/resolve/main/mobile-actions_q8_ekv1024.litertlm
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Or use Python:
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from huggingface_hub import hf_hub_download
|
| 55 |
+
|
| 56 |
+
model_path = hf_hub_download(
|
| 57 |
+
repo_id="Yagna1/functiongemma-270m-mobile-actions",
|
| 58 |
+
filename="mobile-actions_q8_ekv1024.litertlm"
|
| 59 |
+
)
|
| 60 |
+
print(f"Downloaded to: {model_path}")
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Use in Google AI Edge Gallery App
|
| 64 |
+
|
| 65 |
+
1. **Install** the [Google AI Edge Gallery](https://github.com/google-ai-edge/gallery) Android app
|
| 66 |
+
2. **Import** the `mobile-actions_q8_ekv1024.litertlm` file into the app
|
| 67 |
+
3. **Navigate** to "Mobile Actions" feature
|
| 68 |
+
4. **Test** with natural language prompts like:
|
| 69 |
- "Turn on flashlight"
|
| 70 |
+
- "Create contact John Smith"
|
| 71 |
+
- "Show Central Park on map"
|
| 72 |
|
| 73 |
+
## ποΈ Model Architecture
|
| 74 |
|
| 75 |
+
- **Base Model**: [google/functiongemma-270m-it](https://huggingface.co/google/functiongemma-270m-it)
|
| 76 |
+
- **Architecture**: Gemma 3 (270M parameters)
|
| 77 |
+
- **Quantization**: INT8 (Dynamic)
|
| 78 |
+
- **KV Cache**: Extended to 1024 tokens for longer conversations
|
| 79 |
+
- **Runtime**: LiteRT-LM (Google's on-device inference engine)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
## π Model Details
|
| 82 |
+
|
| 83 |
+
| Property | Value |
|
| 84 |
+
|----------|-------|
|
| 85 |
+
| Parameters | 270M |
|
| 86 |
+
| Quantization | INT8 |
|
| 87 |
+
| Model Size | 271 MB |
|
| 88 |
+
| Format | `.litertlm` (LiteRT-LM) |
|
| 89 |
+
| Context Length | 1024 tokens |
|
| 90 |
+
| Target Device | Android (ARM) |
|
| 91 |
+
|
| 92 |
+
## π§ Function Calling Format
|
| 93 |
+
|
| 94 |
+
The model uses LiteRT-LM's native function calling format:
|
| 95 |
+
|
| 96 |
+
```
|
| 97 |
+
<start_function_call>call:function_name{param1:value1,param2:value2}<end_function_call>
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
Example outputs:
|
| 101 |
+
|
| 102 |
+
**User**: "Turn on the flashlight"
|
| 103 |
+
**Model**: `<start_function_call>call:enableFlashlight{}<end_function_call>`
|
| 104 |
+
|
| 105 |
+
**User**: "Create contact John Doe with phone 555-1234"
|
| 106 |
+
**Model**: `<start_function_call>call:createContact{contactName:John Doe,phoneNumber:555-1234}<end_function_call>`
|
| 107 |
+
|
| 108 |
+
## π Training Details
|
| 109 |
+
|
| 110 |
+
This model was fine-tuned on synthetic Mobile Actions data designed to match LiteRT-LM's expected function calling format. The training focused on:
|
| 111 |
+
|
| 112 |
+
- Natural language β function call mapping
|
| 113 |
+
- Parameter extraction from user queries
|
| 114 |
+
- Handling edge cases and variations
|
| 115 |
+
- Multi-turn conversation support
|
| 116 |
+
|
| 117 |
+
## β οΈ Limitations
|
| 118 |
+
|
| 119 |
+
- Limited to 6 pre-defined Android functions
|
| 120 |
+
- English language only
|
| 121 |
+
- Requires Android device with ARMv8-A or newer
|
| 122 |
+
- May not handle complex multi-step actions
|
| 123 |
+
- Function parameters must match expected schema
|
| 124 |
+
|
| 125 |
+
## π€ Credits
|
| 126 |
+
|
| 127 |
+
**Original Model**: This is a mirror/re-upload of [JackJ1/functiongemma-270m-it-mobile-actions-litertlm](https://huggingface.co/JackJ1/functiongemma-270m-it-mobile-actions-litertlm)
|
| 128 |
+
|
| 129 |
+
**Thanks to**:
|
| 130 |
+
- **JackJ1** for the original fine-tuning work
|
| 131 |
+
- **Google** for FunctionGemma base model and LiteRT-LM runtime
|
| 132 |
+
- **Google AI Edge Team** for the Gallery app and tools
|
| 133 |
+
|
| 134 |
+
## π License
|
| 135 |
+
|
| 136 |
+
Apache 2.0 (same as base FunctionGemma model)
|
| 137 |
+
|
| 138 |
+
## π Resources
|
| 139 |
+
|
| 140 |
+
- [Google AI Edge Gallery GitHub](https://github.com/google-ai-edge/gallery)
|
| 141 |
+
- [FunctionGemma Documentation](https://ai.google.dev/gemma/docs/function_calling)
|
| 142 |
+
- [LiteRT-LM Runtime](https://github.com/google-ai-edge/LiteRT-LM)
|
| 143 |
+
- [Original Base Model](https://huggingface.co/google/functiongemma-270m-it)
|
| 144 |
+
|
| 145 |
+
## π Contact
|
| 146 |
+
|
| 147 |
+
For issues or questions about this model mirror, please open an issue on the [repository](https://huggingface.co/Yagna1/functiongemma-270m-mobile-actions/discussions).
|
| 148 |
+
|
| 149 |
+
---
|
| 150 |
|
| 151 |
+
**Note**: This model is specifically formatted for the Google AI Edge Gallery app and requires the LiteRT-LM runtime. For general-purpose inference, use the base model or convert to standard formats.
|
| 152 |
|
|
|