File size: 590 Bytes
cdb73a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import sys

from sentence_transformers import SentenceTransformer

# sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
# from src.book_recommender.core import config

MODEL_NAME = "all-MiniLM-L6-v2"

def download_model():
    """
    Downloads the sentence-transformer model specified in the config file.
    This is useful for pre-downloading the model in a Docker build.
    """
    print(f"Downloading model: {MODEL_NAME}...")
    _ = SentenceTransformer(MODEL_NAME)
    print("Model downloaded successfully.")


if __name__ == "__main__":
    download_model()