wheattoast11 commited on
Commit
b7b8e4b
·
verified ·
1 Parent(s): 510f091

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +68 -0
Dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Unsloth Training Hub Dockerfile
2
+ # CRITICAL: Installation order matters for Unsloth!
3
+
4
+ FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
5
+
6
+ # Prevent interactive prompts
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+
9
+ # Install system dependencies
10
+ RUN apt-get update && apt-get install -y python3.11 python3.11-venv python3-pip git wget curl && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Set Python 3.11 as default
13
+ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
14
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
15
+
16
+ # Create virtual environment
17
+ RUN python3 -m venv /opt/venv
18
+ ENV PATH="/opt/venv/bin:$PATH"
19
+
20
+ # Upgrade pip and install uv for faster installs
21
+ RUN pip install --upgrade pip && pip install uv
22
+
23
+ # ============================================================================
24
+ # CRITICAL: UNSLOTH INSTALLATION ORDER
25
+ # 1. Install PyTorch first
26
+ # 2. Install unsloth
27
+ # 3. Install vllm
28
+ # 4. Install diffusers (for GRPO)
29
+ # 5. Install TRL from git (latest)
30
+ # ============================================================================
31
+
32
+ # Step 1: PyTorch with CUDA 12.1
33
+ RUN uv pip install torch==2.4.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
34
+
35
+ # Step 2: Unsloth (main package)
36
+ RUN uv pip install "unsloth[cu121-ampere-torch240] @ git+https://github.com/unslothai/unsloth.git"
37
+
38
+ # Step 3: vLLM for fast inference during RL
39
+ RUN uv pip install vllm
40
+
41
+ # Step 4: diffusers (required for GRPO)
42
+ RUN uv pip install diffusers
43
+
44
+ # Step 5: TRL from git (latest for GRPO/GSPO support)
45
+ RUN uv pip install git+https://github.com/huggingface/trl.git
46
+
47
+ # Step 6: Additional dependencies
48
+ RUN uv pip install gradio>=4.0.0 datasets>=2.18.0 anthropic>=0.39.0 huggingface_hub>=0.24.0 pyyaml accelerate>=0.30.0 sentencepiece protobuf
49
+
50
+ # Set working directory
51
+ WORKDIR /app
52
+
53
+ # Copy application code
54
+ COPY . /app/
55
+
56
+ # Create directories for runs
57
+ RUN mkdir -p /app/runs /app/data /app/outputs
58
+
59
+ # Environment variables
60
+ ENV PYTHONUNBUFFERED=1
61
+ ENV HF_HUB_ENABLE_HF_TRANSFER=1
62
+ ENV UNSLOTH_VLLM_STANDBY=1
63
+
64
+ # Expose Gradio port
65
+ EXPOSE 7860
66
+
67
+ # Run app
68
+ CMD ["python3", "app.py"]