YashashMathur commited on
Commit
51db3e8
·
verified ·
1 Parent(s): c2609b1

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +32 -21
  2. requirements.txt +1 -2
Dockerfile CHANGED
@@ -1,37 +1,48 @@
1
- FROM pytorch/pytorch:2.4.0-cuda12.4-cudnn9-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
- # 1. Environment Hardening
7
- ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
8
- ENV PATH=/home/user/.local/bin:$PATH
 
 
 
 
9
 
10
- # 3. User Mapping (Part 1: Create user)
 
 
 
11
  RUN useradd -m -u 1000 user
12
  USER user
 
13
  WORKDIR /home/user/app
14
 
15
- # 2. Pip Setup (Part 1: Upgrade pip)
16
- RUN python3 -m pip install --no-cache-dir --upgrade pip
 
 
 
 
 
 
 
17
 
18
- # Install Unsloth and training dependencies
19
- # 2. Pip Setup (Part 2: Use python3 -m pip)
20
- # 4. Dependency Protection (trl and xformers with --no-deps)
 
 
 
 
21
  COPY --chown=user:user requirements.txt .
22
- RUN python3 -m pip install --no-cache-dir \
23
- "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" \
24
- && python3 -m pip install --no-cache-dir --no-deps xformers \
25
- && python3 -m pip install --no-cache-dir --no-deps trl \
26
- && python3 -m pip install --no-cache-dir -r requirements.txt \
27
- && python3 -m pip install --no-cache-dir \
28
- peft accelerate bitsandbytes
29
-
30
- # 3. User Mapping (Part 2: chown for all COPY)
31
  COPY --chown=user:user train.py .
32
  COPY --chown=user:user aegis_training_data_500.json .
33
 
34
  EXPOSE 7860
35
 
36
- # -u for unbuffered stdout so logs appear in real time in HF Space console
37
  CMD ["python3", "-u", "train.py"]
 
1
+ FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
 
4
 
5
+ # Install python3.10 and git
6
+ RUN apt-get update && apt-get install -y \
7
+ python3.10 \
8
+ python3-pip \
9
+ python3.10-dev \
10
+ git \
11
+ && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Make python3.10 the default python3
14
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
15
+
16
+ # Set up user
17
  RUN useradd -m -u 1000 user
18
  USER user
19
+ ENV PATH="/home/user/.local/bin:${PATH}"
20
  WORKDIR /home/user/app
21
 
22
+ # PIP Installation Sequence (Crucial)
23
+ # a. pip install --upgrade pip
24
+ RUN python3 -m pip install --upgrade pip
25
+
26
+ # b. pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
27
+ RUN python3 -m pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
28
+
29
+ # c. pip uninstall -y torchao (ensure it is gone)
30
+ RUN python3 -m pip uninstall -y torchao
31
 
32
+ # d. pip install --no-deps "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
33
+ RUN python3 -m pip install --no-deps "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
34
+
35
+ # e. pip install --no-deps xformers==0.0.27 trl==0.11.0 peft accelerate bitsandbytes
36
+ RUN python3 -m pip install --no-deps xformers==0.0.27 trl==0.11.0 peft accelerate bitsandbytes
37
+
38
+ # Install other requirements
39
  COPY --chown=user:user requirements.txt .
40
+ RUN python3 -m pip install -r requirements.txt
41
+
42
+ # Copy application code
 
 
 
 
 
 
43
  COPY --chown=user:user train.py .
44
  COPY --chown=user:user aegis_training_data_500.json .
45
 
46
  EXPOSE 7860
47
 
 
48
  CMD ["python3", "-u", "train.py"]
requirements.txt CHANGED
@@ -1,8 +1,7 @@
1
- transformers>=4.45.0
2
  huggingface_hub
3
  sentencepiece
4
  protobuf
5
  datasets
6
  scipy
7
  gradio
8
- safetensors
 
1
+ transformers==4.44.2
2
  huggingface_hub
3
  sentencepiece
4
  protobuf
5
  datasets
6
  scipy
7
  gradio