Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: FunctionGemma
|
| 3 |
emoji: π
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: indigo
|
|
@@ -13,11 +13,11 @@ hf_oauth_scopes:
|
|
| 13 |
license: apache-2.0
|
| 14 |
---
|
| 15 |
|
| 16 |
-
# FunctionGemma
|
| 17 |
|
| 18 |
-
**FunctionGemma
|
| 19 |
|
| 20 |
-
Whether you are building an agent to query internal knowledge bases, control smart home devices, or interact with proprietary APIs, this
|
| 21 |
|
| 22 |
##
|
| 23 |
Features
|
|
@@ -34,8 +34,8 @@ Whether you are building an agent to query internal knowledge bases, control sma
|
|
| 34 |
|
| 35 |
1. **Clone the repository:**
|
| 36 |
```bash
|
| 37 |
-
hf download google/functiongemma-
|
| 38 |
-
cd functiongemma-
|
| 39 |
```
|
| 40 |
|
| 41 |
2. **Install dependencies:**
|
|
|
|
| 1 |
---
|
| 2 |
+
title: FunctionGemma Tuning Lab
|
| 3 |
emoji: π
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: indigo
|
|
|
|
| 13 |
license: apache-2.0
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# FunctionGemma Tuning Lab
|
| 17 |
|
| 18 |
+
**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.
|
| 19 |
|
| 20 |
+
Whether 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.
|
| 21 |
|
| 22 |
##
|
| 23 |
Features
|
|
|
|
| 34 |
|
| 35 |
1. **Clone the repository:**
|
| 36 |
```bash
|
| 37 |
+
hf download google/functiongemma-tuninglab --repo-type=space --local-dir=functiongemma-tuninglab
|
| 38 |
+
cd functiongemma-tuninglab
|
| 39 |
```
|
| 40 |
|
| 41 |
2. **Install dependencies:**
|
config.py
CHANGED
|
@@ -10,7 +10,7 @@ class AppConfig:
|
|
| 10 |
"""
|
| 11 |
# Directory Setup
|
| 12 |
ARTIFACTS_DIR: Final[Path] = Path("artifacts")
|
| 13 |
-
OUTPUT_DIR: Final[Path] = ARTIFACTS_DIR.joinpath("functiongemma-
|
| 14 |
|
| 15 |
# Model & Data
|
| 16 |
HF_TOKEN: Final[Optional[str]] = os.getenv('HF_TOKEN')
|
|
|
|
| 10 |
"""
|
| 11 |
# Directory Setup
|
| 12 |
ARTIFACTS_DIR: Final[Path] = Path("artifacts")
|
| 13 |
+
OUTPUT_DIR: Final[Path] = ARTIFACTS_DIR.joinpath("functiongemma-tuninglab-demo")
|
| 14 |
|
| 15 |
# Model & Data
|
| 16 |
HF_TOKEN: Final[Optional[str]] = os.getenv('HF_TOKEN')
|
engine.py
CHANGED
|
@@ -403,7 +403,7 @@ class FunctionGemmaEngine:
|
|
| 403 |
token=oauth_token
|
| 404 |
)
|
| 405 |
tags = info.card_data.tags
|
| 406 |
-
tags.append("functiongemma-
|
| 407 |
metadata_update(repo_id, {"tags": tags}, overwrite=True, token=oauth_token)
|
| 408 |
|
| 409 |
return f"β
Success! Model uploaded to: {repo_url}"
|
|
|
|
| 403 |
token=oauth_token
|
| 404 |
)
|
| 405 |
tags = info.card_data.tags
|
| 406 |
+
tags.append("functiongemma-tuninglab")
|
| 407 |
metadata_update(repo_id, {"tags": tags}, overwrite=True, token=oauth_token)
|
| 408 |
|
| 409 |
return f"β
Success! Model uploaded to: {repo_url}"
|
ui.py
CHANGED
|
@@ -100,9 +100,9 @@ class UIController:
|
|
| 100 |
|
| 101 |
def _render_header():
|
| 102 |
with gr.Column():
|
| 103 |
-
gr.Markdown("# π€ FunctionGemma
|
| 104 |
gr.Markdown("Fine-tune FunctionGemma to understand your custom functions.<br>"
|
| 105 |
-
"See [README](https://huggingface.co/spaces/google/functiongemma-
|
| 106 |
gr.Markdown("(Optional) Sign in to Hugging Face if you plan to push your fine-tuned model to the Hub later (3. Export).")
|
| 107 |
with gr.Row():
|
| 108 |
gr.LoginButton(value="Sign in with Hugging Face")
|
|
@@ -180,7 +180,7 @@ def _render_export_tab(engine_state, username_state):
|
|
| 180 |
gr.Markdown("#### Option B: Save to Hugging Face Hub")
|
| 181 |
gr.Markdown("Publish your fine-tuned model to your personal Hugging Face account.")
|
| 182 |
repo_name_input = gr.Textbox(
|
| 183 |
-
label="Target Repository Name", value="functiongemma-270m-it-
|
| 184 |
)
|
| 185 |
push_to_hub_btn = gr.Button("Save to Hugging Face Hub", variant="secondary", interactive=False)
|
| 186 |
repo_id_preview = gr.Markdown("Target Repository: (Waiting for input...)")
|
|
@@ -194,7 +194,7 @@ def _render_export_tab(engine_state, username_state):
|
|
| 194 |
# --- Main Build Function ---
|
| 195 |
|
| 196 |
def build_interface() -> gr.Blocks:
|
| 197 |
-
with gr.Blocks(title="FunctionGemma
|
| 198 |
engine_state = gr.State()
|
| 199 |
username_state = gr.State()
|
| 200 |
|
|
|
|
| 100 |
|
| 101 |
def _render_header():
|
| 102 |
with gr.Column():
|
| 103 |
+
gr.Markdown("# π€ FunctionGemma Tuning Lab: Fine-Tuning")
|
| 104 |
gr.Markdown("Fine-tune FunctionGemma to understand your custom functions.<br>"
|
| 105 |
+
"See [README](https://huggingface.co/spaces/google/functiongemma-tuninglab/blob/main/README.md) for more details.")
|
| 106 |
gr.Markdown("(Optional) Sign in to Hugging Face if you plan to push your fine-tuned model to the Hub later (3. Export).")
|
| 107 |
with gr.Row():
|
| 108 |
gr.LoginButton(value="Sign in with Hugging Face")
|
|
|
|
| 180 |
gr.Markdown("#### Option B: Save to Hugging Face Hub")
|
| 181 |
gr.Markdown("Publish your fine-tuned model to your personal Hugging Face account.")
|
| 182 |
repo_name_input = gr.Textbox(
|
| 183 |
+
label="Target Repository Name", value="functiongemma-270m-it-tuninglab", placeholder="e.g., functiongemma-270m-it-tuned", interactive=False
|
| 184 |
)
|
| 185 |
push_to_hub_btn = gr.Button("Save to Hugging Face Hub", variant="secondary", interactive=False)
|
| 186 |
repo_id_preview = gr.Markdown("Target Repository: (Waiting for input...)")
|
|
|
|
| 194 |
# --- Main Build Function ---
|
| 195 |
|
| 196 |
def build_interface() -> gr.Blocks:
|
| 197 |
+
with gr.Blocks(title="FunctionGemma Tuning Lab") as demo:
|
| 198 |
engine_state = gr.State()
|
| 199 |
username_state = gr.State()
|
| 200 |
|