joaogante HF staff commited on
Commit
fdf5fbd
·
verified ·
1 Parent(s): e8e07e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,8 +8,8 @@ import time
8
  model_id = "facebook/opt-6.7b"
9
  assistant_id = "facebook/opt-125m"
10
 
11
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
12
- assistant_model = AutoModelForCausalLM.from_pretrained(assistant_id).to(device=model.device, dtype=torch.float16)
13
  tokenizer = AutoTokenizer.from_pretrained(model_id)
14
 
15
  def run_generation(user_text, use_assistant, temperature, max_new_tokens):
 
8
  model_id = "facebook/opt-6.7b"
9
  assistant_id = "facebook/opt-125m"
10
 
11
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_8bit=True, device_map="auto")
12
+ assistant_model = AutoModelForCausalLM.from_pretrained(assistant_id).to(device=model.device, dtype=torch.bfloat16)
13
  tokenizer = AutoTokenizer.from_pretrained(model_id)
14
 
15
  def run_generation(user_text, use_assistant, temperature, max_new_tokens):