Update README.md
Browse files
README.md
CHANGED
@@ -39,6 +39,19 @@ pip install bitsandbytes
|
|
39 |
|
40 |
```python
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
def load_model_tokenizer(model_name: str, bnb_config: BitsAndBytesConfig) -> Tuple[AutoModelForCausalLM, AutoTokenizer]:
|
43 |
"""
|
44 |
Load the model and tokenizer from the HuggingFace model hub using quantization.
|
|
|
39 |
|
40 |
```python
|
41 |
|
42 |
+
# Activate 4-bit precision base model loading (bool)
|
43 |
+
load_in_4bit = True
|
44 |
+
|
45 |
+
# Activate nested quantization for 4-bit base models (double quantization) (bool)
|
46 |
+
bnb_4bit_use_double_quant = True
|
47 |
+
|
48 |
+
# Quantization type (fp4 or nf4) (string)
|
49 |
+
bnb_4bit_quant_type = "nf4"
|
50 |
+
|
51 |
+
# Compute data type for 4-bit base models
|
52 |
+
bnb_4bit_compute_dtype = torch.bfloat16
|
53 |
+
|
54 |
+
|
55 |
def load_model_tokenizer(model_name: str, bnb_config: BitsAndBytesConfig) -> Tuple[AutoModelForCausalLM, AutoTokenizer]:
|
56 |
"""
|
57 |
Load the model and tokenizer from the HuggingFace model hub using quantization.
|