/ docker / Dockerfile-cu121
Dockerfile-cu121
 1  ARG CUDA_VERSION=12.1.0
 2  ARG from=nvidia/cuda:${CUDA_VERSION}-cudnn8-devel-ubuntu20.04
 3  
 4  FROM ${from} as base
 5  
 6  ARG DEBIAN_FRONTEND=noninteractive
 7  RUN <<EOF
 8  apt update -y && apt upgrade -y && apt install -y --no-install-recommends  \
 9      git \
10      git-lfs \
11      python3 \
12      python3-pip \
13      python3-dev \
14      wget \
15      vim \
16      libsndfile1 \
17  && rm -rf /var/lib/apt/lists/*
18  EOF
19  
20  RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-Linux-x86_64.sh \
21      -q -O /tmp/cmake-install.sh \
22      && chmod u+x /tmp/cmake-install.sh \
23      && mkdir /opt/cmake-3.26.1 \
24      && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-3.26.1 \
25      && rm /tmp/cmake-install.sh \
26      && ln -s /opt/cmake-3.26.1/bin/* /usr/local/bin
27  
28  RUN ln -s /usr/bin/python3 /usr/bin/python
29  
30  RUN git lfs install
31  
32  FROM base as dev
33  
34  WORKDIR /
35  
36  RUN mkdir -p /data/shared/Qwen
37  
38  WORKDIR /data/shared/Qwen/
39  
40  FROM dev as bundle_req
41  RUN pip3 install --no-cache-dir networkx==3.1
42  RUN pip3 install --no-cache-dir torch==2.4.0 torchvision==0.19 torchaudio==2.4.0 xformers==0.0.27.post2 --index-url https://download.pytorch.org/whl/cu121
43  
44  RUN pip3 install --no-cache-dir git+https://github.com/huggingface/transformers@21fac7abba2a37fae86106f87fcf9974fd1e3830  \
45      && pip3 install --no-cache-dir accelerate \
46      && pip3 install --no-cache-dir qwen-vl-utils
47  
48  FROM bundle_req as bundle_vllm
49  
50  RUN pip3 install --no-cache-dir --no-build-isolation flash-attn==2.6.1
51  
52  RUN mkdir -p /data/shared/code \
53      && cd /data/shared/code \
54      && git clone https://github.com/fyabc/vllm.git \
55      && cd vllm \
56      && git checkout add_qwen2_vl_new \
57      && pip3 install --no-cache-dir -r requirements-cuda.txt \
58      && pip3 install --no-cache-dir --no-build-isolation . \
59      && cd /data/shared/Qwen \
60      && rm -rf /data/shared/code/vllm
61  
62  RUN pip3 install --no-cache-dir \
63      gradio==4.42.0 \
64      gradio_client==1.3.0 \
65      transformers-stream-generator==0.0.4
66  
67  COPY ../utils.py ./
68  COPY ../web_demo_mm.py ./
69  
70  EXPOSE 80