File size: 2,621 Bytes
e20ef71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu20.04

# These are all pre-defined
ENV DEBIAN_FRONTEND=noninteractive \
    TZ=Europe/Paris
# Install some basic utilities
RUN rm -f /etc/apt/sources.list.d/*.list && \
    apt-get update && apt-get install -y --no-install-recommends \
    sudo \
    git \
    curl \
    wget \
    ffmpeg libsm6 libxext6 \
 && rm -rf /var/lib/apt/lists/*
# Create a working directory
WORKDIR /app
# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
    && chown -R user:user /app \
    && echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
USER user
# All users can use /home/user as their home directory
ENV HOME=/home/user \
    CONDA_AUTO_UPDATE_CONDA=false
ENV PATH=$HOME/miniconda/bin:$PATH
RUN mkdir $HOME/.cache $HOME/.config \
    && chmod -R 777 $HOME \
    && curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py310_24.5.0-0-Linux-x86_64.sh \
    && chmod +x ~/miniconda.sh \
    && ~/miniconda.sh -b -p ~/miniconda \
    && rm ~/miniconda.sh \
    && conda clean -ya

# From here are my stuff

# Download models
RUN pip install --no-cache-dir gdown && \
    mkdir -p ./pretrained_models/GLIP/checkpoints && \
    mkdir -p ./pretrained_models/GLIP/configs && \
    mkdir -p ./pretrained_models/xvlm && \
    wget -nc -q -P ./pretrained_models/GLIP/checkpoints https://huggingface.co/GLIPModel/GLIP/resolve/main/glip_large_model.pth && \
    wget -nc -q -P ./pretrained_models/GLIP/configs https://raw.githubusercontent.com/microsoft/GLIP/main/configs/pretrain/glip_Swin_L.yaml && \
    gdown "https://drive.google.com/u/0/uc?id=1bv6_pZOsXW53EhlwU0ZgSk03uzFI61pN" -O ./pretrained_models/xvlm/retrieval_mscoco_checkpoint_9.pth

# Python packages
RUN --mount=target=requirements.txt,source=requirements.txt \
    pip install --no-cache-dir torch torchvision && \
    pip install --no-cache-dir git+https://github.com/openai/CLIP.git && \
    pip install --no-cache-dir -r requirements.txt

RUN python -c "from transformers import AutoModel; _ = AutoModel.from_pretrained('codellama/CodeLlama-7b-Python-hf')"
RUN python -c "from transformers import AutoModel; _ = AutoModel.from_pretrained('VDebugger/VDebugger-critic-generalist-7B')"
RUN python -c "from transformers import AutoModel; _ = AutoModel.from_pretrained('VDebugger/VDebugger-refiner-generalist-7B')"

# Download GLIP dependencies, but unfortunately don't install yet...
RUN git clone https://github.com/sachit-menon/GLIP

# Run gradio
COPY --link --chown=1000 ./ /app
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
CMD ["bash", "app.sh"]