PhantHive commited on
Commit
42f33f5
·
verified ·
1 Parent(s): a6a2fe3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -14,12 +14,16 @@ else:
14
  # Load the model and config when the script starts
15
  peft_model_id = "phearion/bigbrain-v0.0.1"
16
  config = PeftConfig.from_pretrained(peft_model_id)
17
- model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True)
 
 
 
 
18
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
19
 
20
  # Load the Lora model
21
  model = PeftModel.from_pretrained(model, peft_model_id)
22
-
23
 
24
  def greet(text):
25
  batch = tokenizer(f"\"{text}\" ->: ", return_tensors='pt')
 
14
  # Load the model and config when the script starts
15
  peft_model_id = "phearion/bigbrain-v0.0.1"
16
  config = PeftConfig.from_pretrained(peft_model_id)
17
+ model = AutoModelForCausalLM.from_pretrained(
18
+ config.base_model_name_or_path,
19
+ low_cpu_mem_usage=True,
20
+ return_dict=True,
21
+ torch_dtype=torch.bfloat16)
22
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
23
 
24
  # Load the Lora model
25
  model = PeftModel.from_pretrained(model, peft_model_id)
26
+ model = model.merge_and_unload()
27
 
28
  def greet(text):
29
  batch = tokenizer(f"\"{text}\" ->: ", return_tensors='pt')