Spaces:
Sleeping
Offline Mode Setup Guide
Problem
The application fails to start with network connectivity errors when trying to download the sentence transformer model from Hugging Face.
Error Message
Failed to resolve 'huggingface.co' ([Errno 11001] getaddrinfo failed)
Solutions
Option 1: Download Model When You Have Internet Access
When you have internet access, run the download script:
cd backend python download_model.py
This will download and cache the model locally for offline use.
Option 2: Manual Download
If you have internet access on another machine:
On a machine with internet access, run:
from sentence_transformers import SentenceTransformer model = SentenceTransformer('all-MiniLM-L6-v2')
Copy the cached model from:
- Windows:
C:\Users\{username}\.cache\huggingface\transformers\
- Linux/Mac:
~/.cache/huggingface/transformers/
- Windows:
Place it in the same location on your offline machine.
Option 3: Force Offline Mode
If you believe the model is already cached, you can force offline mode by setting environment variables:
set TRANSFORMERS_OFFLINE=1
set HF_HUB_OFFLINE=1
python backend_api.py
Option 4: Network Troubleshooting
If you should have internet access:
- Check your internet connection
- If behind a corporate firewall, ensure
huggingface.co
is accessible - Try accessing
https://huggingface.co
in your browser - Contact your IT department if needed
Verification
After setting up offline mode, you can verify the model is working by running:
python download_model.py
This will check if the model is cached and available for offline use.
Technical Details
The sentence transformer model "all-MiniLM-L6-v2" is approximately 80MB and is used for generating embeddings from text for the vector search functionality.
The application has been modified to:
- Try loading the model normally first
- Fall back to offline mode if network fails
- Provide clear error messages with solutions