setup sft model
Browse files- README.md +1 -1
- app.py +7 -7
- requirements.txt +2 -1
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: Chinese Lantern Riddles LLM Solver V2
|
3 |
emoji: 🏮
|
4 |
colorFrom: gray
|
5 |
colorTo: indigo
|
|
|
1 |
---
|
2 |
+
title: Chinese Lantern Riddles LLM Solver V2 with SFT
|
3 |
emoji: 🏮
|
4 |
colorFrom: gray
|
5 |
colorTo: indigo
|
app.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
3 |
from langchain.vectorstores import Chroma
|
4 |
from langchain.embeddings import HuggingFaceEmbeddings
|
|
|
5 |
|
6 |
import gradio as gr
|
7 |
import hanzidentifier
|
@@ -17,15 +18,14 @@ current_path=str(pathlib.Path(__file__).parent.resolve())
|
|
17 |
llm_model_name="Qwen/Qwen1.5-0.5B-Chat"
|
18 |
|
19 |
#pipe = pipeline("text2text-generation", model=model)
|
20 |
-
model = AutoModelForCausalLM.from_pretrained(
|
21 |
-
llm_model_name
|
22 |
-
)
|
23 |
-
|
24 |
-
#model = AutoPeftModelForCausalLM.from_pretrained(
|
25 |
-
# "Qwen1.5_0.5B_Chat_sft_full/checkpoint-300",
|
26 |
-
# low_cpu_mem_usage=True,
|
27 |
#)
|
28 |
|
|
|
|
|
|
|
|
|
29 |
tokenizer = AutoTokenizer.from_pretrained(llm_model_name)
|
30 |
|
31 |
# %%
|
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
3 |
from langchain.vectorstores import Chroma
|
4 |
from langchain.embeddings import HuggingFaceEmbeddings
|
5 |
+
from peft import AutoPeftModelForCausalLM
|
6 |
|
7 |
import gradio as gr
|
8 |
import hanzidentifier
|
|
|
18 |
llm_model_name="Qwen/Qwen1.5-0.5B-Chat"
|
19 |
|
20 |
#pipe = pipeline("text2text-generation", model=model)
|
21 |
+
#model = AutoModelForCausalLM.from_pretrained(
|
22 |
+
# llm_model_name
|
|
|
|
|
|
|
|
|
|
|
23 |
#)
|
24 |
|
25 |
+
model = AutoPeftModelForCausalLM.from_pretrained(
|
26 |
+
"ytyeung/Qwen1.5-0.5B-Chat-SFT-riddles",
|
27 |
+
)
|
28 |
+
|
29 |
tokenizer = AutoTokenizer.from_pretrained(llm_model_name)
|
30 |
|
31 |
# %%
|
requirements.txt
CHANGED
@@ -5,4 +5,5 @@ chromadb
|
|
5 |
sentence-transformers
|
6 |
sentencepiece
|
7 |
hanzidentifier
|
8 |
-
chinese-converter
|
|
|
|
5 |
sentence-transformers
|
6 |
sentencepiece
|
7 |
hanzidentifier
|
8 |
+
chinese-converter
|
9 |
+
peft
|