fmnxl commited on
Commit
b17c7af
·
verified ·
1 Parent(s): 418a934

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -0
Dockerfile ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # Install build tools for torch.compile
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential \
6
+ && rm -rf /var/lib/apt/lists/*
7
+
8
+ # Create a non-root user with home directory for cache
9
+ RUN useradd -m -u 1000 user
10
+ USER user
11
+
12
+ WORKDIR /home/user/app
13
+
14
+ # Set cache directory to user's home
15
+ ENV HOME=/home/user
16
+ ENV HF_HOME=/home/user/.cache/huggingface
17
+ ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface/transformers
18
+ ENV HF_DATASETS_CACHE=/home/user/.cache/huggingface/datasets
19
+
20
+ # Install dependencies as user (use --user flag)
21
+ RUN pip install --user --no-cache-dir \
22
+ torch \
23
+ transformers>=4.48.0 \
24
+ datasets \
25
+ evaluate \
26
+ seqeval \
27
+ accelerate>=1.0.0 \
28
+ huggingface_hub
29
+
30
+ # Add user's pip bin to PATH
31
+ ENV PATH="/home/user/.local/bin:${PATH}"
32
+
33
+ # Copy training script and data
34
+ COPY --chown=user:user train.py .
35
+ COPY --chown=user:user data/ ./data/
36
+
37
+ # Run training
38
+ CMD ["python", "train.py"]