File size: 1,175 Bytes
e899bca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# D1337 CIPHER - Custom Training Environment
# Optimized for 4x L40S (192GB VRAM) with QLoRA
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
# Set environment
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
ENV TOKENIZERS_PARALLELISM=false
ENV HF_HOME=/app/.cache/huggingface
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
python3.10-venv \
git \
git-lfs \
curl \
wget \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# Create user for HuggingFace Spaces
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements first (for caching)
COPY --chown=user requirements.txt .
# Install Python dependencies
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt
# Copy application files
COPY --chown=user . .
# Expose port for Gradio
EXPOSE 7860
# Set HuggingFace cache directory
RUN mkdir -p /app/.cache/huggingface
# Run training script
CMD ["python3", "train.py"]
|