Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.24.0
π VISH AI - Quick Start Guide
Installation & Setup (5 minutes)
Step 1: Install Dependencies
pip install -r requirements.txt
What gets installed:
- Gradio (UI)
- FastAPI (API)
- Transformers (Phi-3)
- PEFT (LoRA training)
- Datasets (data handling)
Step 2: Start the Server
python start.py
Or manually:
python -m app.main
Step 3: Open Browser
Visit: http://localhost:7860
π― First Steps
1. Try the Chat
- Go to "π¬ VISH Assistant" tab
- Type: "Tell me about artificial intelligence"
- Click Send
- Notice the interaction ID in the response
2. Submit Feedback
- Copy the interaction ID (e.g.,
a1b2c3d4) - Go to "β Feedback" tab
- Paste the ID
- Rate 1-5 stars
- Click "Submit Feedback"
3. Check Statistics
- Go to "π Statistics" tab
- Click "π Refresh Stats"
- See your interactions and ratings
4. Train the Model (After 10+ interactions)
- Go to "π Training (Admin)" tab
- Set minimum samples: 10
- Set epochs: 3
- Enter admin key:
vish-admin-2024(default) - Click "π Start Training"
- Wait 10-30 minutes for training
π Category Examples
General Assistant
Category: assistant
Question: "What is machine learning?"
Resume Builder
Category: resume
Question: "Help me write a software engineer resume"
Research
Category: research
Question: "Explain quantum computing"
Business
Category: business
Question: "How do I create a business plan?"
π Admin Key
Default admin key: vish-admin-2024
Change it:
export VISH_ADMIN_KEY="your-secret-key"
Or in .env file:
VISH_ADMIN_KEY=your-secret-key
π Understanding the System
Data Flow
- User chats β Saved to
data/vish_dataset.jsonl - User rates β Saved to
data/feedback.jsonl - Training runs β Creates
models/vish-ai-mini/latest/ - Model reloads β Uses improved version automatically
File Structure
data/
βββ vish_dataset.jsonl # All interactions
βββ feedback.jsonl # User ratings
βββ research_data.jsonl # Research data
models/
βββ vish-ai-mini/
βββ latest/ # LoRA adapters
βββ metadata.json # Version info
π Training Process
When to Train
- After collecting 10+ interactions
- After significant feedback
- Weekly/monthly for continuous improvement
Training Time
- CPU: 10-30 minutes
- GPU: 2-5 minutes
What Gets Trained
- High-quality interactions (rating β₯ 3)
- Deduplicated data
- LoRA adapters only (efficient!)
Model Versions
Each training creates a version:
v20241016_143022v20241017_095234- Latest version is used automatically
π Deployment
Hugging Face Spaces
- Create Space: https://huggingface.co/new-space
- Upload files:
app/folderrequirements.txtDockerfileREADME.md
- Set hardware: CPU Basic (free) or T4 GPU
- Wait for build (~15-20 minutes first time)
- Done! Your AI is live
Docker
# Build
docker build -t vish-ai .
# Run
docker run -p 7860:7860 \
-v $(pwd)/data:/app/data \
-v $(pwd)/models:/app/models \
-e VISH_ADMIN_KEY=your-key \
vish-ai
β‘ Quick Tips
- Start with general questions to build dataset
- Rate honestly - only good data improves the model
- Train regularly - weekly is good
- Check stats - monitor improvement
- Backup data - copy
/dataand/modelsregularly
π Common Issues
"Model not loaded"
- Wait for initial download (~7GB, 10-15 min)
- Check logs for errors
- Verify internet connection
"Insufficient data for training"
- Need at least 10 interactions
- Check:
curl http://localhost:7860/api/stats
"Out of memory"
- Use quantization (edit
model_handler.py) - Reduce batch size in
retrain.py - Upgrade to GPU
π Next Steps
- Explore API: Visit
http://localhost:7860/docs - Read Full README: See
README_SELF_TRAINING.md - Customize: Edit system prompts in
gradio_ui.py - Integrate: Use API endpoints in your apps
π Success!
You now have a self-improving AI assistant that:
- β Learns from your conversations
- β Improves with your feedback
- β Trains automatically with LoRA
- β Tracks performance over time
- β Works on free-tier hardware
Happy chatting! π€
Built with β€οΈ by Vishwas | Questions? Open an issue!