From dada530149212d64d4b69534716202659ef37ec8 Mon Sep 17 00:00:00 2001 From: jiqing-feng <107918818+jiqing-feng@users.noreply.github.com> Date: Sat, 22 Jun 2024 00:53:26 +0800 Subject: [PATCH] cpu install guide (#1227) * cpu install guide * update readme * fix format * fix format * fix typo * add windows guide * fix readme to pip install . instead of building wheel * Update docs/source/installation.mdx Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/installation.mdx Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Update docs/source/installation.mdx Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> --------- Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> --- docs/source/installation.mdx | 54 ++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/docs/source/installation.mdx b/docs/source/installation.mdx index caf22488f..c84d0c2ef 100644 --- a/docs/source/installation.mdx +++ b/docs/source/installation.mdx @@ -1,5 +1,7 @@ # Installation +## CUDA + bitsandbytes is only supported on CUDA GPUs for CUDA versions **11.0 - 12.3**. The latest version of bitsandbytes (v0.43.0) builds on: @@ -29,7 +31,7 @@ To install from PyPI. pip install bitsandbytes ``` -## Compile from source +### Compile from source For Linux and Windows systems, you can compile bitsandbytes from source. Installing from source allows for more build options with different CMake configurations. @@ -91,7 +93,7 @@ Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com -## PyTorch CUDA versions +### PyTorch CUDA versions Some bitsandbytes features may need a newer CUDA version than the one currently supported by PyTorch binaries from Conda and pip. In this case, you should follow these instructions to load a precompiled bitsandbytes binary. @@ -131,3 +133,51 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/tim/local/cuda-11.7 ``` 3. Now when you launch bitsandbytes with these environment variables, the PyTorch CUDA version is overridden by the new CUDA version (in this example, version 11.7) and a different bitsandbytes library is loaded. + + +## Intel CPU + +> [!TIP] +> Intel CPU backend only supports building from source; for now, please follow the instructions below. + +Like CUDA, you can compile bitsandbytes from source for Linux and Windows systems. Installing from source allows for more build options with different CMake configurations. + + + + +To compile from source, you need CMake >= **3.22.1** and Python >= **3.8** installed. Make sure you have a compiler installed to compile C++ (gcc, make, headers, etc.). For example, to install a compiler and CMake on Ubuntu: + +```bash +apt-get install -y build-essential cmake +``` + +We recommend installing **GCC >= 11** and have at least **GCC >= 6**. + +Now to install the bitsandbytes package from source, run the following commands: + +```bash +git clone --branch multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/ +pip install -r requirements-dev.txt +pip install intel_extension_for_pytorch +cmake -DCOMPUTE_BACKEND=cpu -S . +make +pip install . +``` + + + + +Windows systems require Visual Studio with C++ support. + +To compile from source, you need CMake >= **3.22.1** and Python >= **3.8** installed. + +```bash +git clone --branch multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/ +pip install -r requirements-dev.txt +cmake -DCOMPUTE_BACKEND=cpu -S . +cmake --build . --config Release +pip install . +``` + + +