Skip to content

Commit b0730f4

Browse files
authored
structure, install (#1072)
1 parent d11b506 commit b0730f4

File tree

6 files changed

+85
-139
lines changed

6 files changed

+85
-139
lines changed

docs/source/_toctree.yml

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
- title: Get started
22
sections:
33
- local: index
4-
title: Index
4+
title: bitsandbytes
55
- local: quickstart
66
title: Quickstart
77
- local: installation
88
title: Installation
9-
- title: Features & Integrations
9+
- title: Guides
1010
sections:
11-
- local: quantization
12-
title: Quantization
1311
- local: optimizers
14-
title: Optimizers
15-
- local: integrations
16-
title: Integrations
12+
title: 8-bit optimizers
1713
- local: algorithms
1814
title: Algorithms
19-
- title: Support & Learning
15+
- local: integrations
16+
title: Integrations
17+
- local: errors
18+
title: Troubleshoot
19+
- local: contributing
20+
title: Contribute
21+
- local: faqs
22+
title: FAQs
23+
- title: Explanation
2024
sections:
2125
- local: resources
2226
title: Papers, resources & how to cite
23-
- local: errors
24-
title: Errors & Solutions
25-
- local: nonpytorchcuda
26-
title: Non-PyTorch CUDA
27-
- local: compiling
28-
title: Compilation from Source (extended)
29-
- local: faqs
30-
title: FAQs (Frequently Asked Questions)
31-
- title: Contributors Guidelines
27+
- title: API reference
3228
sections:
33-
- local: contributing
34-
title: Contributing
29+
- local: quantization
30+
title: Quantization

docs/source/compiling.mdx

Lines changed: 0 additions & 50 deletions
This file was deleted.

docs/source/errors.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Errors & Solutions
1+
# Troubleshoot
22

33
## No kernel image available
44

docs/source/installation.mdx

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
# Installation
22

3-
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.
44

55
<hfoptions id="OS system">
66
<hfoption id="Linux">
77

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.
119

12-
Supported CUDA versions: 10.2 - 12.0 #TODO: check currently supported versions
10+
| **Feature** | **Hardware requirement** |
11+
|---|---|
12+
| LLM.int8() | NVIDIA Turing (RTX 20 series, T4) or Ampere (RTX 30 series, A4-A100) GPUs |
13+
| 8-bit optimizers/quantization | NVIDIA Kepler (GTX 780 or newer) |
1314

14-
## Linux
15+
> [!WARNING]
16+
> 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.
1517
16-
### From Pypi
18+
To install from PyPI.
1719

1820
```bash
1921
pip install bitsandbytes
2022
```
2123

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:
2325

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:
2533

2634
```bash
2735
git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
@@ -30,17 +38,16 @@ cmake -DCOMPUTE_BACKEND=cuda -S .
3038
make
3139
pip install .
3240
```
33-
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.
3544
3645
</hfoption>
3746
<hfoption id="Windows">
3847

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.
4249

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.
4451

4552
```bash
4653
git clone https://github.com/TimDettmers/bitsandbytes.git && cd bitsandbytes/
@@ -52,15 +59,52 @@ python -m build --wheel
5259

5360
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.
5461

55-
For a more detailed compilation guide, head to the [dedicated page on the topic](./compiling)
56-
5762
</hfoption>
5863
<hfoption id="MacOS">
5964

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.
6367
6468
</hfoption>
65-
6669
</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:
81+
82+
```bash
83+
wget https://raw.githubusercontent.com/TimDettmers/bitsandbytes/main/install_cuda.sh
84+
# Syntax cuda_install CUDA_VERSION INSTALL_PREFIX EXPORT_TO_BASH
85+
# CUDA_VERSION in {110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122}
86+
# EXPORT_TO_BASH in {0, 1} with 0=False and 1=True
87+
88+
# For example, the following installs CUDA 11.7 to ~/local/cuda-11.7 and exports the path to your .bashrc
89+
90+
bash cuda_install.sh 117 ~/local 1
91+
```
92+
93+
2. Set the environment variables `BNB_CUDA_VERSION` and `LD_LIBRARY_PATH` by manually overriding the CUDA version installed by PyTorch.
94+
95+
> [!TIP]
96+
> It is recommended to add the following lines to the `.bashrc` file to make them permanent.
97+
98+
```bash
99+
export BNB_CUDA_VERSION=<VERSION>
100+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<PATH>
101+
```
102+
103+
For example, to use a local install path:
104+
105+
```bash
106+
export BNB_CUDA_VERSION=117
107+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/tim/local/cuda-11.7
108+
```
109+
110+
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.

docs/source/integrations.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ Please review the [bitsandbytes section in the Accelerate docs](https://huggingf
66

77
Details about the BitsAndBytesConfig can be found [here](https://huggingface.co/docs/transformers/v4.37.2/en/main_classes/quantization#transformers.BitsAndBytesConfig).
88

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:
1113
1214
```py
1315
import torch

docs/source/nonpytorchcuda.mdx

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)