|
| 1 | +# Copyright (C) 2024 Intel Corporation |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +FROM ubuntu:22.04 |
| 5 | + |
| 6 | +ARG TAG=main |
| 7 | + |
| 8 | +RUN apt-get update \ |
| 9 | + && apt-get upgrade -y \ |
| 10 | + && apt-get install -y --no-install-recommends \ |
| 11 | + gcc-12 \ |
| 12 | + g++-12 \ |
| 13 | + make \ |
| 14 | + wget \ |
| 15 | + libnuma-dev \ |
| 16 | + numactl \ |
| 17 | + git \ |
| 18 | + pkg-config \ |
| 19 | + software-properties-common \ |
| 20 | + zlib1g-dev \ |
| 21 | + libssl-dev \ |
| 22 | + libffi-dev \ |
| 23 | + libbz2-dev \ |
| 24 | + libsqlite3-dev \ |
| 25 | + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 60 \ |
| 26 | + && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 60 \ |
| 27 | + && apt-get autoremove -y \ |
| 28 | + && rm -rf /var/lib/apt/lists/* |
| 29 | + |
| 30 | +# Install python |
| 31 | +WORKDIR /tmp |
| 32 | +RUN wget -q https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz \ |
| 33 | + && tar -xzvf Python-3.8.10.tgz |
| 34 | +WORKDIR /tmp/Python-3.8.10 |
| 35 | +RUN ./configure --prefix=/usr/bin/python3.8 --enable-optimizations \ |
| 36 | + && make -j \ |
| 37 | + && make install \ |
| 38 | + && update-alternatives --install /usr/bin/python python /usr/bin/python3.8/bin/python3.8 60 \ |
| 39 | + && update-alternatives --install /usr/bin/pip pip /usr/bin/python3.8/bin/pip3 60 \ |
| 40 | + && python -m pip install --no-cache-dir --upgrade pip setuptools \ |
| 41 | + && pip install --no-cache-dir wheel \ |
| 42 | + && rm -rf /tmp/* \ |
| 43 | + && echo "export PATH=/usr/bin/python3.8:\$PATH" >> ~/.bashrc |
| 44 | + |
| 45 | +RUN pip install --no-cache-dir torch==2.3.0+cpu --index-url https://download.pytorch.org/whl/cpu |
| 46 | +RUN pip install --no-cache-dir cmake==3.26.1 transformers==4.41.2 sentencepiece==0.1.99 accelerate==0.23.0 protobuf tiktoken transformers-stream-generator einops \ |
| 47 | + && ln -s /usr/bin/python3.8/lib/python3.8/site-packages/cmake/data/bin/cmake /usr/bin/cmake |
| 48 | + |
| 49 | +# Install oneCCL |
| 50 | +RUN git clone https://github.com/oneapi-src/oneCCL.git /tmp/oneCCL |
| 51 | +WORKDIR /tmp/oneCCL |
| 52 | +RUN git checkout 2021.10 \ |
| 53 | + && sed -i 's/cpu_gpu_dpcpp/./g' cmake/templates/oneCCLConfig.cmake.in \ |
| 54 | + && mkdir build |
| 55 | +WORKDIR /tmp/oneCCL/build |
| 56 | +RUN cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/oneCCL \ |
| 57 | + && make -j install |
| 58 | + |
| 59 | +RUN echo "source /usr/local/oneCCL/env/setvars.sh" >> ~/.bashrc |
| 60 | + |
| 61 | +WORKDIR /root/ |
| 62 | +RUN rm -rf /tmp/oneCCL |
| 63 | + |
| 64 | +RUN git clone https://github.com/intel/xFasterTransformer.git |
| 65 | + |
| 66 | +SHELL ["/bin/bash", "-c"] |
| 67 | +WORKDIR /root/xFasterTransformer |
| 68 | +RUN git checkout ${TAG} \ |
| 69 | + && export "LD_LIBRARY_PATH=/usr/local/mklml_lnx_2019.0.5.20190502/lib:$LD_LIBRARY_PATH" \ |
| 70 | + && export "PATH=/usr/bin/python3.8:$PATH" \ |
| 71 | + && echo "source /usr/local/oneCCL/env/setvars.sh" >> ~/.bash_profile \ |
| 72 | + && source ~/.bash_profile \ |
| 73 | + && python setup.py build \ |
| 74 | + && python setup.py egg_info bdist_wheel --verbose \ |
| 75 | + && pip install --no-cache-dir dist/* |
| 76 | + |
| 77 | +RUN mkdir -p /usr/local/xft/lib \ |
| 78 | + && cp /root/xFasterTransformer/build/libxfastertransformer.so /usr/local/xft/lib \ |
| 79 | + && cp /root/xFasterTransformer/build/libxft_comm_helper.so /usr/local/xft/lib \ |
| 80 | + && cp -r /root/xFasterTransformer/include /usr/local/xft/ \ |
| 81 | + && mkdir -p /usr/local/include/xft/ \ |
| 82 | + && ln -s /usr/local/xft/include /usr/local/include/xft/include |
| 83 | + |
| 84 | +RUN echo "export \$(python -c 'import xfastertransformer as xft; print(xft.get_env())')" >> ~/.bashrc |
| 85 | + |
| 86 | +COPY comps /root/comps |
| 87 | + |
| 88 | +RUN pip install --no-cache-dir --upgrade pip && \ |
| 89 | + pip install --no-cache-dir -r /root/comps/llms/text-generation/vllm-xft/requirements.txt |
| 90 | + |
| 91 | +ENV PYTHONPATH=$PYTHONPATH:/root |
| 92 | + |
| 93 | +RUN chmod +x /root/comps/llms/text-generation/vllm-xft/run.sh |
| 94 | + |
| 95 | +WORKDIR /root/comps/llms/text-generation/vllm-xft/ |
| 96 | + |
| 97 | +ENTRYPOINT ["/root/comps/llms/text-generation/vllm-xft/run.sh"] |
| 98 | + |
0 commit comments