Spaces:
Sleeping
Sleeping
File size: 4,560 Bytes
b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 c91ee90 b4fa832 | 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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | # π 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!
|