Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +23 -13
Dockerfile
CHANGED
|
@@ -5,7 +5,6 @@ FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 6 |
MKL_THREADING_LAYER=GNU \
|
| 7 |
HOME=/home/user \
|
| 8 |
-
PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \
|
| 9 |
PYTHONPATH=/home/user/app \
|
| 10 |
PYTHONUNBUFFERED=1 \
|
| 11 |
GRADIO_ALLOW_FLAGGING=never \
|
|
@@ -16,30 +15,38 @@ ENV DEBIAN_FRONTEND=noninteractive \
|
|
| 16 |
SYSTEM=spaces \
|
| 17 |
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
|
| 18 |
CUDA_HOME=/usr/local/cuda \
|
| 19 |
-
LD_LIBRARY_PATH=/usr/local/cuda/lib64
|
| 20 |
TORCH_CUDA_ARCH_LIST="8.6" \
|
| 21 |
CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
|
| 22 |
|
| 23 |
-
#
|
|
|
|
|
|
|
|
|
|
| 24 |
RUN apt-get update && \
|
| 25 |
apt-get install -y --no-install-recommends \
|
| 26 |
python3.9 python3.9-dev python3.9-venv \
|
| 27 |
git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
|
| 28 |
-
build-essential
|
|
|
|
| 29 |
rm -rf /var/lib/apt/lists/*
|
| 30 |
|
| 31 |
-
# Set Python 3.9 as the default python3 and install pip
|
| 32 |
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
|
| 33 |
update-alternatives --set python3 /usr/bin/python3.9 && \
|
| 34 |
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9 && \
|
| 35 |
ln -sf /usr/bin/python3.9 /usr/bin/python && \
|
| 36 |
-
ln -sf /usr/
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Add NVIDIA package repositories and install CUDA Toolkit and cuDNN
|
| 39 |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
|
| 40 |
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
| 41 |
apt-get update && \
|
| 42 |
-
apt-get install -y --no-install-recommends
|
|
|
|
| 43 |
rm -rf /var/lib/apt/lists/*
|
| 44 |
|
| 45 |
# Create a non-root user
|
|
@@ -59,17 +66,20 @@ RUN mkdir -p checkpoints && \
|
|
| 59 |
wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O checkpoints/denoising_network.pth && \
|
| 60 |
wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O checkpoints/renderer.pt
|
| 61 |
|
| 62 |
-
#
|
|
|
|
|
|
|
|
|
|
| 63 |
COPY requirements_HF.txt .
|
| 64 |
-
RUN pip install --no-cache-dir -r requirements_HF.txt && \
|
| 65 |
-
pip install --no-cache-dir "moviepy<2" gradio
|
| 66 |
|
| 67 |
# Copy the application file
|
| 68 |
COPY app.py .
|
| 69 |
|
| 70 |
-
# Set CUDA environment variables
|
| 71 |
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID \
|
| 72 |
CUDA_VISIBLE_DEVICES=0
|
| 73 |
|
| 74 |
-
# Run the application
|
| 75 |
-
CMD ["
|
|
|
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 6 |
MKL_THREADING_LAYER=GNU \
|
| 7 |
HOME=/home/user \
|
|
|
|
| 8 |
PYTHONPATH=/home/user/app \
|
| 9 |
PYTHONUNBUFFERED=1 \
|
| 10 |
GRADIO_ALLOW_FLAGGING=never \
|
|
|
|
| 15 |
SYSTEM=spaces \
|
| 16 |
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
|
| 17 |
CUDA_HOME=/usr/local/cuda \
|
| 18 |
+
LD_LIBRARY_PATH=/usr/local/cuda/lib64 \
|
| 19 |
TORCH_CUDA_ARCH_LIST="8.6" \
|
| 20 |
CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
|
| 21 |
|
| 22 |
+
# Override PATH so that the system's /usr/bin (with Python 3.9) is used instead of Conda's
|
| 23 |
+
ENV PATH="/usr/local/cuda/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin"
|
| 24 |
+
|
| 25 |
+
# Install Python 3.9 and build dependencies (including for NumPy)
|
| 26 |
RUN apt-get update && \
|
| 27 |
apt-get install -y --no-install-recommends \
|
| 28 |
python3.9 python3.9-dev python3.9-venv \
|
| 29 |
git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
|
| 30 |
+
build-essential gfortran libopenblas-dev liblapack-dev \
|
| 31 |
+
cmake g++ software-properties-common gnupg2 && \
|
| 32 |
rm -rf /var/lib/apt/lists/*
|
| 33 |
|
| 34 |
+
# Set Python 3.9 as the default python3 and install pip for it
|
| 35 |
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
|
| 36 |
update-alternatives --set python3 /usr/bin/python3.9 && \
|
| 37 |
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9 && \
|
| 38 |
ln -sf /usr/bin/python3.9 /usr/bin/python && \
|
| 39 |
+
ln -sf /usr/bin/pip3 /usr/bin/pip
|
| 40 |
+
|
| 41 |
+
# Upgrade pip, setuptools, and wheel
|
| 42 |
+
RUN python3.9 -m pip install --upgrade pip setuptools wheel
|
| 43 |
|
| 44 |
# Add NVIDIA package repositories and install CUDA Toolkit and cuDNN
|
| 45 |
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
|
| 46 |
dpkg -i cuda-keyring_1.0-1_all.deb && \
|
| 47 |
apt-get update && \
|
| 48 |
+
apt-get install -y --no-install-recommends \
|
| 49 |
+
cuda-toolkit-11-7 libcudnn8 libcudnn8-dev && \
|
| 50 |
rm -rf /var/lib/apt/lists/*
|
| 51 |
|
| 52 |
# Create a non-root user
|
|
|
|
| 66 |
wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O checkpoints/denoising_network.pth && \
|
| 67 |
wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O checkpoints/renderer.pt
|
| 68 |
|
| 69 |
+
# Install NumPy first (to help avoid build issues)
|
| 70 |
+
RUN python3.9 -m pip install numpy
|
| 71 |
+
|
| 72 |
+
# Copy and install remaining Python dependencies
|
| 73 |
COPY requirements_HF.txt .
|
| 74 |
+
RUN python3.9 -m pip install --no-cache-dir -r requirements_HF.txt && \
|
| 75 |
+
python3.9 -m pip install --no-cache-dir "moviepy<2" gradio
|
| 76 |
|
| 77 |
# Copy the application file
|
| 78 |
COPY app.py .
|
| 79 |
|
| 80 |
+
# Set CUDA environment variables (if needed)
|
| 81 |
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID \
|
| 82 |
CUDA_VISIBLE_DEVICES=0
|
| 83 |
|
| 84 |
+
# Run the application with Python 3.9 explicitly
|
| 85 |
+
CMD ["python3.9", "app.py"]
|