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