Spaces:
Paused
Paused
| # Use an official PyTorch image with CUDA support as the base image | |
| FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-devel | |
| # Add NVIDIA CUDA GPG key | |
| # Add NVIDIA CUDA GPG key using a different key server | |
| RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key A4B469963BF863CC | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Set the MKL_THREADING_LAYER environment variable to GNU | |
| ENV MKL_THREADING_LAYER=GNU | |
| # Install Git, OpenGL libraries, and libglib2.0 | |
| RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0 | |
| RUN apt-get update && apt-get install -y ninja-build | |
| # Install necessary dependencies, including CMake, a C++ compiler, and others | |
| RUN apt-get update && apt-get install -y unzip ffmpeg cmake g++ build-essential aria2 | |
| # Install the packaging module | |
| RUN pip install packaging | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| # Set environment variables | |
| ENV HOME=/home/user \ | |
| CUDA_HOME=/usr/local/cuda \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \ | |
| LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \ | |
| PYTHONPATH=$HOME/app \ | |
| PYTHONUNBUFFERED=1 \ | |
| GRADIO_ALLOW_FLAGGING=never \ | |
| GRADIO_NUM_PORTS=1 \ | |
| GRADIO_SERVER_NAME=0.0.0.0 \ | |
| GRADIO_THEME=huggingface \ | |
| GRADIO_SHARE=False \ | |
| SYSTEM=spaces | |
| # Set the environment variable to specify the GPU device | |
| ENV CUDA_DEVICE_ORDER=PCI_BUS_ID | |
| ENV CUDA_VISIBLE_DEVICES=0 | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Clone your repository or add your code to the container | |
| RUN git clone -b main https://github.com/fffiloni/MiniGPT4-video $HOME/app | |
| # Install dependencies | |
| #COPY requirements.txt $HOME/app/requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN mkdir checkpoints | |
| # Download checkpoint files using aria2 | |
| 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 | |
| # Run your app.py script | |
| CMD ["python", "minigpt4_video_demo.py"] |