YashashMathur commited on
Commit
319ef7e
·
verified ·
1 Parent(s): e945ec1

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -42
Dockerfile CHANGED
@@ -1,42 +1,36 @@
1
- FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
4
- ENV PYTHONUNBUFFERED=1
5
-
6
- # Install system essentials
7
- RUN apt-get update && apt-get install -y \
8
- python3.10 \
9
- python3-pip \
10
- python3-dev \
11
- git \
12
- build-essential \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Set up Hugging Face user (u:1000)
16
- RUN useradd -m -u 1000 user
17
- USER user
18
- ENV PATH="/home/user/.local/bin:${PATH}"
19
-
20
- WORKDIR /app
21
-
22
- # Sync PyTorch
23
- RUN pip install --no-cache-dir torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
24
-
25
- # Install Unsloth
26
- RUN pip install --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
27
-
28
- # Install requirements
29
- COPY --chown=user hf_training/requirements.txt .
30
- RUN pip install --no-cache-dir -r requirements.txt
31
-
32
- # Install Secondary (No-Deps)
33
- RUN pip install --no-cache-dir --no-deps xformers<0.28 trl<0.13.0 peft accelerate bitsandbytes
34
-
35
- # Copy training files
36
- COPY --chown=user hf_training/ ./hf_training/
37
- COPY --chown=user aegis_env/ ./aegis_env/
38
- COPY --chown=user scripts/ ./scripts/
39
- COPY --chown=user aegis_training_data_500.json .
40
-
41
- # CMD
42
- CMD ["python3", "hf_training/train.py"]
 
1
+ FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
2
+
3
+ WORKDIR /app
4
+
5
+ # System dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ python3.10 \
8
+ python3-pip \
9
+ git \
10
+ build-essential \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Add HuggingFace unprivileged user bounds
14
+ RUN useradd -m -u 1000 user
15
+ USER user
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH \
18
+ PYTHONUNBUFFERED=1 \
19
+ FORCE_CUDA="1"
20
+
21
+ WORKDIR /home/user/app
22
+
23
+ # Dependencies
24
+ COPY --chown=user:user hf_training/requirements.txt hf_training/requirements.txt
25
+ RUN pip install --no-cache-dir -r hf_training/requirements.txt
26
+
27
+ # Secure Application Code
28
+ COPY --chown=user:user aegis_env aegis_env/
29
+ COPY --chown=user:user hf_training hf_training/
30
+ COPY --chown=user:user scripts scripts/
31
+ COPY --chown=user:user aegis_training_data_500.json .
32
+
33
+ EXPOSE 7860
34
+
35
+ # Run training entry point
36
+ CMD ["python3", "hf_training/train.py"]