File size: 3,309 Bytes
b619545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
title: Gemma Fine-tuning UI
emoji: πŸ€–
colorFrom: blue
colorTo: indigo
sdk: streamlit
sdk_version: 1.30.0
app_file: app.py
pinned: false
---

# Gemma Fine-tuning UI

A web-based user interface for fine-tuning Google's Gemma models using Hugging Face infrastructure.

![Gemma Banner](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/gemma-banner.png)

## Features

- **Dataset Upload**: Upload and preprocess your custom training data in CSV, JSON, or JSONL format
- **Model Configuration**: Configure Gemma model version and hyperparameters
- **Training Management**: Start, monitor, and manage fine-tuning jobs
- **Evaluation**: Test your fine-tuned model with interactive generation
- **Export Options**: Use your model directly from Hugging Face or export in various formats

## Installation

1. Clone this repository:
```bash
git clone https://github.com/yourusername/gemma-finetuning-ui.git
cd gemma-finetuning-ui
```

2. Create a virtual environment and install dependencies:
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```

3. Run the application:
```bash
streamlit run app.py
```

## Usage

1. **Authentication**: Provide your Hugging Face API token with write permissions
2. **Dataset Preparation**: Upload your dataset and configure column mappings
3. **Model Selection**: Choose between Gemma 2B or 7B and customize training parameters
4. **Training**: Start the fine-tuning process and monitor progress
5. **Evaluation**: Test your fine-tuned model with custom prompts
6. **Deployment**: Export or directly use your model from Hugging Face

## Hugging Face Spaces Deployment

This application is designed to be deployed easily on Hugging Face Spaces:

1. Create a new Space on [Hugging Face Spaces](https://huggingface.co/spaces)
2. Select Streamlit as the SDK
3. Connect your GitHub repository or upload the files directly
4. The Space will automatically detect and install the requirements

## Requirements

- Python 3.8+
- Streamlit 1.30.0+
- Hugging Face Account with API token
- For training: GPU access (recommended)

## Project Structure

```
.
β”œβ”€β”€ app.py              # Main Streamlit application
β”œβ”€β”€ pages/              # Multi-page app components
β”‚   β”œβ”€β”€ 01_Dataset_Upload.py
β”‚   β”œβ”€β”€ 02_Model_Configuration.py
β”‚   β”œβ”€β”€ 03_Training_Monitor.py
β”‚   └── 04_Evaluation.py
β”œβ”€β”€ utils/              # Utility functions
β”‚   β”œβ”€β”€ auth.py         # Authentication utilities
β”‚   β”œβ”€β”€ huggingface.py  # Hugging Face API integration
β”‚   β”œβ”€β”€ training.py     # Training utilities
β”‚   └── ui.py           # UI components and styling
β”œβ”€β”€ data/               # Sample data and uploads
└── requirements.txt    # Project dependencies
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Acknowledgements

- [Google Gemma Models](https://huggingface.co/google/gemma-7b)
- [Hugging Face Transformers](https://huggingface.co/docs/transformers/index)
- [Streamlit](https://streamlit.io/)
- [PEFT - Parameter-Efficient Fine-Tuning](https://github.com/huggingface/peft)

---

Developed as a simplified interface for fine-tuning Gemma models with Hugging Face.