“gobin.bastola” commited on
Commit
12ec497
·
1 Parent(s): 54f8ddb

Pre-download SigLIP model and configure cache paths

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -0
Dockerfile CHANGED
@@ -5,6 +5,22 @@ WORKDIR /app
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  COPY . .
9
 
10
  ENV IMAGE_EMBEDDINGS_PATH=/app/embeddings/image_embeddings.parquet
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
+ # Configure Hugging Face cache directories with write access
9
+ ENV HF_HOME=/app/hf_cache \
10
+ TRANSFORMERS_CACHE=/app/hf_cache \
11
+ HF_DATASETS_CACHE=/app/hf_cache
12
+ RUN mkdir -p /app/hf_cache
13
+
14
+ # Pre-download SigLIP model weights and processor during build
15
+ RUN python - <<'PY'
16
+ from transformers import AutoModel, AutoProcessor
17
+ model = "google/siglip2-base-patch16-384"
18
+ print("Downloading", model)
19
+ AutoProcessor.from_pretrained(model)
20
+ AutoModel.from_pretrained(model)
21
+ print("Model assets cached")
22
+ PY
23
+
24
  COPY . .
25
 
26
  ENV IMAGE_EMBEDDINGS_PATH=/app/embeddings/image_embeddings.parquet