A production-ready, no-code web application for fine-tuning Google Gemma models using LoRA, powered by Unsloth for fast and memory-efficient training.
- π¨ No-Code Interface - User-friendly Gradio UI for non-technical users
- π Multi-Format Dataset Support - Upload CSV, JSON, TXT files
- π Auto Dataset Validation - Intelligent preprocessing and conversion
- β‘ Unsloth-Powered Training - 2x faster training with 60% less memory
- π― LoRA Fine-Tuning - Efficient parameter-efficient fine-tuning
- π Real-Time Progress - Live training metrics and progress tracking
- πΎ Model Export - Download LoRA adapters or merged models
- π Secure Backend - FastAPI with production-grade security
- π³ Docker + GPU Ready - Containerized deployment with NVIDIA GPU support
- π¦ Single GPU Optimized - Runs on consumer-grade GPUs (RTX 3060+)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Gradio Frontend (UI) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Dataset β β Training β β Model β β
β β Upload β β Progress β β Export β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTP/WebSocket
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend (API) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Dataset β β Training β β Model β β
β β Processing β β Manager β β Manager β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Unsloth Training Engine (GPU) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Gemma β β LoRA β β Optimizer β β
β β Model β β Adapters β β (4-bit) β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.10+
- NVIDIA GPU with 8GB+ VRAM (RTX 3060 or better)
- CUDA 11.8+ or 12.1+
- 16GB+ System RAM
- Docker (optional, for containerized deployment)
# Clone the repository
git clone https://github.com/skarthi369/GEMMA-NO-CODE-Gemma-LoRA-Fine-Tuner.git
cd GEMMA-NO-CODE-Gemma-LoRA-Fine-Tuner
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Edit .env with your Hugging Face token
# Run the application
python working_frontend.py# Build and run with GPU support
docker-compose up --build
# Access the application at http://localhost:7860- Upload Dataset - Drag and drop your CSV, JSON, or TXT file
- Configure Training - Set epochs, batch size, learning rate
- Start Training - Monitor real-time progress and metrics
- Export Model - Download LoRA adapters or merged model
instruction,input,output
"Translate to French","Hello","Bonjour"
"Summarize","Long text...","Summary..."[
{
"instruction": "Translate to French",
"input": "Hello",
"output": "Bonjour"
}
]### Instruction: Translate to French
### Input: Hello
### Output: Bonjour
### Instruction: Summarize
### Input: Long text...
### Output: Summary...
Key environment variables in .env:
# Hugging Face
HF_TOKEN=your_huggingface_token_here
# Model Settings
MODEL_NAME=unsloth/gemma-2-2b-it-bnb-4bit
MAX_SEQ_LENGTH=2048
# Training Defaults
DEFAULT_EPOCHS=3
DEFAULT_BATCH_SIZE=2
DEFAULT_LEARNING_RATE=2e-4
# Server
BACKEND_PORT=8000
FRONTEND_PORT=7860| Metric | Standard | Unsloth Optimized |
|---|---|---|
| Training Speed | 1x | 2x faster |
| Memory Usage | 100% | 40% (60% reduction) |
| Min GPU VRAM | 24GB | 8GB |
| Batch Size (8GB) | 1 | 4 |
- Backend: FastAPI, Uvicorn
- Frontend: Gradio
- ML Framework: PyTorch, Transformers, Unsloth
- Model: Google Gemma 2B/7B
- Fine-Tuning: LoRA (Low-Rank Adaptation)
- Optimization: 4-bit quantization, Flash Attention 2
- Containerization: Docker, Docker Compose
.
βββ backend/ # FastAPI backend modules
βββ frontend/ # Gradio UI components
βββ datasets/ # Training datasets
βββ models/ # Downloaded and fine-tuned models
βββ exports/ # Exported LoRA adapters
βββ logs/ # Training logs
βββ simple_backend.py # Main backend server
βββ working_frontend.py # Main frontend application
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Docker Compose setup
βββ .env.example # Environment template
Fine-tune any Gemma variant:
gemma-2-2b-it(Consumer GPUs)gemma-2-7b-it(Professional GPUs)gemma-2-9b-it(High-end GPUs)
lora_config = {
"r": 16, # LoRA rank
"lora_alpha": 16, # LoRA alpha
"lora_dropout": 0, # Dropout
"target_modules": ["q_proj", "k_proj", "v_proj", "o_proj"]
}- Environment-based configuration
- No hardcoded credentials
- Rate limiting on API endpoints
- Input validation and sanitization
- Secure file upload handling
# Reduce batch size in .env
DEFAULT_BATCH_SIZE=1
# Use gradient checkpointing
USE_GRADIENT_CHECKPOINTING=true# Enable Flash Attention 2
USE_FLASH_ATTENTION=true
# Increase batch size if memory allows
DEFAULT_BATCH_SIZE=4MIT License - See LICENSE file for details
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Author: Karthikeyan S
- GitHub: @skarthi369
- Repository: GEMMA-NO-CODE-Gemma-LoRA-Fine-Tuner
- Google for Gemma models
- Unsloth for optimization framework
- Hugging Face for model hosting
- FastAPI and Gradio communities
β Star this repository if you find it useful!