You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note currently `bitsandbytes` is only supported on CUDA GPU hardwares, support for AMD GPUs and M1 chips (MacOS) is coming soon.
3
+
bitsandbytes is only supported on CUDA GPUs for CUDA versions **10.2 - 12.0**. Select your operating system below to see the installation instructions.
4
4
5
5
<hfoptionsid="OS system">
6
6
<hfoptionid="Linux">
7
7
8
-
## Hardware requirements:
9
-
- LLM.int8(): NVIDIA Turing (RTX 20xx; T4) or Ampere GPU (RTX 30xx; A4-A100); (a GPU from 2018 or newer).
10
-
- 8-bit optimizers and quantization: NVIDIA Kepler GPU or newer (>=GTX 78X).
8
+
For Linux systems, make sure your hardware meets the following requirements to use bitsandbytes features.
11
9
12
-
Supported CUDA versions: 10.2 - 12.0 #TODO: check currently supported versions
> 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.
15
17
16
-
### From Pypi
18
+
To install from PyPI.
17
19
18
20
```bash
19
21
pip install bitsandbytes
20
22
```
21
23
22
-
### From source
24
+
To compile from source, you need CMake >= **3.22.1** and Python >= **3.10** 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:
23
25
24
-
You need CMake and Python installed. For Linux, make sure to install a compiler (`apt install build-essential`, for example).
26
+
```bash
27
+
apt-get install -y build-essential cmake
28
+
```
29
+
30
+
You should also install CUDA Toolkit by following the [NVIDIA CUDA Installation Guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html) guide from NVIDIA.
31
+
32
+
Now to install the bitsandbytes package from source, run the following commands:
Note support for non-CUDA GPUs (e.g. AMD, Intel, Apple Silicon), is also coming soon.
34
-
For a more detailed compilation guide, head to the [dedicated page on the topic](./compiling)
41
+
42
+
> [!TIP]
43
+
> If you have multiple versions of CUDA installed or installed it in a non-standard location, please refer to CMake CUDA documentation for how to configure the CUDA compiler.
35
44
36
45
</hfoption>
37
46
<hfoptionid="Windows">
38
47
39
-
## Windows
40
-
41
-
Windows builds require Visual Studio with C++ support, as well as the Cuda SDK installed.
48
+
Windows systems require Visual Studio with C++ support as well as an installation of the CUDA SDK.
42
49
43
-
Currently for Windows users, you need to build bitsandbytes from source:
50
+
You'll need to build bitsandbytes from source. To compile from source, you need CMake >= **3.22.1** and Python >= **3.10** installed. You should also install CUDA Toolkit by following the [CUDA Installation Guide for Windows](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html) guide from NVIDIA.
Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com/Jamezo97), [rickardp](https://github.com/rickardp), [akx](https://github.com/akx) for their amazing contributions to make bitsandbytes compatible with Windows.
54
61
55
-
For a more detailed compilation guide, head to the [dedicated page on the topic](./compiling)
56
-
57
62
</hfoption>
58
63
<hfoptionid="MacOS">
59
64
60
-
## MacOS
61
-
62
-
Mac support is still a work in progress. Please make sure to check out the [Apple Silicon implementation coordination issue](https://github.com/TimDettmers/bitsandbytes/issues/1020) to get notified about the discussions and progress with respect to MacOS integration.
65
+
> [!TIP]
66
+
> 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.
63
67
64
68
</hfoption>
65
-
66
69
</hfoptions>
70
+
71
+
## PyTorch CUDA versions
72
+
73
+
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.
74
+
75
+
1. Determine the path of the CUDA version you want to use. Common paths include:
76
+
77
+
*`/usr/local/cuda`
78
+
*`/usr/local/cuda-XX.X` where `XX.X` is the CUDA version number
79
+
80
+
Then locally install the CUDA version you need with this script from bitsandbytes:
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.
Copy file name to clipboardExpand all lines: docs/source/integrations.mdx
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,10 @@ Please review the [bitsandbytes section in the Accelerate docs](https://huggingf
6
6
7
7
Details about the BitsAndBytesConfig can be found [here](https://huggingface.co/docs/transformers/v4.37.2/en/main_classes/quantization#transformers.BitsAndBytesConfig).
8
8
9
-
## Beware: bf16 is optional compute data type
10
-
If your hardware supports it, `bf16` is the optimal compute dtype. The default is `float32` for backward compatibility and numerical stability. `float16` often leads to numerical instabilities, but `bfloat16` provides the benefits of both worlds: numerical stability and significant computation speedup. Therefore, be sure to check if your hardware supports `bf16` and configure it using the `bnb_4bit_compute_dtype` parameter in BitsAndBytesConfig:
9
+
> [!WARNING]
10
+
> **Beware: bf16 is the optimal compute data type!**
11
+
>
12
+
> If your hardware supports it, `bf16` is the optimal compute dtype. The default is `float32` for backward compatibility and numerical stability. `float16` often leads to numerical instabilities, but `bfloat16` provides the benefits of both worlds: numerical stability equivalent to float32, but combined with the memory footprint and significant computation speedup of a 16-bit data type. Therefore, be sure to check if your hardware supports `bf16` and configure it using the `bnb_4bit_compute_dtype` parameter in BitsAndBytesConfig:
0 commit comments