# ⚡ Quick Setup Checklist (10 min) Complete these steps on your laptop to prepare for your Spaces demo. ## Step 1: Download Models Locally (**~5 min**) ```bash cd /Users/shouryaangrish/Documents/Work/HugginFaceInfy/infy python3 scripts/download_lightweight_models.py ``` **What it does:** - Downloads DistilBERT sentiment model (~260 MB) - Downloads BERT tokenizer (~440 MB) - Saves to `models/` directory - **Takes ~5 minutes depending on your internet** **What to expect:** ``` Downloading sentiment model... ✓ Saved to models/sentiment/ ✓ Model: 260 MB ✓ Tokenizer: 5 MB Total: ~265 MB Downloading tokenizer... ✓ Saved to models/tokenizer/ ✓ Model: 440 MB ✓ Tokenizer: 3 MB Total: ~443 MB All models ready! ✅ ``` --- ## Step 2: Test Locally (**~2 min**) ```bash python3 app.py ``` - App opens at `http://localhost:7860` - Click **"Analyze Sentiment"** button - ✅ Should be **instant** (models load from disk, not downloading) - Try another demo if you want - Press `Ctrl+C` to stop --- ## Step 3: Commit Models to Git (**~2 min**) ```bash git add .gitignore models/ git commit -m "Add pre-cached models for offline demo" git push origin main ``` **What happens:** - Git LFS automatically handles large files (`.bin`, `.safetensors` tracked in `.gitattributes`) - Only pointers stored in normal git, actual files in LFS - Spaces auto-pulls everything on next deploy - ✅ Models available even without network **Expected output:** ``` [main abc1234] Add pre-cached models for offline demo 2 files changed, 50 insertions(+) create mode .gitignore create mode models/sentiment/... create mode models/tokenizer/... ``` --- ## Step 4: Verify Spaces Updated (**~1 min**) 1. Go to your Spaces URL (check Spaces dashboard) 2. Wait for rebuild (usually 1-2 min) 3. Click **"Analyze Sentiment"** 4. ✅ Should work instantly (models from local storage) --- ## Result: Fully Offline Demo ✅ Now your setup: - ✅ Models available **without any network calls** - ✅ Demos are **instant** (no download wait) - ✅ Works even if HF is down - ✅ Attendees clone repo and have models immediately - ✅ Perfect for company network restrictions --- ## File Sizes Reference | File | Size | |------|------| | DistilBERT model | 260 MB | | BERT tokenizer | 440 MB | | Config files | ~10 MB | | **Total size** | **~710 MB** | | Git repo (with LFS) | ~1 MB (pointers) + LFS storage | The actual large files stay in Git LFS, keeping your repo fast for cloning. --- ## Troubleshooting ### Q: Download taking too long? **A:** This is normal (5-10 min on typical internet). Models are large. Go grab coffee ☕ ### Q: "Permission denied" on scripts? **A:** Run: ```bash chmod +x scripts/download_lightweight_models.py python3 scripts/download_lightweight_models.py ``` ### Q: Models directory doesn't exist after download? **A:** Check for errors in output. Run again: ```bash python3 scripts/download_lightweight_models.py ``` ### Q: Git push fails with "too large"? **A:** Git LFS handles this automatically. Just: ```bash git push origin main --force-with-lease ``` ### Q: Models still download during demo? **A:** Models didn't transfer to Spaces. Check: ```bash ls -la models/sentimen*/ ls -la models/tokenizer/ ``` Should show `.bin` files. If empty, re-run Step 1. --- ## Timeline for Your Session | When | Action | Time | |------|--------|------| | **Day before** | Run Steps 1-4 on laptop | 10 min | | **30 min before session** | Verify Spaces is ready (load app once) | 1 min | | **During session** | Run demo (instant loading guaranteed) | ✅ Works! | | **After session** | Attendees can clone repo + models included | Automatic | --- ## You're Ready! 🚀 Once you complete Step 4, your demo is set up perfectly: - No network dependencies ✅ - Instant model loading ✅ - Reproducible for attendees ✅ - Spaces auto-deploys everything ✅ **Questions?** Check [USING_LOCAL_MODELS.md](./USING_LOCAL_MODELS.md) for full details. --- ## One-Liner (If you want to do it all at once) ```bash cd /Users/shouryaangrish/Documents/Work/HugginFaceInfy/infy && python3 scripts/download_lightweight_models.py && git add .gitignore models/ && git commit -m "Add pre-cached models" && git push origin main && echo "✅ All done! Check Spaces in ~2 min" ``` Done! ✨