diff --git a/docker/Dockerfile.xpu b/docker/Dockerfile.xpu new file mode 100755 index 000000000..03661196f --- /dev/null +++ b/docker/Dockerfile.xpu @@ -0,0 +1,34 @@ +FROM intel/oneapi-basekit:2025.0.1-0-devel-ubuntu22.04 AS base +SHELL ["/bin/bash", "-c"] + +ARG PYTHON_VER=3.11 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get remove -y python3.10 && apt-get autoremove -y +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository -y ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get install -y python$PYTHON_VER python$PYTHON_VER-dev python3-pip && \ + ln -sf /usr/bin/python$PYTHON_VER /usr/bin/python3 && \ + ln -sf /usr/bin/python3 /usr/bin/python && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get -y install apt-utils build-essential \ + git vim numactl python3-dev wget google-perftools && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN pip install --upgrade pip +RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu --no-cache-dir +RUN pip install -U transformers accelerate peft pytest + +# install bitsandbytes +RUN git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ && \ + pip install . && cd ../ + +RUN touch /entrypoint.sh +RUN chmod +x /entrypoint.sh +RUN echo "#!/bin/bash" >> /entrypoint.sh +RUN echo "/bin/bash" >> /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docs/source/installation.mdx b/docs/source/installation.mdx index e61ce4655..666bbbcbc 100644 --- a/docs/source/installation.mdx +++ b/docs/source/installation.mdx @@ -192,13 +192,19 @@ You can install the pre-built wheels for each backend, or compile from source fo -This wheel provides support for ROCm and Intel XPU platforms. +This wheel provides support for ROCm platforms. ``` # Note, if you don't want to reinstall our dependencies, append the `--no-deps` flag! pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.44.1.dev0-py3-none-manylinux_2_24_x86_64.whl' ``` +This wheel provides support for Intel XPU platforms. +``` +# Note, if you don't want to reinstall our dependencies, append the `--no-deps` flag! +pip install --force-reinstall https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_main/bitsandbytes-1.33.7.preview-py3-none-manylinux_2_24_x86_64.whl --extra-index-url https://download.pytorch.org/whl/test/xpu +``` + This wheel provides support for the Intel XPU platform. @@ -241,9 +247,11 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise If you are using Intel CPU on Linux or Intel XPU on Linux/Windows, please follow the [instruction](https://pytorch-extension.intel.com/) or the following command to install intel_extension_for_pytorch so you can get better performance. CPU: `pip install intel_extension_for_pytorch` + XPU: `pip install intel_extension_for_pytorch --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/` Install bitsandbytes: + CPU: Need to build CPU C++ codes ``` git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ @@ -256,6 +264,8 @@ XPU: pip install git+https://github.com/bitsandbytes-foundation/bitsandbytes.git ``` +You can also use docker by `docker build -f docker/Dockerfile.xpu -t bnb-xpu .` on XPU. +