File size: 2,196 Bytes
a90eb0c
 
 
 
 
 
d7c58f8
 
 
 
 
 
 
 
 
 
 
 
 
 
ed51e31
 
 
d7c58f8
 
 
 
 
 
a90eb0c
d7c58f8
a90eb0c
 
 
 
fcfee49
a90eb0c
 
 
 
 
fcfee49
a90eb0c
d7c58f8
d6e6068
 
 
 
d7c58f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 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"]