Tonic commited on
Commit
4ffc0ce
1 Parent(s): d992640

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -1,9 +1,18 @@
1
- from transformers import AutoModelForCausalLM, AutoTokenizer
2
- import gradio as gr
3
- import torch
4
-
 
 
 
 
 
 
 
 
 
5
  base_model = AutoModelForCausalLM.from_pretrained(
6
- Mistral, # Mistral, same as before
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,