Peter Larnholt commited on
Commit
cd11dff
·
1 Parent(s): 972cd35

Fix HuggingFace cache directory permissions

Browse files

Set HF_HOME, TRANSFORMERS_CACHE, and HF_HUB_CACHE to writable /tmp directory to avoid permission errors

Files changed (1) hide show
  1. Dockerfile +7 -1
Dockerfile CHANGED
@@ -3,11 +3,17 @@ FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  PYTHONUNBUFFERED=1 \
5
  PIP_NO_CACHE_DIR=1 \
6
- HF_HUB_ENABLE_HF_TRANSFER=1
 
 
 
7
 
8
  RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/*
9
  WORKDIR /app
10
 
 
 
 
11
  COPY requirements.txt /app/
12
  RUN python3 -m pip install --upgrade pip && pip3 install -r requirements.txt
13
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  PYTHONUNBUFFERED=1 \
5
  PIP_NO_CACHE_DIR=1 \
6
+ HF_HUB_ENABLE_HF_TRANSFER=1 \
7
+ HF_HOME=/tmp/huggingface \
8
+ TRANSFORMERS_CACHE=/tmp/huggingface/transformers \
9
+ HF_HUB_CACHE=/tmp/huggingface/hub
10
 
11
  RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/*
12
  WORKDIR /app
13
 
14
+ # Create writable cache directories for HuggingFace
15
+ RUN mkdir -p /tmp/huggingface && chmod -R 777 /tmp/huggingface
16
+
17
  COPY requirements.txt /app/
18
  RUN python3 -m pip install --upgrade pip && pip3 install -r requirements.txt
19