Dockerfile 3.87 KB
Newer Older
1
2
3
4
ARG CUDA_VERSION=12.5.1

FROM nvcr.io/nvidia/tritonserver:24.04-py3-min

Yineng Zhang's avatar
Yineng Zhang committed
5
ARG BUILD_TYPE=all
Ying Sheng's avatar
Ying Sheng committed
6
7
8
9
ENV DEBIAN_FRONTEND=noninteractive

RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
    && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
Yineng Zhang's avatar
Yineng Zhang committed
10
11
12
    && apt update -y \
    && apt install software-properties-common -y \
    && add-apt-repository ppa:deadsnakes/ppa -y && apt update \
13
    && apt install python3.10 python3.10-dev -y \
14
    && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 \
Yineng Zhang's avatar
Yineng Zhang committed
15
    && update-alternatives --set python3 /usr/bin/python3.10 && apt install python3.10-distutils -y \
16
    && apt install curl git sudo libibverbs-dev -y \
Yineng Zhang's avatar
Yineng Zhang committed
17
    && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py \
Ying Sheng's avatar
Ying Sheng committed
18
    && python3 --version \
Liangsheng Yin's avatar
Liangsheng Yin committed
19
20
    && python3 -m pip --version \
    && rm -rf /var/lib/apt/lists/* \
Yineng Zhang's avatar
Yineng Zhang committed
21
    && apt clean
Ying Sheng's avatar
Ying Sheng committed
22

23
24
25
# For openbmb/MiniCPM models
RUN pip3 install datamodel_code_generator

Ying Sheng's avatar
Ying Sheng committed
26
27
WORKDIR /sgl-workspace

28
ARG CUDA_VERSION
Yineng Zhang's avatar
Yineng Zhang committed
29
RUN python3 -m pip install --upgrade pip setuptools wheel html5lib six \
30
    && git clone --depth=1 https://github.com/sgl-project/sglang.git \
Yineng Zhang's avatar
Yineng Zhang committed
31
32
33
34
    && if [ "$CUDA_VERSION" = "12.1.1" ]; then \
         python3 -m pip install torch --index-url https://download.pytorch.org/whl/cu121; \
       elif [ "$CUDA_VERSION" = "12.4.1" ]; then \
         python3 -m pip install torch --index-url https://download.pytorch.org/whl/cu124; \
35
36
       elif [ "$CUDA_VERSION" = "12.5.1" ]; then \
         python3 -m pip install torch --index-url https://download.pytorch.org/whl/cu124; \
Yineng Zhang's avatar
Yineng Zhang committed
37
38
       elif [ "$CUDA_VERSION" = "11.8.0" ]; then \
         python3 -m pip install torch --index-url https://download.pytorch.org/whl/cu118; \
39
         python3 -m pip install sgl-kernel -i https://docs.sglang.ai/whl/cu118; \
Yineng Zhang's avatar
Yineng Zhang committed
40
41
42
       else \
         echo "Unsupported CUDA version: $CUDA_VERSION" && exit 1; \
       fi \
43
    && cd sglang \
Yineng Zhang's avatar
Yineng Zhang committed
44
    && if [ "$BUILD_TYPE" = "srt" ]; then \
45
         if [ "$CUDA_VERSION" = "12.1.1" ]; then \
46
           python3 -m pip --no-cache-dir install -e "python[srt]" --find-links https://flashinfer.ai/whl/cu121/torch2.5/flashinfer-python; \
47
         elif [ "$CUDA_VERSION" = "12.4.1" ]; then \
48
           python3 -m pip --no-cache-dir install -e "python[srt]" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python; \
49
         elif [ "$CUDA_VERSION" = "12.5.1" ]; then \
50
           python3 -m pip --no-cache-dir install -e "python[srt]" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python; \
51
         elif [ "$CUDA_VERSION" = "11.8.0" ]; then \
52
           python3 -m pip --no-cache-dir install -e "python[srt]" --find-links https://flashinfer.ai/whl/cu118/torch2.5/flashinfer-python; \
53
           python3 -m pip install sgl-kernel -i https://docs.sglang.ai/whl/cu118; \
54
55
56
         else \
           echo "Unsupported CUDA version: $CUDA_VERSION" && exit 1; \
         fi; \
Yineng Zhang's avatar
Yineng Zhang committed
57
       else \
58
         if [ "$CUDA_VERSION" = "12.1.1" ]; then \
59
           python3 -m pip --no-cache-dir install -e "python[all]" --find-links https://flashinfer.ai/whl/cu121/torch2.5/flashinfer-python; \
60
         elif [ "$CUDA_VERSION" = "12.4.1" ]; then \
61
           python3 -m pip --no-cache-dir install -e "python[all]" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python; \
62
         elif [ "$CUDA_VERSION" = "12.5.1" ]; then \
63
           python3 -m pip --no-cache-dir install -e "python[all]" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer-python; \
64
         elif [ "$CUDA_VERSION" = "11.8.0" ]; then \
65
           python3 -m pip --no-cache-dir install -e "python[all]" --find-links https://flashinfer.ai/whl/cu118/torch2.5/flashinfer-python; \
66
           python3 -m pip install sgl-kernel -i https://docs.sglang.ai/whl/cu118; \
67
68
69
         else \
           echo "Unsupported CUDA version: $CUDA_VERSION" && exit 1; \
         fi; \
Yineng Zhang's avatar
Yineng Zhang committed
70
71
       fi

Ying Sheng's avatar
Ying Sheng committed
72
ENV DEBIAN_FRONTEND=interactive