YashashMathur commited on
Commit
78b3453
·
verified ·
1 Parent(s): 3de1854

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -15
Dockerfile CHANGED
@@ -1,22 +1,31 @@
1
- FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
4
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
5
 
6
  WORKDIR /app
7
 
8
- # Install Unsloth and training dependencies
9
- RUN pip install --no-cache-dir \
10
- "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" \
11
- && pip install --no-cache-dir --no-deps xformers \
12
- && pip install --no-cache-dir \
13
- trl peft accelerate bitsandbytes huggingface_hub safetensors
 
 
 
 
 
 
 
 
 
 
14
 
15
- # Copy training script and dataset
16
- COPY train.py .
17
- COPY aegis_training_data_500.json .
 
 
18
 
19
  EXPOSE 7860
20
 
21
- # -u for unbuffered stdout so logs appear in real time in HF Space console
22
- CMD ["python", "-u", "train.py"]
 
1
+ FROM huggingface/transformers-pytorch-gpu:4.46.3
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # System dependencies
6
+ RUN apt-get update && apt-get install -y git build-essential && rm -rf /var/lib/apt/lists/*
7
+
8
+ # Add HuggingFace unprivileged user bounds
9
+ RUN useradd -m -u 1000 user
10
+ USER user
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH \
13
+ PYTHONUNBUFFERED=1 \
14
+ FORCE_CUDA="1"
15
+
16
+ WORKDIR $HOME/app
17
+
18
+ # Dependencies
19
+ COPY --chown=user:user requirements.txt .
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Secure Application Code
23
+ COPY --chown=user:user aegis_env aegis_env/
24
+ COPY --chown=user:user hf_training hf_training/
25
+ COPY --chown=user:user scripts scripts/
26
+ COPY --chown=user:user aegis_training_data_500.json .
27
 
28
  EXPOSE 7860
29
 
30
+ # Run training entry point
31
+ CMD ["python3", "hf_training/train.py"]