Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- Dockerfile +32 -21
- requirements.txt +1 -2
Dockerfile
CHANGED
|
@@ -1,37 +1,48 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
-
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN useradd -m -u 1000 user
|
| 12 |
USER user
|
|
|
|
| 13 |
WORKDIR /home/user/app
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
COPY --chown=user:user requirements.txt .
|
| 22 |
-
RUN python3 -m pip install -
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
&& python3 -m pip install --no-cache-dir --no-deps trl \
|
| 26 |
-
&& python3 -m pip install --no-cache-dir -r requirements.txt \
|
| 27 |
-
&& python3 -m pip install --no-cache-dir \
|
| 28 |
-
peft accelerate bitsandbytes
|
| 29 |
-
|
| 30 |
-
# 3. User Mapping (Part 2: chown for all COPY)
|
| 31 |
COPY --chown=user:user train.py .
|
| 32 |
COPY --chown=user:user aegis_training_data_500.json .
|
| 33 |
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
-
# -u for unbuffered stdout so logs appear in real time in HF Space console
|
| 37 |
CMD ["python3", "-u", "train.py"]
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 4 |
|
| 5 |
+
# Install python3.10 and git
|
| 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 |
+
# Make python3.10 the default python3
|
| 14 |
+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
|
| 15 |
+
|
| 16 |
+
# Set up user
|
| 17 |
RUN useradd -m -u 1000 user
|
| 18 |
USER user
|
| 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 |
CMD ["python3", "-u", "train.py"]
|
requirements.txt
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
transformers
|
| 2 |
huggingface_hub
|
| 3 |
sentencepiece
|
| 4 |
protobuf
|
| 5 |
datasets
|
| 6 |
scipy
|
| 7 |
gradio
|
| 8 |
-
safetensors
|
|
|
|
| 1 |
+
transformers==4.44.2
|
| 2 |
huggingface_hub
|
| 3 |
sentencepiece
|
| 4 |
protobuf
|
| 5 |
datasets
|
| 6 |
scipy
|
| 7 |
gradio
|
|
|