Spaces:
Paused
Paused
Enable CUDA 12.6 runtime, default flash-attn on HF, add huggingface_hub/PyMuPDF, make flash-attn configurable
Browse files- Dockerfile +16 -2
- requirements.txt +2 -2
Dockerfile
CHANGED
|
@@ -1,4 +1,10 @@
|
|
| 1 |
-
FROM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
# Install system dependencies as root
|
| 4 |
RUN apt-get update && apt-get install -y \
|
|
@@ -35,13 +41,21 @@ ENV HOME=/home/user \
|
|
| 35 |
# Set the working directory to the user's home directory
|
| 36 |
WORKDIR $HOME/app
|
| 37 |
|
| 38 |
-
#
|
| 39 |
RUN pip install --no-cache-dir --upgrade pip
|
| 40 |
|
| 41 |
# Copy requirements and install Python dependencies
|
| 42 |
COPY --chown=user requirements.txt .
|
| 43 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# Copy application code
|
| 46 |
COPY --chown=user . .
|
| 47 |
|
|
|
|
| 1 |
+
FROM pytorch/pytorch:2.7.0-cuda12.6-cudnn9-runtime
|
| 2 |
+
|
| 3 |
+
# Build args to optionally enable flash-attn installation and override wheel URL
|
| 4 |
+
# Enable by default for Hugging Face Spaces GPU builds; override locally with
|
| 5 |
+
# --build-arg INSTALL_FLASH_ATTN=false
|
| 6 |
+
ARG INSTALL_FLASH_ATTN=true
|
| 7 |
+
ARG FLASH_ATTN_WHEEL_URL=https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.0.8/flash_attn-2.7.4.post1+cu126torch2.7-cp310-cp310-linux_x86_64.whl
|
| 8 |
|
| 9 |
# Install system dependencies as root
|
| 10 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 41 |
# Set the working directory to the user's home directory
|
| 42 |
WORKDIR $HOME/app
|
| 43 |
|
| 44 |
+
# Upgrade pip in the CUDA-enabled base image
|
| 45 |
RUN pip install --no-cache-dir --upgrade pip
|
| 46 |
|
| 47 |
# Copy requirements and install Python dependencies
|
| 48 |
COPY --chown=user requirements.txt .
|
| 49 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 50 |
|
| 51 |
+
# Optionally install flash-attn wheel (requires Python/torch/CUDA compatibility)
|
| 52 |
+
RUN if [ "$INSTALL_FLASH_ATTN" = "true" ]; then \
|
| 53 |
+
echo "Installing flash-attn from $FLASH_ATTN_WHEEL_URL" && \
|
| 54 |
+
pip install --no-cache-dir $FLASH_ATTN_WHEEL_URL; \
|
| 55 |
+
else \
|
| 56 |
+
echo "Skipping flash-attn installation"; \
|
| 57 |
+
fi
|
| 58 |
+
|
| 59 |
# Copy application code
|
| 60 |
COPY --chown=user . .
|
| 61 |
|
requirements.txt
CHANGED
|
@@ -5,5 +5,5 @@ pydantic>=2.2.0,<3.0.0
|
|
| 5 |
opencv-python>=4.9.0.80
|
| 6 |
numpy>=1.26.0
|
| 7 |
pillow>=10.3.0
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 5 |
opencv-python>=4.9.0.80
|
| 6 |
numpy>=1.26.0
|
| 7 |
pillow>=10.3.0
|
| 8 |
+
huggingface_hub
|
| 9 |
+
PyMuPDF
|