Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +57 -0
Dockerfile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
| 2 |
+
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
+
|
| 5 |
+
# Set the MKL_THREADING_LAYER environment variable to GNU
|
| 6 |
+
ENV MKL_THREADING_LAYER=GNU
|
| 7 |
+
|
| 8 |
+
# Install Git, OpenGL libraries, and libglib2.0
|
| 9 |
+
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0
|
| 10 |
+
|
| 11 |
+
RUN apt-get update && apt-get install -y ninja-build
|
| 12 |
+
|
| 13 |
+
# Install necessary dependencies, including CMake, a C++ compiler, and others
|
| 14 |
+
RUN apt-get update && apt-get install -y unzip ffmpeg cmake g++ build-essential aria2
|
| 15 |
+
|
| 16 |
+
# Set up a new user named "user" with user ID 1000
|
| 17 |
+
RUN useradd -m -u 1000 user
|
| 18 |
+
|
| 19 |
+
# Switch to the "user" user
|
| 20 |
+
USER user
|
| 21 |
+
|
| 22 |
+
# Set environment variables
|
| 23 |
+
ENV HOME=/home/user \
|
| 24 |
+
CUDA_HOME=/usr/local/cuda \
|
| 25 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 26 |
+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
|
| 27 |
+
LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
|
| 28 |
+
PYTHONPATH=$HOME/app \
|
| 29 |
+
PYTHONUNBUFFERED=1 \
|
| 30 |
+
GRADIO_ALLOW_FLAGGING=never \
|
| 31 |
+
GRADIO_NUM_PORTS=1 \
|
| 32 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 33 |
+
GRADIO_THEME=huggingface \
|
| 34 |
+
GRADIO_SHARE=False \
|
| 35 |
+
SYSTEM=spaces
|
| 36 |
+
|
| 37 |
+
# Set the working directory to the user's home directory
|
| 38 |
+
WORKDIR $HOME/app
|
| 39 |
+
|
| 40 |
+
# Clone your repository or add your code to the container
|
| 41 |
+
RUN git clone -b main https://github.com/fffiloni/MiniGPT4-video $HOME/app
|
| 42 |
+
|
| 43 |
+
# Install dependencies
|
| 44 |
+
#COPY requirements.txt $HOME/app/requirements.txt
|
| 45 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 46 |
+
|
| 47 |
+
RUN mkdir checkpoints
|
| 48 |
+
|
| 49 |
+
# Download checkpoint files using aria2
|
| 50 |
+
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Vision-CAIR/MiniGPT4-Video/resolve/main/checkpoints/video_llama_checkpoint_last.pth -d $HOME/app/checkpoints -o video_llama_checkpoint_last.pth
|
| 51 |
+
|
| 52 |
+
# Set the environment variable to specify the GPU device
|
| 53 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
| 54 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
| 55 |
+
|
| 56 |
+
# Run your app.py script
|
| 57 |
+
CMD ["python", "minigpt4_video_demo.py"]
|