File size: 932 Bytes
be3e455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25f063d
be3e455
 
 
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
"""Pre-download models during Docker build to avoid cold-start penalty.

Called by the Dockerfile builder stage. This is separate from the main app
so it can be run once at build time and the downloaded caches get copied
into the final image.
"""

import logging

logging.basicConfig(level=logging.INFO)

# Trigger Docling model download
print("Pre-downloading Docling models...")
from src.core.converter import MarkdownConverterService  # noqa: E402

MarkdownConverterService()
print("Docling models cached.")

# Trigger FlashRank model download
print("Pre-downloading FlashRank model...")
from src.retrieval.reranker import Reranker  # noqa: E402

Reranker()
print("FlashRank model cached.")

# Trigger FastEmbed BM25 tokenizer download
print("Pre-downloading FastEmbed BM25 tokenizer...")
from fastembed import SparseTextEmbedding  # noqa: E402

SparseTextEmbedding(model_name="Qdrant/bm25")
print("FastEmbed tokenizer cached.")