Vish-AI / QUICKSTART.md
Vishwas896's picture
train itself
b4fa832 verified
|
Raw
History Blame Contribute Delete
4.56 kB
# πŸš€ VISH AI - Quick Start Guide
## Installation & Setup (5 minutes)
### Step 1: Install Dependencies
```bash
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
```bash
python start.py
```
**Or manually:**
```bash
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:**
```bash
export VISH_ADMIN_KEY="your-secret-key"
```
Or in `.env` file:
```
VISH_ADMIN_KEY=your-secret-key
```
---
## πŸ“Š Understanding the System
### Data Flow
1. **User chats** β†’ Saved to `data/vish_dataset.jsonl`
2. **User rates** β†’ Saved to `data/feedback.jsonl`
3. **Training runs** β†’ Creates `models/vish-ai-mini/latest/`
4. **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_143022`
- `v20241017_095234`
- Latest version is used automatically
---
## πŸš€ Deployment
### Hugging Face Spaces
1. Create Space: https://huggingface.co/new-space
2. Upload files:
- `app/` folder
- `requirements.txt`
- `Dockerfile`
- `README.md`
3. Set hardware: CPU Basic (free) or T4 GPU
4. Wait for build (~15-20 minutes first time)
5. Done! Your AI is live
### Docker
```bash
# 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
1. **Start with general questions** to build dataset
2. **Rate honestly** - only good data improves the model
3. **Train regularly** - weekly is good
4. **Check stats** - monitor improvement
5. **Backup data** - copy `/data` and `/models` regularly
---
## πŸ› 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
1. **Explore API**: Visit `http://localhost:7860/docs`
2. **Read Full README**: See `README_SELF_TRAINING.md`
3. **Customize**: Edit system prompts in `gradio_ui.py`
4. **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!