Jimin Park commited on
Commit
014e235
·
1 Parent(s): 6468a2a

updated req.txt and app.py

Browse files
Files changed (2) hide show
  1. app.py +18 -1
  2. requirements.txt +3 -1
app.py CHANGED
@@ -1,7 +1,24 @@
1
  from transformers import pipeline
 
2
  import gradio as gr
3
 
4
- chatbot = pipeline(model="ivwhy/lora_model")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  message_list = []
7
  response_list = []
 
1
  from transformers import pipeline
2
+ from peft import PeftModel, PeftConfig
3
  import gradio as gr
4
 
5
+
6
+ base_model = "unsloth/Llama-3.2-3B-Instruct" # Replace with the correct base model
7
+ peft_model_path = "ivwhy/lora_model"
8
+
9
+ config = PeftConfig.from_pretrained(peft_model_path)
10
+ model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype=torch.bfloat16)
11
+ model = PeftModel.from_pretrained(model, peft_model_path)
12
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
13
+
14
+ pipeline = transformers.pipeline(
15
+ "text-generation",
16
+ model=model,
17
+ tokenizer=tokenizer,
18
+ device=-1, # CPU
19
+ )
20
+
21
+ chatbot = pipeline
22
 
23
  message_list = []
24
  response_list = []
requirements.txt CHANGED
@@ -1,3 +1,5 @@
1
  torch
2
  transformers
3
- gradio
 
 
 
1
  torch
2
  transformers
3
+ gradio
4
+ python-dotenv
5
+ peft