Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,18 @@
|
|
1 |
-
|
2 |
-
import
|
3 |
-
import
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
base_model = AutoModelForCausalLM.from_pretrained(
|
6 |
-
|
7 |
quantization_config=bnb_config, # Same quantization config as before
|
8 |
device_map="auto",
|
9 |
trust_remote_code=True,
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
4 |
+
|
5 |
+
base_model_id = "mistralai/Mistral-7B-v0.1"
|
6 |
+
bnb_config = BitsAndBytesConfig(
|
7 |
+
load_in_4bit=True,
|
8 |
+
bnb_4bit_use_double_quant=True,
|
9 |
+
bnb_4bit_quant_type="nf4",
|
10 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
11 |
+
)
|
12 |
+
|
13 |
+
model = AutoModelForCausalLM.from_pretrained(base_model_id, quantization_config=bnb_config)
|
14 |
base_model = AutoModelForCausalLM.from_pretrained(
|
15 |
+
base_model_id, # Mistral, same as before
|
16 |
quantization_config=bnb_config, # Same quantization config as before
|
17 |
device_map="auto",
|
18 |
trust_remote_code=True,
|