Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,16 @@ import torch
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
model_id = "AetherResearch/Cerebrum-1.0-8x7b"
|
| 12 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 13 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=
|
| 14 |
|
| 15 |
@spaces.GPU
|
| 16 |
def generate_response(user_input, max_new_tokens, temperature):
|
|
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
|
| 9 |
+
nf4_config = BitsAndBytesConfig(
|
| 10 |
+
load_in_4bit=True,
|
| 11 |
+
bnb_4bit_quant_type="nf4",
|
| 12 |
+
bnb_4bit_use_double_quant=True,
|
| 13 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
| 14 |
+
)
|
| 15 |
|
| 16 |
model_id = "AetherResearch/Cerebrum-1.0-8x7b"
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 18 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=nf4_config)
|
| 19 |
|
| 20 |
@spaces.GPU
|
| 21 |
def generate_response(user_input, max_new_tokens, temperature):
|