-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Embedding | ||
|
||
The embedding class is used to store and retrieve word embeddings from their indices. There are two types of embeddings in bitsandbytes, the standard PyTorch [`Embedding`] class and the [`StableEmbedding`] class. | ||
|
||
The [`StableEmbedding`] class was introduced in the [8-bit Optimizers via Block-wise Quantization](https://hf.co/papers/2110.02861) paper to reduce gradient variance as a result of the non-uniform distribution of input tokens. This class is designed to support quantization. | ||
|
||
## Embedding | ||
|
||
[[autodoc]] bitsandbytes.nn.Embedding | ||
- __init__ | ||
|
||
## StableEmbedding | ||
|
||
[[autodoc]] bitsandbytes.nn.StableEmbedding | ||
- __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 4-bit quantization | ||
|
||
[QLoRA](https://hf.co/papers/2305.14314) is a finetuning method that quantizes a model to 4-bits and adds a set of low-rank adaptation (LoRA) weights to the model and tuning them through the quantized weights. This method also introduces a new data type, 4-bit NormalFloat (`LinearNF4`) in addition to the standard Float4 data type (`LinearFP4`). `LinearNF4` is adapted for weights initialized from a normal distribution and can improve performance. | ||
|
||
## Linear4bit | ||
|
||
[[autodoc]] bitsandbytes.nn.Linear4bit | ||
- __init__ | ||
|
||
## LinearFP4 | ||
|
||
[[autdodoc]] bitsandbytes.nn.LinearFP4 | ||
- __init__ | ||
|
||
## LinearNF4 | ||
|
||
[[autodoc]] bitsandbytes.nn.LinearNF4 | ||
- __init__ | ||
|
||
## Params4bit | ||
|
||
[[autodoc]] bitsandbytes.nn.Params4bit | ||
- __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 8-bit quantization | ||
|
||
[LLM.int8()](https://hf.co/papers/2208.07339) is a quantization method that doesn't degrade performance which makes large model inference more accessible. The key is to extract the outliers from the inputs and weights and multiply them in 16-bit. All other values are multiplied in 8-bit and quantized to Int8 before being dequantized back to 16-bits. The outputs from the 16-bit and 8-bit multiplication are combined to produce the final output. | ||
|
||
## Linear8bitLt | ||
|
||
[[autodoc]] bitsandbytes.nn.Linear8bitLt | ||
- __init__ | ||
|
||
## Int8Params | ||
|
||
[[autodoc]] bitsandbytes.nn.Int8Params | ||
- __init__ |