Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: llama3
|
3 |
+
---
|
4 |
+
|
5 |
+
- Foundation Model [google/gemma-1.1-7b-it](https://huggingface.co/google/gemma-1.1-7b-it)
|
6 |
+
- datasets
|
7 |
+
- [jojo0217/korean_safe_conversation](https://huggingface.co/datasets/jojo0217/korean_safe_conversation)
|
8 |
+
|
9 |
+
|
10 |
+
# Usage for VLLM
|
11 |
+
```python
|
12 |
+
from vllm import LLM, SamplingParams
|
13 |
+
from transformers import AutoTokenizer, pipeline
|
14 |
+
|
15 |
+
BASE_MODEL = "sh2orc/gemma-1.1-korean-7b-it"
|
16 |
+
|
17 |
+
llm = LLM(model=BASE_MODEL)
|
18 |
+
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
|
20 |
+
tokenizer.pad_token = tokenizer.eos_token
|
21 |
+
tokenizer.padding_side = 'right'
|
22 |
+
|
23 |
+
instruction = 'λ
λμ λν΄μ μλ €μ€'
|
24 |
+
|
25 |
+
messages = [
|
26 |
+
{
|
27 |
+
"role": "user",
|
28 |
+
"content": instruction
|
29 |
+
},
|
30 |
+
]
|
31 |
+
|
32 |
+
|
33 |
+
prompt_message = tokenizer.apply_chat_template(
|
34 |
+
messages,
|
35 |
+
tokenize=False,
|
36 |
+
add_generation_prompt=True,
|
37 |
+
)
|
38 |
+
|
39 |
+
eos_token_id = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<end_of_turn>")]
|
40 |
+
|
41 |
+
outputs = llm.generate(prompt_message, SamplingParams(stop_token_ids=eos_token_id, temperature=0.2, top_p=0.8,max_tokens=4096))
|
42 |
+
|
43 |
+
for output in outputs:
|
44 |
+
propt = output.prompt
|
45 |
+
generated_text = output.outputs[0].text
|
46 |
+
print(generated_text)
|
47 |
+
|
48 |
+
```
|
49 |
+
|
50 |
+
|
51 |
+
# Result
|
52 |
+
<pre>
|
53 |
+
λ
λλ λν΄μ μμΉν λνλ―Όκ΅μ νΉλ³μμΉλλ‘, λ©΄μ μ 5.8kmμ΄λ©°, νμ ꡬμμ λ
λκ΅°μ
λλ€. λ
λμ λ©΄μ μ λλ΅ 5.8kmμ΄λ©°, μΈκ΅¬λ μ½ 10λͺ
μ
λλ€. λ
λλ νκ΅κ³Ό μΌλ³Έμ κ΅κ²½μ νμ±νκ³ μμΌλ©°, λ
λμ μ£Όλ―Όλ€μ μΌλ³Έμ μν₯μ λ§μ΄ λ°μμ΅λλ€. λ
λμ κ²½μ λ κ΄κ΄κ³Ό μκ·λͺ¨μ μ΄μ
μ΄ μ£Όλ₯Ό μ΄λ£¨λ©°, λ
λλ 1949λ
λΆν° 1954λ
κΉμ§ μΌλ³Έμ μν΄ μ λ Ήλμμ΅λλ€. λ
λλ 1954λ
μΈμ² κ°ν μ‘°μ½μΌλ‘ μΈν΄ μ°λ¦¬λλΌμ μν κ° λμμ΅λλ€.
|
54 |
+
</pre>
|
55 |
+
|