Unverified Commit 198d08fc authored by Matthew Douglas's avatar Matthew Douglas Committed by GitHub
Browse files

Documentation Cleanup (#1644)

* Start cleaning up docs

* Remove page

* Minor update

* correction

* Minor doc revisions

* Update installation.mdx

* Update _toctree.yml
parent 9f858294
...@@ -2,18 +2,15 @@ ...@@ -2,18 +2,15 @@
sections: sections:
- local: index - local: index
title: bitsandbytes title: bitsandbytes
- local: quickstart
title: Quickstart
- local: installation - local: installation
title: Installation title: Installation
- title: Guides - local: quickstart
title: Quickstart
- title: Usage Guides
sections: sections:
- local: optimizers - local: optimizers
title: 8-bit optimizers title: 8-bit optimizers
- local: algorithms
title: Algorithms
- local: non_cuda_backends
title: Non-CUDA compute backends
- local: fsdp_qlora - local: fsdp_qlora
title: FSDP-QLoRA title: FSDP-QLoRA
- local: integrations - local: integrations
...@@ -56,7 +53,7 @@ ...@@ -56,7 +53,7 @@
title: RMSprop title: RMSprop
- local: reference/optim/sgd - local: reference/optim/sgd
title: SGD title: SGD
- title: k-bit quantizers - title: Modules
sections: sections:
- local: reference/nn/linear8bit - local: reference/nn/linear8bit
title: LLM.int8() title: LLM.int8()
......
# Other algorithms
_WIP: Still incomplete... Community contributions would be greatly welcome!_
This is an overview of the `bnb.functional` API in `bitsandbytes` that we think would also be useful as standalone entities.
## Using Int8 Matrix Multiplication
For straight Int8 matrix multiplication without mixed precision decomposition you can use ``bnb.matmul(...)``. To enable mixed precision decomposition, use the threshold parameter:
```py
bnb.matmul(..., threshold=6.0)
```
# Contributors guidelines # Contribution Guide
... still under construction ... (feel free to propose materials, `bitsandbytes` is a community project)
## Setup ## Setup
......
...@@ -3,5 +3,3 @@ ...@@ -3,5 +3,3 @@
Please submit your questions in [this Github Discussion thread](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1013) if you feel that they will likely affect a lot of other users and that they haven't been sufficiently covered in the documentation. Please submit your questions in [this Github Discussion thread](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1013) if you feel that they will likely affect a lot of other users and that they haven't been sufficiently covered in the documentation.
We'll pick the most generally applicable ones and post the QAs here or integrate them into the general documentation (also feel free to submit doc PRs, please). We'll pick the most generally applicable ones and post the QAs here or integrate them into the general documentation (also feel free to submit doc PRs, please).
# ... under construction ...
# Installation Guide # Installation Guide
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. 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 CPU, AMD ROCm, Intel XPU, and Gaudi HPU.
> [!TIP]
> For a high-level overview of backend support and compatibility, see the [Multi-backend Support](#multi-backend) section.
## Table of Contents ## Table of Contents
- [CUDA](#cuda) - [CUDA](#cuda)
- [Installation via PyPI](#cuda-pip) - [Installation via PyPI](#cuda-pip)
- [Compile from Source](#cuda-compile) - [Compile from Source](#cuda-compile)
- [Multi-backend Support (Alpha Release)](#multi-backend) - [Preview Wheels from `main`](#cuda-preview)
- [Multi-Backend Preview](#multi-backend)
- [Supported Backends](#multi-backend-supported-backends) - [Supported Backends](#multi-backend-supported-backends)
- [Pre-requisites](#multi-backend-pre-requisites) - [Pre-requisites](#multi-backend-pre-requisites)
- [Installation](#multi-backend-pip) - [Installation](#multi-backend-pip)
- [Compile from Source](#multi-backend-compile) - [Compile from Source](#multi-backend-compile)
- [PyTorch CUDA Versions](#pytorch-cuda-versions)
## CUDA[[cuda]] ## CUDA[[cuda]]
`bitsandbytes` is currently only supported on CUDA GPUs for CUDA versions **11.0 - 12.8**. 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). `bitsandbytes` is currently supported on NVIDIA GPUs with [Compute Capability](https://developer.nvidia.com/cuda-gpus) 5.0+.
The library can be built using CUDA Toolkit versions as old as **11.6** on Windows and **11.4** on Linux.
### Supported CUDA Configurations[[cuda-pip]]
The latest version of the distributed `bitsandbytes` package is built with the following configurations:
| **OS** | **CUDA Toolkit** | **Host Compiler** |
|-------------|------------------|----------------------|
| **Linux** | 11.8 - 12.3 | GCC 11.4 |
| | 12.4 - 12.8 | GCC 13.2 |
| **Windows** | 11.8 - 12.8 | MSVC 19.42+ (VS2022) |
For CUDA systems, ensure your hardware meets the following requirements:
| **Feature** | **Minimum Hardware Requirement** | | **Feature** | **CC Required** | **Example Hardware Requirement** |
|---------------------------------|---------------------------------------------------------------| |---------------------------------|-----------------|---------------------------------------------|
| LLM.int8() | NVIDIA Turing (RTX 20 series, T4) or newer GPUs | | LLM.int8() | 7.5+ | Turing (RTX 20 series, T4) or newer GPUs |
| 8-bit optimizers/quantization | NVIDIA Maxwell (GTX 900 series, TITAN X, M40) or newer GPUs * | | 8-bit optimizers/quantization | 5.0+ | Maxwell (GTX 900 series, TITAN X, M40) or newer GPUs |
| NF4/FP4 quantization | NVIDIA Maxwell (GTX 900 series, TITAN X, M40) or newer GPUs * | | NF4/FP4 quantization | 5.0+ | Maxwell (GTX 900 series, TITAN X, M40) or newer GPUs |
> [!WARNING] > [!WARNING]
> `bitsandbytes >= 0.45.0` no longer supports Kepler GPUs.
>
> Support for Maxwell GPUs is deprecated and will be removed in a future release. For the best results, a Turing generation device or newer is recommended. > Support for Maxwell GPUs is deprecated and will be removed in a future release. For the best results, a Turing generation device or newer is recommended.
```bash ### Installation via PyPI[[cuda-pip]]
pip install bitsandbytes
```
### `pip install` pre-built wheel from latest `main` commit
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!*):
<hfoptions id="OS"> This is the most straightforward and recommended installation option.
<hfoption id="Linux">
```
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag!
# x86_64 (most users) The currently distributed `bitsandbytes` packages are built with the following configurations:
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
# ARM/aarch64 | **OS** | **CUDA Toolkit** | **Host Compiler** | **Targets**
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_aarch64.whl |--------------------|------------------|----------------------|--------------
``` | **Linux x86-64** | 11.8 - 12.6 | GCC 11.2 | sm50, sm60, sm75, sm80, sm86, sm89, sm90
| **Linux x86-64** | 12.8 | GCC 11.2 | sm75, sm80, sm86, sm89, sm90, sm100, sm120
| **Linux aarch64** | 11.8 - 12.6 | GCC 11.2 | sm75, sm80, sm90
| **Linux aarch64** | 12.8 | GCC 11.2 | sm75, sm80, sm90, sm100
| **Windows x86-64** | 11.8 - 12.6 | MSVC 19.43+ (VS2022) | sm50, sm60, sm75, sm80, sm86, sm89, sm90
| **Windows x86-64** | 12.8 | MSVC 19.43+ (VS2022) | sm75, sm80, sm86, sm89, sm90, sm100, sm120
</hfoption> Use `pip` or `uv` to install:
<hfoption id="Windows">
```bash
pip install bitsandbytes
``` ```
# Note, if you don't want to reinstall BNBs 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-win_amd64.whl
```
</hfoption>
</hfoptions>
### Compile from source[[cuda-compile]] ### Compile from source[[cuda-compile]]
> [!TIP] > [!TIP]
> 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. > Don't hesitate to compile from source! The process is pretty straight forward and resilient. This might be needed for older CUDA Toolkit versions or Linux distributions, or other less common configurations.
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): 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):
<hfoptions id="source"> <hfoptions id="source">
<hfoption id="Linux"> <hfoption id="Linux">
To compile from source, you need CMake >= **3.22.1** and Python >= **3.9** installed. Make sure you have a compiler installed to compile C++ (`gcc`, `make`, headers, etc.). To compile from source, you need CMake >= **3.22.1** and Python >= **3.9** installed. Make sure you have a compiler installed to compile C++ (`gcc`, `make`, headers, etc.). It is recommended to use GCC 9 or newer.
For example, to install a compiler and CMake on Ubuntu: For example, to install a compiler and CMake on Ubuntu:
...@@ -93,7 +67,7 @@ For example, to install a compiler and CMake on Ubuntu: ...@@ -93,7 +67,7 @@ For example, to install a compiler and CMake on Ubuntu:
apt-get install -y build-essential cmake apt-get install -y build-essential cmake
``` ```
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. The current minimum supported CUDA Toolkit version is **11.8**. 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. The current minimum supported CUDA Toolkit version that we test with is **11.8**.
```bash ```bash
git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
...@@ -103,14 +77,14 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise ...@@ -103,14 +77,14 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise
``` ```
> [!TIP] > [!TIP]
> 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. > If you have multiple versions of the CUDA Toolkit installed or it is in a non-standard location, please refer to CMake CUDA documentation for how to configure the CUDA compiler.
</hfoption> </hfoption>
<hfoption id="Windows"> <hfoption id="Windows">
Windows systems require Visual Studio with C++ support as well as an installation of the CUDA SDK. Compilation from source on Windows systems require Visual Studio with C++ support as well as an installation of the CUDA Toolkit.
To compile from source, you need CMake >= **3.22.1** and Python >= **3.9** 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. The current minimum supported CUDA Toolkit version is **11.8**. To compile from source, you need CMake >= **3.22.1** and Python >= **3.9** 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. The current minimum supported CUDA Toolkit version that we test with is **11.8**.
```bash ```bash
git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
...@@ -124,78 +98,46 @@ Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com ...@@ -124,78 +98,46 @@ Big thanks to [wkpark](https://github.com/wkpark), [Jamezo97](https://github.com
</hfoption> </hfoption>
</hfoptions> </hfoptions>
### PyTorch CUDA versions[[pytorch-cuda-versions]] ### Preview Wheels from `main`[[cuda-preview]]
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.
1. Determine the path of the CUDA version you want to use. Common paths include: If you would like to use new features 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!*):
* `/usr/local/cuda` <hfoptions id="OS">
* `/usr/local/cuda-XX.X` where `XX.X` is the CUDA version number <hfoption id="Linux">
Then locally install the CUDA version you need with this script from bitsandbytes:
```bash ```bash
wget https://raw.githubusercontent.com/bitsandbytes-foundation/bitsandbytes/main/install_cuda.sh # Note: if you don't want to reinstall our dependencies, append the `--no-deps` flag!
# Syntax cuda_install CUDA_VERSION INSTALL_PREFIX EXPORT_TO_BASH
# CUDA_VERSION in {118, 120, 121, 122, 123, 124, 125, 126, 128}
# EXPORT_TO_BASH in {0, 1} with 0=False and 1=True
# For example, the following installs CUDA 12.6 to ~/local/cuda-12.6 and exports the path to your .bashrc
bash install_cuda.sh 126 ~/local 1
```
2. Set the environment variables `BNB_CUDA_VERSION` and `LD_LIBRARY_PATH` by manually overriding the CUDA version installed by PyTorch. # x86_64 (most users)
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
> [!TIP]
> It is recommended to add the following lines to the `.bashrc` file to make them permanent.
```bash # ARM/aarch64
export BNB_CUDA_VERSION=<VERSION> 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_aarch64.whl
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<PATH>
``` ```
For example, to use a local install path: </hfoption>
<hfoption id="Windows">
```bash ```bash
export BNB_CUDA_VERSION=126 # Note: if you don't want to reinstall our dependencies, append the `--no-deps` flag!
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/YOUR_USERNAME/local/cuda-12.6 pip install --force-reinstall https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_main/bitsandbytes-1.33.7.preview-py3-none-win_amd64.whl
``` ```
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 12.6) and a different bitsandbytes library is loaded.
## Multi-backend Support (Alpha Release)[[multi-backend]]
> [!TIP]
> 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).
**Link to give us feedback** (bugs, install issues, perf results, requests, etc.)**:**
<hfoptions id="platform">
<hfoption id="ROCm">
[**Multi-backend refactor: Alpha release (AMD ROCm ONLY)**](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1339)
</hfoption> </hfoption>
<hfoption id="Intel CPU+GPU"> </hfoptions>
[**Multi-backend refactor: Alpha release (INTEL ONLY)**](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1338)
</hfoption> ## Multi-Backend Preview[[multi-backend]]
<hfoption id="Apple Silicon / Metal (MPS)">
[**Github Discussion space on coordinating the kickoff of MPS backend development**](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1340) > [!WARNING]
> This functionality existed as an early technical preview and is not recommended for production use. We are in the process of upstreaming improved support for AMD and Intel hardware into the main project.
</hfoption> We provide an early preview of support for AMD and Intel hardware as part of a development branch.
</hfoptions>
### Supported Backends[[multi-backend-supported-backends]] ### Supported Backends[[multi-backend-supported-backends]]
| **Backend** | **Supported Versions** | **Python versions** | **Architecture Support** | **Status** | | **Backend** | **Supported Versions** | **Python versions** | **Architecture Support** | **Status** |
|-------------|------------------------|---------------------------|-------------------------|------------| |-------------|------------------------|---------------------------|-------------------------|------------|
| **AMD ROCm** | 6.1+ | 3.10+ | minimum CDNA - `gfx90a`, RDNA - `gfx1100` | Alpha | | **AMD ROCm** | 6.1+ | 3.10+ | minimum CDNA - `gfx90a`, RDNA - `gfx1100` | Alpha |
| **Apple Silicon (MPS)** | WIP | 3.10+ | M1/M2 chips | Planned |
| **Intel CPU** | v2.4.0+ (`ipex`) | 3.10+ | Intel CPU | Alpha | | **Intel CPU** | v2.4.0+ (`ipex`) | 3.10+ | Intel CPU | Alpha |
| **Intel GPU** | v2.4.0+ (`ipex`) | 3.10+ | Intel GPU | Experimental | | **Intel GPU** | v2.4.0+ (`ipex`) | 3.10+ | Intel GPU | Experimental |
| **Ascend NPU** | 2.1.0+ (`torch_npu`) | 3.10+ | Ascend NPU | Experimental | | **Ascend NPU** | 2.1.0+ (`torch_npu`) | 3.10+ | Ascend NPU | Experimental |
...@@ -204,9 +146,9 @@ For each supported backend, follow the respective instructions below: ...@@ -204,9 +146,9 @@ For each supported backend, follow the respective instructions below:
### Pre-requisites[[multi-backend-pre-requisites]] ### Pre-requisites[[multi-backend-pre-requisites]]
To use bitsandbytes non-CUDA backends, be sure to install: To use this preview version of `bitsandbytes` with `transformers`, be sure to install:
``` ```bash
pip install "transformers>=4.45.1" pip install "transformers>=4.45.1"
``` ```
...@@ -218,33 +160,26 @@ pip install "transformers>=4.45.1" ...@@ -218,33 +160,26 @@ pip install "transformers>=4.45.1"
> >
> Other supported versions that don't come with pre-compiled binaries [can be compiled for with these instructions](#multi-backend-compile). > Other supported versions that don't come with pre-compiled binaries [can be compiled for with these instructions](#multi-backend-compile).
> >
> **Windows is not supported for the ROCm backend**; also not WSL2 to our knowledge. > **Windows is not supported for the ROCm backend**
> [!TIP] > [!TIP]
> 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/`! > 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/`!
```bash ```bash
# Create a docker container with latest ROCm image, which includes ROCm libraries # Create a docker container with the ROCm image, which includes ROCm libraries
docker pull rocm/dev-ubuntu-22.04:6.1.2-complete docker pull rocm/dev-ubuntu-22.04:6.3.4-complete
docker run -it --device=/dev/kfd --device=/dev/dri --group-add video rocm/dev-ubuntu-22.04:6.1.2-complete docker run -it --device=/dev/kfd --device=/dev/dri --group-add video rocm/dev-ubuntu-22.04:6.3.4-complete
apt-get update && apt-get install -y git && cd home apt-get update && apt-get install -y git && cd home
# Install pytorch compatible with above ROCm version # Install pytorch compatible with above ROCm version
pip install torch --index-url https://download.pytorch.org/whl/rocm6.1/ pip install torch --index-url https://download.pytorch.org/whl/rocm6.3/
``` ```
</hfoption> </hfoption>
<hfoption id="Intel CPU + GPU"> <hfoption id="Intel XPU">
Compatible hardware and functioning `import intel_extension_for_pytorch as ipex` capable environment with Python `3.10` as the minimum requirement.
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.
</hfoption>
<hfoption id="Apple Silicon (MPS)">
> [!TIP] * A compatible PyTorch version with Intel XPU support is required. It is recommended to use the latest stable release. See [Getting Started on Intel GPU](https://docs.pytorch.org/docs/stable/notes/get_start_xpu.html) for guidance.
> 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. * The [Intel Extension for PyTorch](https://intel.github.io/intel-extension-for-pytorch/xpu/latest/) is recommended for performance improvements.
</hfoption> </hfoption>
</hfoptions> </hfoptions>
...@@ -257,38 +192,22 @@ You can install the pre-built wheels for each backend, or compile from source fo ...@@ -257,38 +192,22 @@ You can install the pre-built wheels for each backend, or compile from source fo
<hfoptions id="platform"> <hfoptions id="platform">
<hfoption id="Linux"> <hfoption id="Linux">
This wheel provides support for ROCm and Intel XPU platforms.
``` ```
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag! # 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' 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'
``` ```
</hfoption> </hfoption>
<hfoption id="Windows"> <hfoption id="Windows">
This wheel provides support for the Intel XPU platform.
``` ```bash
# Note, if you don't want to reinstall BNBs dependencies, append the `--no-deps` flag! # 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-win_amd64.whl' 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'
``` ```
</hfoption>
<hfoption id="Ascend NPU">
Compatible hardware and functioning `import torch_npu` capable environment with Python `3.10` as the minimum requirement.
Please refer to [the official Ascend installations instructions](https://www.hiascend.com/document/detail/zh/Pytorch/60RC3/configandinstg/instg/insg_0001.html) for guidance on how to pip install the necessary `torch_npu` dependency.
</hfoption>
<hfoption id="Mac">
> [!WARNING]
> 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.
```
# Note, if you don't want to reinstall BNBs 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-macosx_13_1_arm64.whl'
```
</hfoption> </hfoption>
</hfoptions> </hfoptions>
...@@ -299,7 +218,7 @@ pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsan ...@@ -299,7 +218,7 @@ pip install --force-reinstall 'https://github.com/bitsandbytes-foundation/bitsan
#### AMD GPU #### AMD GPU
bitsandbytes is fully supported from ROCm 6.1 onwards (currently in alpha release). bitsandbytes is supported from ROCm 6.1 - ROCm 6.4.
```bash ```bash
# Install bitsandbytes from source # Install bitsandbytes from source
...@@ -318,29 +237,24 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise ...@@ -318,29 +237,24 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise
#### Intel CPU + XPU #### Intel CPU + XPU
> [!TIP]
> Intel CPU/XPU backend only supports building from source; for now, please follow the instructions below.
It does not need compile CPP codes, all required ops are in [intel_extension_for_pytorch](https://pytorch-extension.intel.com/), please follow the instruction to install ipex. It does not need compile CPP codes, all required ops are in [intel_extension_for_pytorch](https://pytorch-extension.intel.com/), please follow the instruction to install ipex.
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). 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).
``` ```bash
pip install intel_extension_for_pytorch pip install intel_extension_for_pytorch
git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ git clone --depth 1 -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out) pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out)
``` ```
</hfoption> </hfoption>
<hfoption id="Ascend NPU"> <hfoption id="Ascend NPU">
#### Ascend NPU #### Ascend NPU
> [!TIP] Please refer to [the official Ascend installations instructions](https://www.hiascend.com/document/detail/zh/Pytorch/60RC3/configandinstg/instg/insg_0001.html) for guidance on how to install the necessary `torch_npu` dependency.
> Ascend NPU backend only supports building from source; for now, please follow the instructions below.
``` ```bash
# Install bitsandbytes from source # Install bitsandbytes from source
# Clone bitsandbytes repo, Ascend NPU backend is currently enabled on multi-backend-refactor branch # Clone bitsandbytes repo, Ascend NPU backend is currently enabled on multi-backend-refactor branch
git clone -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/ git clone -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
...@@ -351,14 +265,5 @@ cmake -DCOMPUTE_BACKEND=npu -S . ...@@ -351,14 +265,5 @@ cmake -DCOMPUTE_BACKEND=npu -S .
make make
pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out) pip install -e . # `-e` for "editable" install, when developing BNB (otherwise leave that out)
``` ```
</hfoption>
<hfoption id="Apple Silicon (MPS)">
#### Apple Silicon
WIP
</hfoption> </hfoption>
</hfoptions> </hfoptions>
# Multi-backend support (non-CUDA backends)
> [!Tip]
> 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.
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.
At present, the Intel CPU and AMD ROCm backends are considered fully functional. The Intel XPU backend has limited functionality and is less mature.
Please refer to the [installation instructions](./installation#multi-backend) for details on installing the backend you intend to test (and hopefully provide feedback on).
> [!Tip]
> Apple Silicon support is planned for Q4 2024. We are actively seeking contributors to help implement this, develop a concrete plan, and create a detailed list of requirements. Due to limited resources, we rely on community contributions for this implementation effort. To discuss further, please spell out your thoughts and discuss in [this GitHub discussion](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1340) and tag `@Titus-von-Koeller` and `@matthewdouglas`. Thank you!
## Alpha Release
As we are currently in the alpha testing phase, bugs are expected, and performance might not meet expectations. However, this is exactly what we want to discover from **your** perspective as the end user!
Please share and discuss your feedback with us here:
- [Github Discussion: Multi-backend refactor: Alpha release ( AMD ROCm ONLY )](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1339)
- [Github Discussion: Multi-backend refactor: Alpha release ( Intel ONLY )](https://github.com/bitsandbytes-foundation/bitsandbytes/discussions/1338)
Thank you for your support!
## Benchmarks
### Intel
The following performance data is collected from Intel 4th Gen Xeon (SPR) platform. The tables show speed-up and memory compared with different data types of [Llama-2-7b-chat-hf](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf).
#### Inference (CPU)
| Data Type | BF16 | INT8 | NF4 | FP4 |
|---|---|---|---|---|
| Speed-Up (vs BF16) | 1.0x | 0.6x | 2.3x | 0.03x |
| Memory (GB) | 13.1 | 7.6 | 5.0 | 4.6 |
#### Fine-Tuning (CPU)
| Data Type | AMP BF16 | INT8 | NF4 | FP4 |
|---|---|---|---|---|
| Speed-Up (vs AMP BF16) | 1.0x | 0.38x | 0.07x | 0.07x |
| Memory (GB) | 40 | 9 | 6.6 | 6.6 |
...@@ -9,8 +9,6 @@ The `bitsandbytes.functional` API provides the low-level building blocks for the ...@@ -9,8 +9,6 @@ The `bitsandbytes.functional` API provides the low-level building blocks for the
* For experimental or research purposes requiring non-standard quantization or performance optimizations. * For experimental or research purposes requiring non-standard quantization or performance optimizations.
## LLM.int8() ## LLM.int8()
[[autodoc]] functional.int8_double_quant
[[autodoc]] functional.int8_linear_matmul [[autodoc]] functional.int8_linear_matmul
[[autodoc]] functional.int8_mm_dequant [[autodoc]] functional.int8_mm_dequant
...@@ -19,7 +17,6 @@ The `bitsandbytes.functional` API provides the low-level building blocks for the ...@@ -19,7 +17,6 @@ The `bitsandbytes.functional` API provides the low-level building blocks for the
[[autodoc]] functional.int8_vectorwise_quant [[autodoc]] functional.int8_vectorwise_quant
## 4-bit ## 4-bit
[[autodoc]] functional.dequantize_4bit [[autodoc]] functional.dequantize_4bit
...@@ -49,5 +46,3 @@ For more details see [8-Bit Approximations for Parallelism in Deep Learning](htt ...@@ -49,5 +46,3 @@ For more details see [8-Bit Approximations for Parallelism in Deep Learning](htt
## Utility ## Utility
[[autodoc]] functional.get_ptr [[autodoc]] functional.get_ptr
[[autodoc]] functional.is_on_gpu
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment