Update README.md
Browse files
README.md
CHANGED
@@ -4,4 +4,48 @@ datasets:
|
|
4 |
- jojo0217/korean_rlhf_dataset
|
5 |
language:
|
6 |
- ko
|
7 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
- jojo0217/korean_rlhf_dataset
|
5 |
language:
|
6 |
- ko
|
7 |
+
---
|
8 |
+
|
9 |
+
μ±κ· κ΄λνκ΅ μ°ννλ ₯ κ³Όμ μμ λ§λ ν
μ€νΈ λͺ¨λΈμ
λλ€.
|
10 |
+
νμ΅ λ°μ΄ν°μ μ°Έκ³ λͺ¨λΈμ΄λΌκ³ μκ°νμλ©΄ μ’μ κ² κ°μ΅λλ€.
|
11 |
+
κΈ°μ‘΄ 10λ§ 7μ²κ°μ λ°μ΄ν° + 2μ²κ° μΌμλν μΆκ° λ°μ΄ν°λ₯Ό 첨κ°νμ¬ νμ΅νμμ΅λλ€.
|
12 |
+
|
13 |
+
μΈ‘μ ν kobest μ μλ λ€μκ³Ό κ°μ΅λλ€.
|
14 |
+
![score](./asset/score.png)
|
15 |
+
|
16 |
+
|
17 |
+
ν
μ€νΈ μ½λλ λ€μκ³Ό κ°μ΅λλ€.
|
18 |
+
```
|
19 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
20 |
+
|
21 |
+
model_name="jojo0217/ChatSKKU5.8B"
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(
|
24 |
+
model_name,
|
25 |
+
device_map="auto",
|
26 |
+
load_in_8bit=True,#λ§μ½ μμν λκ³ μΆλ€λ©΄ false
|
27 |
+
)
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
29 |
+
pipe = pipeline(
|
30 |
+
"text-generation",
|
31 |
+
model=model,
|
32 |
+
tokenizer=model_name,
|
33 |
+
device_map="auto"
|
34 |
+
)
|
35 |
+
|
36 |
+
def answer(message):
|
37 |
+
prompt=f"μλλ μμ
μ μ€λͺ
νλ λͺ
λ Ήμ΄μ
λλ€. μμ²μ μ μ ν μλ£νλ μλ΅μ μμ±νμΈμ.\n\n### λͺ
λ Ήμ΄:\n{message}"
|
38 |
+
ans = pipe(
|
39 |
+
prompt + "\n\n### μλ΅:",
|
40 |
+
do_sample=True,
|
41 |
+
max_new_tokens=512,
|
42 |
+
temperature=0.9,
|
43 |
+
num_beams = 1,
|
44 |
+
repetition_penalty = 1.0,
|
45 |
+
return_full_text=False,
|
46 |
+
eos_token_id=2,
|
47 |
+
)
|
48 |
+
msg = ans[0]["generated_text"]
|
49 |
+
return msg
|
50 |
+
answer('μ±κ· κ΄λνκ΅μλν΄ μλ €μ€')
|
51 |
+
```
|