bryantaekim commited on
Commit
7eb4bc9
β€’
1 Parent(s): 336e6ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -3,14 +3,14 @@ from peft import PeftModel, PeftConfig
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
  peft_model_id = f"bryantaekim/bk_text_to_ad"
6
- # config = PeftConfig.from_pretrained(peft_model_id)
7
- # model = AutoModelForCausalLM.from_pretrained(
8
- # config.base_model_name_or_path,
9
- # return_dict=True,
10
- # load_in_8bit=True,
11
- # device_map="auto",
12
- # )
13
- # tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
14
 
15
  # Load the Lora model
16
  model = PeftModel.from_pretrained(model, peft_model_id)
 
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
  peft_model_id = f"bryantaekim/bk_text_to_ad"
6
+ config = PeftConfig.from_pretrained(peft_model_id)
7
+ model = AutoModelForCausalLM.from_pretrained(
8
+ config.base_model_name_or_path,
9
+ return_dict=True,
10
+ load_in_8bit=True,
11
+ device_map="auto",
12
+ )
13
+ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
14
 
15
  # Load the Lora model
16
  model = PeftModel.from_pretrained(model, peft_model_id)