File size: 833 Bytes
286e907
 
ed43c25
 
 
286e907
 
04a8e39
 
 
97cdfb4
3bf0ceb
7a72b0a
97cdfb4
 
 
 
 
 
 
 
 
 
7a72b0a
 
3bf0ceb
7a72b0a
3bf0ceb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
---
library_name: transformers
license: bigcode-openrail-m
base_model:
- bigcode/starcoder2-3b
---

Bitsandbytes quantization of https://huggingface.co/bigcode/starcoder2-3b.

See https://huggingface.co/blog/4bit-transformers-bitsandbytes for instructions.

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers import BitsAndBytesConfig
import torch

nf4_config = BitsAndBytesConfig(
   load_in_4bit=True,
   bnb_4bit_quant_type="nf4",
   bnb_4bit_use_double_quant=True,
   bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder2-3b", quantization_config=nf4_config)
tokenizer = AutoTokenizer.from_pretrained("bigcode/starcoder2-3b")

model.push_to_hub("onekq-ai/starcoder2-3b-bnb-4bit")
tokenizer.push_to_hub("onekq-ai/starcoder2-3b-bnb-4bit")
```