Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,14 @@ print("********************")
|
|
16 |
print(device)
|
17 |
print("********************")
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
model = model.to(device)
|
21 |
|
22 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
|
16 |
print(device)
|
17 |
print("********************")
|
18 |
|
19 |
+
bnb_config = transformers.BitsAndBytesConfig(
|
20 |
+
load_in_4bit=True,
|
21 |
+
bnb_4bit_quant_type='nf4',
|
22 |
+
bnb_4bit_use_double_quant=True,
|
23 |
+
bnb_4bit_compute_dtype=bfloat16
|
24 |
+
)
|
25 |
+
|
26 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, config=config, quantization_config=bnb_config)
|
27 |
model = model.to(device)
|
28 |
|
29 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|