Nitishkumar-ai commited on
Commit
f1f76e5
·
1 Parent(s): b8a1ac1

Fix: Add libaio-dev and reorder pip installs for Unsloth stability

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -16
Dockerfile CHANGED
@@ -1,35 +1,34 @@
1
- # Use a stable CUDA base
2
- FROM nvidia/cuda:12.4.1-devel-ubuntu22.04
3
 
4
  # Avoid prompts
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
- # Install Python 3.11 and essentials
8
  RUN apt-get update && apt-get install -y \
9
- python3.11 \
10
- python3-pip \
11
- python3.11-dev \
12
  git \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Set python3.11 as default
16
- RUN ln -s /usr/bin/python3.11 /usr/bin/python
17
-
18
  WORKDIR /app
19
 
20
  # Upgrade pip
21
  RUN pip install --no-cache-dir -U pip setuptools wheel
22
 
23
- # Install specific stable versions to bypass 2026 experimental version conflicts
24
- # Pinning to known-good versions from the 2024-2025 cycle
 
 
 
25
  RUN pip install --no-cache-dir \
26
- "torch==2.5.1" \
27
  "transformers==4.48.2" \
28
  "trl==0.12.1" \
29
  "peft==0.14.0" \
30
  "accelerate==1.2.1" \
31
- "bitsandbytes==0.45.0" \
32
- "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" \
 
 
33
  datasets \
34
  wandb \
35
  matplotlib \
@@ -41,7 +40,7 @@ RUN pip install --no-cache-dir \
41
  # Copy the project files
42
  COPY . .
43
 
44
- # Install the local package
45
  RUN pip install -e .
46
 
47
  # Set environment variables
@@ -49,5 +48,5 @@ ENV MODEL_NAME="meta-llama/Llama-3.2-3B-Instruct"
49
  ENV OUTPUT_DIR="outputs/commitguard-llama-3b-grpo"
50
  ENV WANDB_PROJECT="commitguard"
51
 
52
- # Start training
53
  CMD ["python", "scripts/train_grpo.py", "--samples", "200", "--max-steps", "300", "--push-to-hub"]
 
1
+ # Use a pre-configured PyTorch + CUDA base to save build time and avoid 'int1' issues
2
+ FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
3
 
4
  # Avoid prompts
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
+ # Install system dependencies needed for bitsandbytes and Unsloth
8
  RUN apt-get update && apt-get install -y \
 
 
 
9
  git \
10
+ libaio-dev \
11
  && rm -rf /var/lib/apt/lists/*
12
 
 
 
 
13
  WORKDIR /app
14
 
15
  # Upgrade pip
16
  RUN pip install --no-cache-dir -U pip setuptools wheel
17
 
18
+ # 1. Install Unsloth first (it's the most sensitive to environment)
19
+ RUN pip install --no-cache-dir "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
20
+
21
+ # 2. Install specifically pinned versions of the RL stack
22
+ # We use 0.12.1 for TRL and 4.48.2 for transformers - these are stable with Torch 2.5.1
23
  RUN pip install --no-cache-dir \
 
24
  "transformers==4.48.2" \
25
  "trl==0.12.1" \
26
  "peft==0.14.0" \
27
  "accelerate==1.2.1" \
28
+ "bitsandbytes==0.45.0"
29
+
30
+ # 3. Install remaining data and server dependencies
31
+ RUN pip install --no-cache-dir \
32
  datasets \
33
  wandb \
34
  matplotlib \
 
40
  # Copy the project files
41
  COPY . .
42
 
43
+ # Install the local package in editable mode
44
  RUN pip install -e .
45
 
46
  # Set environment variables
 
48
  ENV OUTPUT_DIR="outputs/commitguard-llama-3b-grpo"
49
  ENV WANDB_PROJECT="commitguard"
50
 
51
+ # Start training automatically
52
  CMD ["python", "scripts/train_grpo.py", "--samples", "200", "--max-steps", "300", "--push-to-hub"]