File size: 645 Bytes
abd4352
 
 
 
 
 
 
 
 
 
 
612eafc
 
abd4352
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sys
import os

# Add project root to path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

def download():
    print("⏳ Pre-downloading embedding model for production...")
    try:
        from sentence_transformers import SentenceTransformer
        # This will download the model to the default cache directory (e.g. ~/.cache/huggingface)
        model = SentenceTransformer('all-MiniLM-L6-v2')
        print(f"✅ Model 'all-MiniLM-L6-v2' successfully cached.")
    except Exception as e:
        print(f"❌ Failed to download model: {e}")
        sys.exit(1)

if __name__ == "__main__":
    download()