google/functiongemma-tuning-lab
86
1---2title: FunctionGemma Tuning Lab3short_description: How to fine-tune FunctionGemma for tool calling4emoji: ๐5colorFrom: gray6colorTo: indigo7sdk: gradio8sdk_version: 6.3.09app_file: app.py10pinned: false11hf_oauth: true12hf_oauth_scopes:13 - manage-repos14license: apache-2.015---16 17# FunctionGemma Tuning Lab18 19**FunctionGemma Tuning Lab** is a user-friendly, Gradio-based interface demo designed to help you fine-tune [FunctionGemma](https://huggingface.co/google/functiongemma-270m-it) model to understand and utilize your specific custom tools and functions.20 21Whether you are building an agent to query internal knowledge bases, control smart home devices, or interact with proprietary APIs, this lab streamlines the process of teaching the model your specific function schemas.22 23## 24 Features25 26- **Interactive Tool Definition:** Define your function schemas (JSON) directly in the UI.27- **Custom Dataset Import:** Upload your own training data via CSV.28- **One-Click Fine-Tuning:** Configure hyperparameters (Epochs, Learning Rate) and start training with a single click.29- **Real-Time Monitoring:** Watch training logs and loss curves update in real-time.30- **Automatic Evaluation:** The system automatically evaluates the model's performance before and after training to show improvement.31- **Export Artifacts:** Download your fine-tuned model weights ready for deployment.32 33## 34 Installation35 361. **Clone the repository:**37 ```bash38 hf download google/functiongemma-tuning-lab --repo-type=space --local-dir=functiongemma-tuning-lab39 cd functiongemma-tuning-lab40 ```41 422. **Install dependencies:**43 It is recommended to use a virtual environment.44 ```bash45 pip install -r requirements.txt46 ```47 48## 49 Usage50 511. **Set up Environment Variables (Optional):**52 If you need to access gated models on Hugging Face, set your token:53 ```bash54 export HF_TOKEN=your_huggingface_token55 ```56 572. **Run the Application:**58 ```bash59 python app.py60 ```61 623. **Access the UI:**63 Open your browser and navigate to the local URL provided in the terminal (usually `http://127.0.0.1:7860`).64 65## 66 Data Format67 68To train on your own data, upload a CSV file with the following columns (no header required, or header ignored if present):69 701. **User Prompt:** The natural language query from the user.712. **Tool Name:** The name of the function that should be called.723. **Tool Arguments:** A JSON string representing the arguments for the function.73 74**Example CSV Row:**75```csv76"What is the weather in London?", "get_weather", "{""location"": ""London, UK""}"77```78 79## 80 Configuration81 82Core settings can be modified in `config.py`:83- `MODEL_NAME`: Base model to fine-tune (default: `google/functiongemma-270m-it`).84- `DEFAULT_DATASET`: Hugging Face dataset to use if no custom CSV is uploaded.85- `ARTIFACTS_DIR`: Directory where training outputs are saved.86 87 