Skip to content

Commit af7b939

Browse files
Titus-von-Koellermatthewdouglas
authored andcommitted
refine docs for multi-backend alpha release (#1380)
* refine docs for multi-backend alpha release * docs: further tweaks to multi-backend alpha docs * docs: further tweaks to multi-backend alpha docs * docs: further tweaks to multi-backend alpha docs * docs: add multi-backend feedback links * docs: add request for contributions * docs: small fixes * docs: small fixes * docs: add info about `main` continuous build * docs: further tweaks to multi-backend alpha docs * docs: further tweaks to multi-backend alpha docs
1 parent f87769c commit af7b939

File tree

2 files changed

+184
-43
lines changed

2 files changed

+184
-43
lines changed

docs/source/installation.mdx

Lines changed: 181 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,87 @@
1-
# Installation
1+
# Installation Guide
22

3-
## CUDA
3+
Welcome to the installation guide for the `bitsandbytes` library! This document provides step-by-step instructions to install `bitsandbytes` across various platforms and hardware configurations. The library primarily supports CUDA-based GPUs, but the team is actively working on enabling support for additional backends like AMD ROCm, Intel, and Apple Silicon.
44

5-
bitsandbytes is only supported on CUDA GPUs for CUDA versions **11.0 - 12.5**. However, there's a multi-backend effort under way which is currently in alpha release, check [the respective section below in case you're interested to help us with early feedback](#multi-backend).
5+
> [!TIP]
6+
> For a high-level overview of backend support and compatibility, see the [Multi-backend Support](#multi-backend) section.
67
7-
The latest version of bitsandbytes builds on:
8+
## Table of Contents
89

9-
| OS | CUDA | Compiler |
10-
|---|---|---|
11-
| Linux | 11.7 - 12.3 | GCC 11.4 |
12-
| | 12.4+ | GCC 13.2 |
13-
| Windows | 11.7 - 12.4 | MSVC 19.38+ (VS2022 17.8.0+) |
10+
- [CUDA](#cuda)
11+
- [Installation via PyPI](#cuda-pip)
12+
- [Compile from Source](#cuda-compile)
13+
- [Multi-backend Support (Alpha Release)](#multi-backend)
14+
- [Supported Backends](#multi-backend-supported-backends)
15+
- [Pre-requisites](#multi-backend-pre-requisites)
16+
- [Installation](#multi-backend-pip)
17+
- [Compile from Source](#multi-backend-compile)
18+
- [PyTorch CUDA Versions](#pytorch-cuda-versions)
1419

15-
> [!TIP]
16-
> MacOS support is still a work in progress! Subscribe to this [issue](https://github.com/TimDettmers/bitsandbytes/issues/1020) to get notified about discussions and to track the integration progress.
20+
## CUDA[[cuda]]
1721

18-
For Linux systems, make sure your hardware meets the following requirements to use bitsandbytes features.
22+
`bitsandbytes` is currently only supported on CUDA GPUs for CUDA versions **11.0 - 12.5**. However, there's an ongoing multi-backend effort under development, which is currently in alpha. If you're interested in providing feedback or testing, check out [the multi-backend section below](#multi-backend).
1923

20-
| **Feature** | **Hardware requirement** |
21-
|---|---|
22-
| LLM.int8() | NVIDIA Turing (RTX 20 series, T4) or Ampere (RTX 30 series, A4-A100) GPUs |
23-
| 8-bit optimizers/quantization | NVIDIA Kepler (GTX 780 or newer) |
24+
### Supported CUDA Configurations[[cuda-pip]]
25+
26+
The latest version of `bitsandbytes` builds on the following configurations:
27+
28+
| **OS** | **CUDA Version** | **Compiler** |
29+
|-------------|------------------|----------------------|
30+
| **Linux** | 11.7 - 12.3 | GCC 11.4 |
31+
| | 12.4+ | GCC 13.2 |
32+
| **Windows** | 11.7 - 12.4 | MSVC 19.38+ (VS2022) |
33+
34+
For Linux systems, ensure your hardware meets the following requirements:
35+
36+
| **Feature** | **Hardware Requirement** |
37+
|---------------------------------|--------------------------------------------------------------------|
38+
| LLM.int8() | NVIDIA Turing (RTX 20 series, T4) or Ampere (RTX 30 series, A4-A100) GPUs |
39+
| 8-bit optimizers/quantization | NVIDIA Kepler (GTX 780 or newer) |
2440

2541
> [!WARNING]
26-
> bitsandbytes >= 0.39.1 no longer includes Kepler binaries in pip installations. This requires manual compilation, and you should follow the general steps and use `cuda11x_nomatmul_kepler` for Kepler-targeted compilation.
42+
> `bitsandbytes >= 0.39.1` no longer includes Kepler binaries in pip installations. This requires [manual compilation using](#cuda-compile) the `cuda11x_nomatmul_kepler` configuration.
2743
2844
To install from PyPI.
2945

3046
```bash
3147
pip install bitsandbytes
3248
```
3349

34-
### Compile from source[[compile]]
50+
### `pip install` pre-built wheel from latest `main` commit
51+
52+
If you would like to use new feature even before they are officially released and help us test them, feel free to install the wheel directly from our CI (*the wheel links will remain stable!*):
53+
54+
<hfoptions id="OS">
55+
<hfoption id="Linux">
56+
57+
```
58+
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag!
59+
pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_main/bitsandbytes-0.44.2.dev0-py3-none-manylinux_2_24_x86_64.whl'
60+
```
61+
62+
</hfoption>
63+
<hfoption id="Windows">
64+
65+
```
66+
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag!
67+
pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.44.1.dev0-py3-none-macosx_13_1_arm64.whl'
68+
```
69+
</hfoption>
70+
</hfoptions>
71+
72+
### Compile from source[[cuda-compile]]
73+
74+
> [!TIP]
75+
> Don't hesitate to compile from source! The process is pretty straight forward and resilient. This might be needed for older CUDA versions or other less common configurations, which we don't support out of the box due to package size.
3576
36-
For Linux and Windows systems, you can compile bitsandbytes from source. Installing from source allows for more build options with different CMake configurations.
77+
For Linux and Windows systems, compiling from source allows you to customize the build configurations. See below for detailed platform-specific instructions (see the `CMakeLists.txt` if you want to check the specifics and explore some additional options):
3778

3879
<hfoptions id="source">
3980
<hfoption id="Linux">
4081

41-
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:
82+
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.).
83+
84+
For example, to install a compiler and CMake on Ubuntu:
4285

4386
```bash
4487
apt-get install -y build-essential cmake
@@ -48,16 +91,16 @@ You should also install CUDA Toolkit by following the [NVIDIA CUDA Installation
4891

4992
Refer to the following table if you're using another CUDA Toolkit version.
5093

51-
| CUDA Toolkit | GCC |
52-
|---|---|
53-
| >= 11.4.1 | >= 11 |
54-
| >= 12.0 | >= 12 |
55-
| >= 12.4 | >= 13 |
94+
| CUDA Toolkit | GCC |
95+
|--------------|-------|
96+
| >= 11.4.1 | >= 11 |
97+
| >= 12.0 | >= 12 |
98+
| >= 12.4 | >= 13 |
5699

57100
Now to install the bitsandbytes package from source, run the following commands:
58101

59102
```bash
60-
git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
103+
git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
61104
pip install -r requirements-dev.txt
62105
cmake -DCOMPUTE_BACKEND=cuda -S .
63106
make
@@ -81,7 +124,7 @@ Refer to the following table if you're using another CUDA Toolkit version.
81124
| >= 11.6 | 19.30+ (VS2022) |
82125

83126
```bash
84-
git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
127+
git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
85128
pip install -r requirements-dev.txt
86129
cmake -DCOMPUTE_BACKEND=cuda -S .
87130
cmake --build . --config Release
@@ -93,7 +136,7 @@ Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com
93136
</hfoption>
94137
</hfoptions>
95138

96-
### PyTorch CUDA versions
139+
### PyTorch CUDA versions[[pytorch-cuda-versions]]
97140

98141
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.
99142

@@ -105,7 +148,7 @@ Some bitsandbytes features may need a newer CUDA version than the one currently
105148
Then locally install the CUDA version you need with this script from bitsandbytes:
106149

107150
```bash
108-
wget https://raw.githubusercontent.com/TimDettmers/bitsandbytes/main/install_cuda.sh
151+
wget https://raw.githubusercontent.com/bitsandbytes-foundation/bitsandbytes/main/install_cuda.sh
109152
# Syntax cuda_install CUDA_VERSION INSTALL_PREFIX EXPORT_TO_BASH
110153
# CUDA_VERSION in {110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125}
111154
# EXPORT_TO_BASH in {0, 1} with 0=False and 1=True
@@ -134,28 +177,62 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/YOUR_USERNAME/local/cuda-11.7
134177

135178
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.
136179

137-
## Multi-backend[[multi-backend]]
180+
## Multi-backend Support (Alpha Release)[[multi-backend]]
138181

139182
> [!TIP]
140-
> This functionality is currently in preview and therefore not yet production-ready! Please reference [this guide](./non_cuda_backends) for more in-depth information about the different backends and their current status.
183+
> This functionality is currently in preview and not yet production-ready. We very much welcome community feedback, contributions and leadership on topics like Apple Silicon as well as other less common accellerators! For more information, see [this guide on multi-backend support](./non_cuda_backends).
184+
185+
**Link to give us feedback** (bugs, install issues, perf results, requests, etc.)**:**
186+
187+
<hfoptions id="platform">
188+
<hfoption id="ROCm">
189+
190+
[**Multi-backend refactor: Alpha release (AMD ROCm ONLY)**](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1339)
191+
192+
</hfoption>
193+
<hfoption id="Intel CPU+GPU">
194+
195+
[**Multi-backend refactor: Alpha release (INTEL ONLY)**](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1338)
196+
197+
</hfoption>
198+
<hfoption id="Apple Silicon / Metal (MPS)">
141199

142-
Please follow these steps to install bitsandbytes with device-specific backend support other than CUDA:
200+
[**Github Discussion space on coordinating the kickoff of MPS backend development**](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1340)
143201

144-
### Pip install the pre-built wheel (recommended for most)
202+
</hfoption>
203+
</hfoptions>
145204

146-
WIP (will be added in the coming days)
205+
### Supported Backends[[multi-backend-supported-backends]]
147206

148-
### Compilation
207+
| **Backend** | **Supported Versions** | **Python versions** | **Architecture Support** | **Status** |
208+
|-------------|------------------------|---------------------------|-------------------------|------------|
209+
| **AMD ROCm** | 6.1+ | 3.10+ | minimum CDNA - `gfx90a`, RDNA - `gfx1100` | Alpha |
210+
| **Apple Silicon (MPS)** | WIP | 3.10+ | M1/M2 chips | Planned |
211+
| **Intel CPU** | v2.4.0+ (`ipex`) | 3.10+ | Intel CPU | Alpha |
212+
| **Intel GPU** | v2.4.0+ (`ipex`) | 3.10+ | Intel GPU | Experimental |
213+
214+
For each supported backend, follow the respective instructions below:
215+
216+
### Pre-requisites[[multi-backend-pre-requisites]]
217+
218+
To use bitsandbytes non-CUDA backends, be sure to install:
219+
220+
```
221+
pip install "transformers>=4.45.1"
222+
```
149223

150224
<hfoptions id="backend">
151225
<hfoption id="AMD ROCm">
152226

153-
#### AMD GPU
154-
155-
bitsandbytes is fully supported from ROCm 6.1 onwards (currently in alpha release).
227+
> [!WARNING]
228+
> Pre-compiled binaries are only built for ROCm versions `6.1.0`/`6.1.1`/`6.1.2`/`6.2.0` and `gfx90a`, `gfx942`, `gfx1100` GPU architectures. [Find the pip install instructions here](#multi-backend-pip).
229+
>
230+
> Other supported versions that don't come with pre-compiled binaries [can be compiled for with these instructions](#multi-backend-compile).
231+
>
232+
> **Windows is not supported for the ROCm backend**; also not WSL2 to our knowledge.
156233
157234
> [!TIP]
158-
> If you would like to install ROCm and PyTorch on bare metal, skip Docker steps and refer to our official guides at [ROCm installation overview](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/tutorial/install-overview.html#rocm-install-overview) and [Installing PyTorch for ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/3rd-party/pytorch-install.html#using-wheels-package) (Step 3 of wheels build for quick installation). Please make sure to get PyTorch wheel for the installed ROCm version.
235+
> If you would like to install ROCm and PyTorch on bare metal, skip the Docker steps and refer to ROCm's official guides at [ROCm installation overview](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/tutorial/install-overview.html#rocm-install-overview) and [Installing PyTorch for ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/3rd-party/pytorch-install.html#using-wheels-package) (Step 3 of wheels build for quick installation). Special note: please make sure to get the respective ROCm-specific PyTorch wheel for the installed ROCm version, e.g. `https://download.pytorch.org/whl/nightly/rocm6.2/`!
159236
160237
```bash
161238
# Create a docker container with latest ROCm image, which includes ROCm libraries
@@ -165,9 +242,70 @@ apt-get update && apt-get install -y git && cd home
165242

166243
# Install pytorch compatible with above ROCm version
167244
pip install torch --index-url https://download.pytorch.org/whl/rocm6.1/
245+
```
168246

169-
# Install bitsandbytes from PyPI
170-
# (This is supported on Ubuntu 22.04, Python 3.10, ROCm 6.1.0/6.1.1/6.1.2/6.2.0 and gpu arch - gfx90a, gfx942, gfx1100
247+
</hfoption>
248+
<hfoption id="Intel CPU + GPU">
249+
250+
Compatible hardware and functioning `import intel_extension_for_pytorch as ipex` capable environment with Python `3.10` as the minimum requirement.
251+
252+
Please refer to [the official Intel installations instructions](https://intel.github.io/intel-extension-for-pytorch/index.html#installation?platform=cpu&version=v2.4.0%2bcpu&os=linux%2fwsl2) for guidance on how to pip install the necessary `intel_extension_for_pytorch` dependency.
253+
254+
</hfoption>
255+
<hfoption id="Apple Silicon (MPS)">
256+
257+
> [!TIP]
258+
> Apple Silicon support is still a WIP. Please visit and write us in [this Github Discussion space on coordinating the kickoff of MPS backend development](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1340) and coordinate a community-led effort to implement this backend.
259+
260+
</hfoption>
261+
</hfoptions>
262+
263+
### Installation
264+
265+
You can install the pre-built wheels for each backend, or compile from source for custom configurations.
266+
267+
#### Pre-built Wheel Installation (recommended)[[multi-backend-pip]]
268+
269+
<hfoptions id="platform">
270+
<hfoption id="Linux">
271+
272+
```
273+
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag!
274+
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'
275+
```
276+
277+
</hfoption>
278+
<hfoption id="Windows">
279+
280+
```
281+
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag!
282+
pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.44.1.dev0-py3-none-win_amd64.whl'
283+
```
284+
285+
</hfoption>
286+
<hfoption id="Mac">
287+
288+
> [!WARNING]
289+
> bitsandbytes does not yet support Apple Silicon / Metal with a dedicated backend. However, the build infrastructure is in place and the below pip install will eventually provide Apple Silicon support as it becomes available on the `multi-backend-refactor` branch based on community contributions.
290+
291+
```
292+
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag!
293+
pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.44.1.dev0-py3-none-macosx_13_1_arm64.whl'
294+
```
295+
296+
</hfoption>
297+
</hfoptions>
298+
299+
#### Compile from Source[[multi-backend-compile]]
300+
301+
<hfoptions id="backend">
302+
<hfoption id="AMD ROCm">
303+
304+
#### AMD GPU
305+
306+
bitsandbytes is fully supported from ROCm 6.1 onwards (currently in alpha release).
307+
308+
```bash
171309
# Please install from source if your configuration doesn't match with these)
172310
pip install bitsandbytes
173311

@@ -195,10 +333,10 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise
195333
196334
Similar to the CUDA case, you can compile bitsandbytes from source for Linux and Windows systems.
197335

198-
The below commands are for Linux. For installing on Windows, please adapt the below commands according to the same pattern as described [the section above on compiling from source under the Windows tab](#compile).
336+
The below commands are for Linux. For installing on Windows, please adapt the below commands according to the same pattern as described [the section above on compiling from source under the Windows tab](#cuda-compile).
199337

200338
```
201-
git clone --depth 1 -b multi-backend-refactor https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
339+
git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
202340
pip install intel_extension_for_pytorch
203341
pip install -r requirements-dev.txt
204342
cmake -DCOMPUTE_BACKEND=cpu -S .

docs/source/non_cuda_backends.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Multi-backend support (non-CUDA backends)
22

3+
> [!Tip]
4+
> If you feel these docs need some additional info, please consider submitting a PR or respectfully request the missing info in one of the below mentioned Github discussion spaces.
5+
36
As part of a recent refactoring effort, we will soon offer official multi-backend support. Currently, this feature is available in a preview alpha release, allowing us to gather early feedback from users to improve the functionality and identify any bugs.
47

58
At present, the Intel CPU and AMD ROCm backends are considered fully functional. The Intel XPU backend has limited functionality and is less mature.

0 commit comments

Comments
 (0)