Spaces:
Runtime error
Runtime error
Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +14 -40
Dockerfile
CHANGED
|
@@ -1,48 +1,22 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 4 |
|
| 5 |
-
|
| 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 |
-
#
|
| 14 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 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 |
-
|
|
|
|
|
|
| 1 |
+
FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-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 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Install Unsloth and training dependencies
|
| 9 |
+
RUN pip install --no-cache-dir \
|
| 10 |
+
"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" \
|
| 11 |
+
&& pip install --no-cache-dir --no-deps xformers \
|
| 12 |
+
&& pip install --no-cache-dir \
|
| 13 |
+
trl peft accelerate bitsandbytes huggingface_hub safetensors
|
| 14 |
|
| 15 |
+
# Copy training script and dataset
|
| 16 |
+
COPY train.py .
|
| 17 |
+
COPY aegis_training_data_500.json .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
+
# -u for unbuffered stdout so logs appear in real time in HF Space console
|
| 22 |
+
CMD ["python", "-u", "train.py"]
|